margin notes
This commit is contained in:
@@ -219,7 +219,7 @@ img {
|
||||
}
|
||||
|
||||
.sidenote,
|
||||
.margin-note {
|
||||
.marginnote {
|
||||
float: right;
|
||||
clear: right;
|
||||
margin-right: -60%;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
(ns net.deertopia.doerg.render
|
||||
(:require [net.deertopia.doerg.element :as element]
|
||||
[clojure.stacktrace]
|
||||
[clojure.string :as str]
|
||||
[clojure.tools.logging :as l]
|
||||
[clojure.core.match :refer [match]]
|
||||
[clojure.tools.logging.readable :as lr]
|
||||
@@ -73,6 +74,9 @@
|
||||
(defmethod org-element "link" [e]
|
||||
(org-link e))
|
||||
|
||||
(defmethod org-element "special-block" [e]
|
||||
(org-special-block e))
|
||||
|
||||
|
||||
|
||||
(def view-children-as-seq
|
||||
@@ -163,6 +167,10 @@
|
||||
:dd (apply vector :dd dds)}
|
||||
_ nil))
|
||||
|
||||
(defn- same-tag? [x y]
|
||||
(let [x* (-> x name (str/replace #"^([^\.#]).*" "$1") keyword)]
|
||||
(= x* y)))
|
||||
|
||||
;; In HTML5, </p> tags cannot be nested for… reasons. In fact, no
|
||||
;; block-level elements are allowed within paragraphs. This stupid
|
||||
;; hack works around that restriction by stripping </p> tags }:).
|
||||
@@ -170,8 +178,10 @@
|
||||
(apply concat
|
||||
(for [x elements]
|
||||
(match x
|
||||
[:p (_ :guard map?) & xs] (seq xs)
|
||||
[:p & xs] (seq xs)
|
||||
[(_ :guard #(same-tag? % :p)) (_ :guard map?) & xs]
|
||||
(seq xs)
|
||||
[(_ :guard #(same-tag? % :p)) & xs]
|
||||
(seq xs)
|
||||
_ x))))
|
||||
|
||||
|
||||
@@ -301,11 +311,15 @@
|
||||
(defmethod org-keyword :default [x]
|
||||
(render-pprint x :text "unimplemented!"))
|
||||
|
||||
(defmethod org-special-block "margin-note" [{:keys [children]}]
|
||||
[:p [:span.marginnote (strip-paragraphs children)]])
|
||||
|
||||
#_
|
||||
(defmethod org-special-block :default [x]
|
||||
(render-pprint x :text "unimplemented!"))
|
||||
|
||||
(defmethod org-link :default [{:keys [raw-link children]}]
|
||||
[:span {:class "org-link external"}
|
||||
[:span.org-link.external
|
||||
[:a {:href raw-link}
|
||||
(or (seq children) raw-link)]])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user