diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-11-11 15:06:26 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-11-11 15:06:26 -0500 |
| commit | f7f20bab63522e169e464f041f47db45e4a5cfb2 (patch) | |
| tree | 604152edd8f09c9d828bd34c28e83214eb7c2286 /svg.bqn | |
| parent | 740a873f9eeb02ae120aa9d6090076cfcce15a05 (diff) | |
Minor performance improvements in Enc
Diffstat (limited to 'svg.bqn')
| -rw-r--r-- | svg.bqn | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -6,16 +6,13 @@ Highlight ← { (1¨ <⊸∾ ·AddT⌾⊑GetHighlights)⊸Modify 𝕩 } -IsLines ← 1<≡ -DeNest ← {(3⌊≡)◶⟨!∘0,⥊<,⊢,∾𝕊¨⟩ ⥊𝕩} -Indent ← " "⊸∾¨ DeNest - # Create a node from a tag name and interior text. Enc ← { + DeNest ← {(3⌊≡)◶⟨!∘0,⥊<,⊢,∾𝕊¨⟩ ⥊𝕩} open ← ∾⟨"<",𝕨,">"⟩ - close← ∾⟨"</", (⊑𝕨⊐" ")↑𝕨, ">"⟩ - l ← IsLines 𝕩 - ∾ open (Indent⍟l 𝕩){𝕨‿𝕗‿𝕩}○(⥊∘<⍟l) close + close← ∾⟨"</", (∧`𝕨≠' ')/𝕨, ">"⟩ + l ← 1 < d←≡𝕩 + ∾ open ({" "⊸∾¨(∾DeNest¨)⍟(3≤d)⥊𝕩}⍟l 𝕩){𝕨‿𝕗‿𝕩}○(⥊∘<⍟l) close } Void ← {∾⟨"<",𝕩,"/>"⟩} |
