aboutsummaryrefslogtreecommitdiff
path: root/md.bqn
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-10-06 21:30:50 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-10-06 21:30:50 -0400
commit469606c1983236ca823e648fd664bd5f8dd391df (patch)
tree074b23ae563dee77096c46f2193ce55382f332de /md.bqn
parentde0f802cf481b71d3664cd8ed42ca1de9a07f846 (diff)
Allow loading a file with the name in the first line of an SVG comment
Diffstat (limited to 'md.bqn')
-rw-r--r--md.bqn9
1 files changed, 5 insertions, 4 deletions
diff --git a/md.bqn b/md.bqn
index d8b7e10c..3dc88c13 100644
--- a/md.bqn
+++ b/md.bqn
@@ -317,10 +317,11 @@ Markdown ← {filename𝕊𝕩:
# Lazy rule: if it starts with < and contains >, it's probably HTML
IsHtmlBlock ← ("<!--"≡4↑⊢)◶('>'∨´∘=⊢)‿2
useRepl←0 ⋄ GetRepl ← {𝕩⋄ useRepl↩1 ⋄ repl}
- ProcComment ← ⟨"<!--REPL-->"⟩⊸≢◶⟨
- GetRepl
- ("<!--SVG"≡⊑∘⊢)◶JoinLines‿(SvgExec∘JoinLines 1↓¯1↓⊢)
- ⟩
+ ProcComment ← ⟨"<!--REPL-->"⟩⊸≢◶GetRepl‿{
+ n←≠s←"<!--SVG" ⋄ l←¯3↓⍟(1=≠𝕩)⊑𝕩 ⋄ a←s≡n↑l
+ Source ← {((0<≠)◶<‿(•LNS •path∾path∾⊢) Trim n↓l) ∾ 1↓¯1↓𝕩}
+ SvgExec⍟a JoinLines Source⍟a 𝕩
+ }
ProcHtml ← {
codeMask ← "<code>" (6⥊0)⊸»⊸(>○(⌈`(1+↕∘≠)⊸×))○(⍷⟜𝕩 ∾ 0⥊˜1-˜≠) "</code>"
(1¨ <⊸∾ codeMask⊸GetMultiHighlights)⊸Modify 𝕩