Take script fragments from resources in the jar
This commit is contained in:
parent
f62d08e5e7
commit
577f4eb1b8
12
project.clj
12
project.clj
|
@ -12,4 +12,14 @@
|
|||
[hiccup "1.0.5"]]
|
||||
:aot [adl.main]
|
||||
:main adl.main
|
||||
:plugins [[lein-codox "0.10.3"]])
|
||||
:plugins [[lein-codox "0.10.3"]
|
||||
[lein-release "1.0.5"]]
|
||||
|
||||
:release-tasks [["vcs" "assert-committed"]
|
||||
["change" "version" "leiningen.release/bump-version" "release"]
|
||||
["vcs" "commit"]
|
||||
;; ["vcs" "tag"] -- not working, problems with secret key
|
||||
["clean"]
|
||||
["uberjar"]
|
||||
["change" "version" "leiningen.release/bump-version"]
|
||||
["vcs" "commit"]])
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
adl.to-selmer-templates
|
||||
(:require [adl.to-hugsql-queries :refer [expanded-token]]
|
||||
[adl-support.utils :refer :all]
|
||||
[clojure.java.io :refer [file make-parents]]
|
||||
[clojure.java.io :refer [file make-parents resource]]
|
||||
[clojure.pprint :as p]
|
||||
[clojure.string :as s]
|
||||
[clojure.xml :as x]
|
||||
|
@ -423,11 +423,11 @@
|
|||
|
||||
|
||||
(defn embed-script-fragment
|
||||
"Return the content of the file at `filepath`, with these `substitutions`
|
||||
"Return the content of the file at `resource-path`, with these `substitutions`
|
||||
made into it in order. Substitutions should be pairss [`pattern` `value`],
|
||||
where `pattern` is a string, a char, or a regular expression."
|
||||
([filepath substitutions]
|
||||
(let [v (slurp filepath)]
|
||||
([resource-path substitutions]
|
||||
(let [v (slurp (resource resource-path))]
|
||||
(reduce
|
||||
(fn [s [pattern value]]
|
||||
(if (and pattern value)
|
||||
|
@ -435,8 +435,8 @@
|
|||
s))
|
||||
v
|
||||
substitutions)))
|
||||
([filepath]
|
||||
(embed-script-fragment filepath [])))
|
||||
([resource-path]
|
||||
(embed-script-fragment resource-path [])))
|
||||
|
||||
|
||||
(defn edit-link
|
||||
|
@ -622,7 +622,7 @@
|
|||
(if
|
||||
(> magnitude 2)
|
||||
(embed-script-fragment
|
||||
"resources/js/selectize-one.js"
|
||||
"js/selectize-one.js"
|
||||
[["{{widget_id}}" (-> property :attrs :name)]
|
||||
["{{widget_value}}" (str "{{record." (-> property :attrs :name) "}}")]
|
||||
["{{entity}}" farname]
|
||||
|
@ -635,7 +635,7 @@
|
|||
(child-with-tag
|
||||
form :field
|
||||
#(= "text-area" (widget-type (property-for-field % entity) application)))
|
||||
(embed-script-fragment "resources/js/text-area-md-support.js"
|
||||
(embed-script-fragment "js/text-area-md-support.js"
|
||||
[["{{page}}" (-> form :attrs :name)]]))))))}})
|
||||
|
||||
|
||||
|
@ -899,6 +899,7 @@
|
|||
template
|
||||
(try
|
||||
(do
|
||||
(make-parents filepath)
|
||||
(spit
|
||||
filepath
|
||||
(s/join
|
||||
|
@ -967,6 +968,7 @@
|
|||
(str
|
||||
"ERROR: Exception "
|
||||
(.getName (.getClass any))
|
||||
" "
|
||||
(.getMessage any)
|
||||
" while writing "
|
||||
filename))))))
|
||||
|
|
|
@ -69,17 +69,6 @@
|
|||
(remove :tag (remove nil? (map first (map
|
||||
#(try-validate ~o '%)
|
||||
~validations))))))
|
||||
;; ]
|
||||
;; ;; if *any* succeeded, we succeeded
|
||||
;; ;; otherwise, one of these is the valid error - but which? The answer, in my case
|
||||
;; ;; is that if there is any which did not fail on the :tag check, then that is the
|
||||
;; ;; interesting one. But generally?
|
||||
;; (try
|
||||
;; (doall (map #(println (str "ERROR: " %)) suspicious))
|
||||
;; (empty? suspicious)
|
||||
;; (catch Exception _ (println "ERROR while trying to print errors")
|
||||
;; true))))
|
||||
|
||||
|
||||
;;; the remainder of this file is a fairly straight translation of the ADL 1.4 DTD into Clojure
|
||||
|
||||
|
|
Loading…
Reference in a new issue