Refactor generate-output-file-map to use ->>
This commit is contained in:
parent
709ca93d98
commit
175dae050b
|
@ -20,7 +20,6 @@ the filenames as keyword keys"
|
|||
(let [files (list-files template-dir)]
|
||||
(reduce #(assoc %1 (keyword (.getName %2)) (slurp %2)) {} files)))
|
||||
|
||||
; Generate a string-string map of the new filepaths and the unprocessed contents
|
||||
(defn generate-output-file-map
|
||||
"Take the input html files, read them, and create a mapping of their paths to
|
||||
their contents.
|
||||
|
@ -28,9 +27,11 @@ the filenames as keyword keys"
|
|||
[html-dir, output-dir]
|
||||
(let [file-listing (list-files html-dir)
|
||||
contents (map slurp file-listing)
|
||||
old-paths (map #(.getPath %) file-listing)
|
||||
rootless-paths (map #(subs % (count html-dir)) old-paths)
|
||||
new-paths (map #(string/join [output-dir %]) rootless-paths)]
|
||||
new-paths (map #(->> %
|
||||
.getPath
|
||||
(drop (count html-dir))
|
||||
(cons output-dir)
|
||||
(string/join)) file-listing)]
|
||||
(zipmap new-paths contents)))
|
||||
|
||||
(defn put_file
|
||||
|
@ -60,5 +61,5 @@ the filenames as keyword keys"
|
|||
(for [of output-file-map]
|
||||
; of is a key-value pair
|
||||
(put_file (insert_templates of template-map))
|
||||
;(put_file of)
|
||||
;(put_file of)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue