feat: epigraphs
All checks were successful
build / build (push) Successful in 5s

해결 #11
This commit was merged in pull request #31.
This commit is contained in:
2026-03-28 22:24:10 -06:00
parent cf242b778d
commit 7634303b13

View File

@@ -12,7 +12,8 @@
[net.deertopia.doerg.tex :as tex]
[net.deertopia.doerg.tex.temml :as tex-temml]
[clojure.zip :as z]
[babashka.fs :as fs]))
[babashka.fs :as fs]
[clojure.edn :as edn]))
;;; Top-level API
@@ -102,6 +103,13 @@
(sp/view #(update % :children seq))
sp/STAY))
(defn doerg-attrs [e]
(->> e :affiliated :attr_doerg (str/join " ")
(format "{%s}") edn/read-string))
(defn wrap-if [x c f]
(if c (f x) x))
(defn- contains-footnote-refs? [node]
(some #(element/of-type? % "footnote-reference")
(:children node)))
@@ -335,8 +343,22 @@
(defmethod org-element "src-block" [{:keys [value]}]
[:pre [:code value]])
(defmethod org-element "quote-block" [{:keys [children]}]
[:blockquote children])
(defn- split-quote-block-children [children]
(match (split-with #(not= % [:hr]) children)
[x ([[:hr] & ys] :seq)] [x (strip-paragraphs ys)]
x x))
(defmethod org-element "quote-block" [{:keys [children] :as e}]
(let [{:keys [epigraph?]} (doerg-attrs e)
[content footer] (split-quote-block-children children)]
(-> [:blockquote
content
(when footer
[:footer footer])]
(wrap-if epigraph? (fn [c] [:div.epigraph c])))))
(defmethod org-element "horizontal-rule" [_]
[:hr])
(defmethod org-element "comment" [_] nil)