Skip to content

Commit

Permalink
using md rather than qmd extension (since now we do not have any exec…
Browse files Browse the repository at this point in the history
…utable chunks)
  • Loading branch information
daslu committed Oct 13, 2023
1 parent a452f80 commit c1b932a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/scicloj/clay/v2/server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,18 @@
(kindly/consider :kind/hidden))))

(defn write-quarto! [items]
(let [qmd-path
(let [md-path

(ns->target-path "docs/" *ns* "_quarto.qmd")
html-path (-> qmd-path
(string/replace #"\.qmd$" ".html"))]
(ns->target-path "docs/" *ns* "_quarto.md")
html-path (-> md-path
(string/replace #"\.md$" ".html"))]

(io/make-parents qmd-path)
(io/make-parents md-path)
;; (-> @*state
;; (page/qmd items)
;; (->> (spit qmd-path)))
(println [:wrote qmd-path (now)])
(->> (sh/sh "quarto" "render" qmd-path)
;; (->> (spit md-path)))
(println [:wrote md-path (now)])
(->> (sh/sh "quarto" "render" md-path)
((juxt :err :out))
(mapv println))
(println [:created html-path (now)])
Expand All @@ -251,7 +251,7 @@ format:
book:
title: \"book\"
chapters:
- index.qmd
- index.md
")

(def base-quarto-index
Expand All @@ -265,7 +265,7 @@ embed-resources: true
")

(defn update-quarto-config! [chapter-path]
(let [index-path "book/index.qmd"
(let [index-path "book/index.md"
config-path "book/_quarto.yml"
current-config (if (-> config-path io/file .exists)
(slurp config-path)
Expand Down Expand Up @@ -294,15 +294,15 @@ embed-resources: true
(string/split #"\.")
last
(= "index"))
(ns->target-path "" *ns* ".qmd")
(ns->target-path "" *ns* "/index.qmd"))
qmd-path (str "book/" chapter-path)]
(io/make-parents qmd-path)
(ns->target-path "" *ns* ".md")
(ns->target-path "" *ns* "/index.md"))
md-path (str "book/" chapter-path)]
(io/make-parents md-path)
(-> @*state
(page/light-qmd items)
(->> (spit qmd-path)))
(->> (spit md-path)))
(update-quarto-config! chapter-path)
(println [:wrote qmd-path (now)])))
(println [:wrote md-path (now)])))

(defn show-message! [hiccup]
(set-items! [hiccup])
Expand Down

0 comments on commit c1b932a

Please sign in to comment.