fix: custom queries

close #1769
pull/1803/head
Tienson Qin 2021-05-10 20:06:54 +08:00
parent 26f18a437b
commit f05bd7e4e0
2 changed files with 15 additions and 8 deletions

View File

@ -194,13 +194,18 @@
([type optional]
(let [format (get state/get-edit-block :block/format :markdown)
org? (= format :org)
left (if org?
t (string/lower-case type)
markdown-src? (and (= format :markdown) (= t "src"))
left (cond
markdown-src?
"```"
:else
(util/format "#+BEGIN_%s"
(string/upper-case type))
(str "```" (let [t (string/lower-case type)] (if (= t "src") "" t))))
right (if org?
(util/format "\n#+END_%s" (string/upper-case type))
(str "\n```"))
(string/upper-case type)))
right (if markdown-src?
(str "\n```")
(util/format "\n#+END_%s" (string/upper-case type)))
template (str
left
(if optional (str " " optional) "")

View File

@ -37,8 +37,10 @@
(defn group-by-page
[blocks]
(some->> blocks
(group-by :block/page)))
(if (:block/page (first blocks))
(some->> blocks
(group-by :block/page))
blocks))
(defn group-by-file
[blocks]