mirror of
https://github.com/urbit/shrub.git
synced 2024-12-03 05:43:18 +03:00
tweak md html reparsing: closes #290
This commit is contained in:
parent
e108f44b86
commit
5cb7c8d67a
@ -67,16 +67,20 @@
|
||||
=> [ele=i.lum .(lum t.lum)]
|
||||
?. ?=(%html -.ele)
|
||||
(push (reso ele) ~)
|
||||
:: begin reparsing of html that the spec jankily lets through ::
|
||||
=+ tex=(trip (role p.ele))
|
||||
=^ mar tex [p q.q]:(need q:(many:poxa 1^1 tex))
|
||||
=^ mar lum (chomp tex (sear |=(a=marl ?~(a ~ (some a))) many:poxa))
|
||||
?^ mar
|
||||
(push mar)
|
||||
(push u.mar)
|
||||
=^ hed lum (chomp tex head:poxa)
|
||||
?^ hed
|
||||
=+ max=`marx`u.hed
|
||||
(push(lum q) [max p] ~):[apex(had `n.max) .]
|
||||
=^ tal lum (chomp tex tail:poxa)
|
||||
?~ tal
|
||||
=^ cha lum (chomp tex prn)
|
||||
?^ cha
|
||||
(push :/([u.cha]~) ~)
|
||||
(push ;lost:"{tex}" ~)
|
||||
?: =(had tal)
|
||||
[~ lum]
|
||||
@ -84,6 +88,7 @@
|
||||
=. lum [ele lum]
|
||||
(lose "unclosed {<u.had>}")
|
||||
(lose "close {<u.tal>}")
|
||||
:: end reparsing of html that the spec jankily lets through ::
|
||||
::
|
||||
++ lose |=(a=tape [[;lost:"{a}"]~ lum])
|
||||
++ chomp
|
||||
@ -92,7 +97,7 @@
|
||||
=+ vex=(fel 1^1 tap)
|
||||
?~ q.vex [~ lum]
|
||||
:- [~ (wonk vex)]
|
||||
?~(q.q.u.q.vex lum [[%html (crip q.q.u.q.vex) ~] lum])
|
||||
?~(q.q.u.q.vex lum [[%html (lore (crip q.q.u.q.vex))] lum])
|
||||
::
|
||||
++ push
|
||||
|= a=marl
|
||||
|
Loading…
Reference in New Issue
Block a user