added fs-prefix to config

Co-authored-by: Jan Krebs <jan.krebs@student.uni-tuebingen.de>
This commit is contained in:
lukas 2020-02-25 10:36:47 +01:00
parent 4ace15d5db
commit 4bae18890a
3 changed files with 11 additions and 10 deletions

View file

@ -42,21 +42,21 @@
implemented Markup protocol and specified root directory. It defaults to implemented Markup protocol and specified root directory. It defaults to
looking under the implemented protocol's subdirectory, but fallsback to look looking under the implemented protocol's subdirectory, but fallsback to look
at the templates directory." at the templates directory."
[root mu ignored-files] [root mu fs-prefix ignored-files]
(let [assets (new-io/find-assets (str "templates/" (m/dir mu)) [root] (m/ext mu) ignored-files)] (let [assets (new-io/find-assets (str "templates/" (m/dir mu)) [root] fs-prefix (m/ext mu) ignored-files)]
(if (seq assets) (if (seq assets)
assets assets
(new-io/find-assets "templates" [root] (m/ext mu) ignored-files)))) (new-io/find-assets "templates" [root] fs-prefix (m/ext mu) ignored-files))))
(defn find-posts (defn find-posts
"Returns a list of markdown files representing posts under the post root." "Returns a list of markdown files representing posts under the post root."
[{:keys [post-root ignored-files]} mu] [{:keys [post-root fs-prefix ignored-files]} mu]
(find-entries post-root mu ignored-files)) (find-entries post-root mu fs-prefix ignored-files))
(defn find-pages (defn find-pages
"Returns a list of markdown files representing pages under the page root." "Returns a list of markdown files representing pages under the page root."
[{:keys [page-root ignored-files]} mu] [{:keys [page-root fs-prefix ignored-files]} mu]
(find-entries page-root mu ignored-files)) (find-entries page-root mu fs-prefix ignored-files))
(defn parse-post-date (defn parse-post-date
"Parses the post date from the post's file name and returns the corresponding java date object" "Parses the post date from the post's file name and returns the corresponding java date object"
@ -466,6 +466,7 @@
new-io/get-resource new-io/get-resource
slurp slurp
read-string read-string
(update-in [:fs-prefix] (fnil str ""))
(update-in [:blog-prefix] (fnil str "")) (update-in [:blog-prefix] (fnil str ""))
(update-in [:page-root] (fnil str "")) (update-in [:page-root] (fnil str ""))
(update-in [:post-root] (fnil str "")) (update-in [:post-root] (fnil str ""))

View file

@ -71,8 +71,8 @@
extension (ext) ignoring any files that match the given (ignored-files). extension (ext) ignoring any files that match the given (ignored-files).
First make sure that the root directory exists, if yes: process as normal; First make sure that the root directory exists, if yes: process as normal;
if no, return empty vector." if no, return empty vector."
[base-path paths ext ignored-files] [base-path paths fs-prefix ext ignored-files]
(let [assets (cp-io/get-resources "content" base-path paths) (let [assets (cp-io/get-resources fs-prefix base-path paths)
filter-file (fn [xs] (filter #(= (:resource-type %) :file) xs)) filter-file (fn [xs] (filter #(= (:resource-type %) :file) xs))
filter-ext (fn [xs] (filter #(= (get-file-extension-from-resource %) ext) xs)) filter-ext (fn [xs] (filter #(= (get-file-extension-from-resource %) ext) xs))
cast-file (fn [java-path] (io/as-file (.toString java-path))) cast-file (fn [java-path] (io/as-file (.toString java-path)))

View file

@ -19,7 +19,7 @@
{:tag :urlset {:tag :urlset
:attrs {:xmlns "http://www.sitemaps.org/schemas/sitemap/0.9"} :attrs {:xmlns "http://www.sitemaps.org/schemas/sitemap/0.9"}
:content :content
(for [^java.io.File f (new-io/find-assets "" ["public"] ".html" ignored-files)] (for [^java.io.File f (new-io/find-assets "" ["public"] "" ".html" ignored-files)]
{:tag :url {:tag :url
:content :content
[{:tag :loc [{:tag :loc