해결 #11
This commit was merged in pull request #31.
This commit is contained in:
@@ -12,7 +12,8 @@
|
|||||||
[net.deertopia.doerg.tex :as tex]
|
[net.deertopia.doerg.tex :as tex]
|
||||||
[net.deertopia.doerg.tex.temml :as tex-temml]
|
[net.deertopia.doerg.tex.temml :as tex-temml]
|
||||||
[clojure.zip :as z]
|
[clojure.zip :as z]
|
||||||
[babashka.fs :as fs]))
|
[babashka.fs :as fs]
|
||||||
|
[clojure.edn :as edn]))
|
||||||
|
|
||||||
;;; Top-level API
|
;;; Top-level API
|
||||||
|
|
||||||
@@ -102,6 +103,13 @@
|
|||||||
(sp/view #(update % :children seq))
|
(sp/view #(update % :children seq))
|
||||||
sp/STAY))
|
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]
|
(defn- contains-footnote-refs? [node]
|
||||||
(some #(element/of-type? % "footnote-reference")
|
(some #(element/of-type? % "footnote-reference")
|
||||||
(:children node)))
|
(:children node)))
|
||||||
@@ -335,8 +343,22 @@
|
|||||||
(defmethod org-element "src-block" [{:keys [value]}]
|
(defmethod org-element "src-block" [{:keys [value]}]
|
||||||
[:pre [:code value]])
|
[:pre [:code value]])
|
||||||
|
|
||||||
(defmethod org-element "quote-block" [{:keys [children]}]
|
(defn- split-quote-block-children [children]
|
||||||
[:blockquote 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)
|
(defmethod org-element "comment" [_] nil)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user