mirror of
https://github.com/journeyman-cc/smeagol.git
synced 2026-04-12 18:05:06 +00:00
Re-separated apply-formatter. Still doesn't work.
(but doesn't blow up)
This commit is contained in:
parent
151987e598
commit
0f0f2ecc48
1 changed files with 7 additions and 24 deletions
|
|
@ -115,15 +115,12 @@
|
||||||
corresponding inclusion should be inserted."
|
corresponding inclusion should be inserted."
|
||||||
[index result fragments processed fragment token formatter]
|
[index result fragments processed fragment token formatter]
|
||||||
(let
|
(let
|
||||||
[ident (keyword (str "inclusion-" index))]
|
[kw (keyword (str "inclusion-" index))]
|
||||||
(process-text
|
(process-text
|
||||||
(inc index)
|
(inc index)
|
||||||
(deep-merge
|
(assoc-in result [:inclusions kw] (apply formatter (list (subs fragment (count token)) index)))
|
||||||
result
|
(rest fragments)
|
||||||
{:inclusions {ident (apply formatter (list (subs fragment (count token)) index))}
|
(cons kw processed))))
|
||||||
:extensions (cons (keyword token) (:extensions result))})
|
|
||||||
fragments
|
|
||||||
(cons ident processed))))
|
|
||||||
|
|
||||||
;; (apply-formatter
|
;; (apply-formatter
|
||||||
;; 3
|
;; 3
|
||||||
|
|
@ -177,23 +174,9 @@
|
||||||
(cs/join "\n\n" (reverse processed))
|
(cs/join "\n\n" (reverse processed))
|
||||||
:heading-anchors true)))
|
:heading-anchors true)))
|
||||||
formatter
|
formatter
|
||||||
;; We've found a formatter to apply to the current fragment, and recurse
|
(apply-formatter index result fragments processed fragment first-token formatter)
|
||||||
;; on down the list
|
true
|
||||||
(let
|
(process-markdown-fragment index result remarked (rest fragments) processed)))))
|
||||||
[ident (keyword (str "inclusion-" index))]
|
|
||||||
(deep-merge
|
|
||||||
(process-text
|
|
||||||
(inc index)
|
|
||||||
result
|
|
||||||
(rest fragments)
|
|
||||||
(cons ident processed))
|
|
||||||
{:inclusions {ident (apply formatter (list (subs fragment (count first-token)) index))}
|
|
||||||
:extensions (assoc (or (:extensions result) {}) kw (-> config :formatters kw))}))
|
|
||||||
:else
|
|
||||||
;; Otherwise process the current fragment as markdown and recurse on
|
|
||||||
;; down the list
|
|
||||||
(process-markdown-fragment
|
|
||||||
index result remarked (rest fragments) processed)))))
|
|
||||||
|
|
||||||
;; (process-text
|
;; (process-text
|
||||||
;; "pswp
|
;; "pswp
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue