Moved entity parser to %zuse, cleanup

This commit is contained in:
Anton Dyudin 2014-12-08 14:51:27 -08:00
parent dfd63c7745
commit 3796d56de7
3 changed files with 38 additions and 19 deletions

View File

@ -680,7 +680,7 @@
::
++ poxa :: xml parser
=< |=(a=cord (rush a apex))
|%
|_ ent=_`(map term ,@t)`[[%apos '\''] ~ ~]
++ apex
=+ spa=;~(pose comt whit)
%+ knee *manx |. ~+
@ -706,7 +706,7 @@
::
++ chrd :: character data
%+ cook |=(a=tape ^-(mars :/(a)))
(plus ;~(less soq doq ;~(pose (just `@`10) escp)))
(plus ;~(less doq ;~(pose (just `@`10) escp)))
::
++ comt :: comments
=- (ifix [(jest '<!--') (jest '-->')] (star -))
@ -715,16 +715,20 @@
whit
;~(less (jest '-->') hep)
==
::
++ escp
::
++ escp ;~(pose ;~(less gal gar pam prn) enty)
++ enty :: entity
%+ ifix pam^sem
;~ pose
;~(less gal gar pam prn)
(cold '>' (jest '&gt;'))
(cold '<' (jest '&lt;'))
(cold '&' (jest '&amp;'))
(cold '"' (jest '&quot;'))
(cold '\'' (jest '&apos;'))
=+ def=`_ent`(mo [%gt '>'] [%lt '<'] [%amp '&'] [%quot '"'] ~)
%+ sear ~(get by (~(uni by def) ent))
(cook crip ;~(plug alf (stun 1^31 aln)))
%+ cook |=(a=@c ?:((gth a 0x10.ffff) '<27>' (tuft a)))
=< ;~(pfix hax ;~(pose - +))
:- (bass 10 (stun 1^8 dit))
(bass 16 ;~(pfix (mask "xX") (stun 1^8 hit)))
==
::
++ empt :: self-closing tag
%+ ifix [gal (jest '/>')]
;~(plug ;~(plug name attr) (cold ~ (star whit)))

View File

@ -34,7 +34,7 @@
==
++ psal :: convert to %psal
;div
;* (apex don)
;* (sing don)
==
--
!: |%
@ -164,7 +164,7 @@
=+ tex=(trip (role q.a))
?~ lan ;pre:code:"{tex}"
;pre:code(class "language-{u.lan}"):"{tex}"
==
--
::
@ -186,6 +186,10 @@
?. ?=(%htmt -.ele)
(push (reso ele) ~)
=+ tex=(trip p.ele)
=^ emo lim (chomp tex empt:poxa)
?^ emo
=+ man=`manx`u.emo
(push man ~)
=^ hed lim (chomp tex head:poxa)
?^ hed
=+ max=`marx`u.hed
@ -215,6 +219,16 @@
?~ a apex
[[b p] q]:[b=i.a (push t.a)]
::
++ urly
|= a=tape ^- tape
?~ a ~
:: ?: (gth i.a 0xff) "XX" :: XX
?: ?| [?=(^ q)]:(alp 1^1 a)
(~(has in (sa "!*'();:@&=+$,/?#%.~_")) i.a) :: XX reparse
==
[i.a $(a t.a)]
(weld (urle (trip i.a)) $(a t.a))
::
++ reso
|= b=inline
^- manx
@ -226,18 +240,19 @@
%htmt !! ::p.b :: handled earlier :: XX do type stuff
==
?: ?=(%blot -.p.b)
=+ res=`manx`;img(src p.p.b, alt (flat (turn q.b ..$)));
=+ res=`manx`;img(src (urly p.p.b), alt (flat (turn q.b ..$)));
:: ;img@"{p.p.b}";
?~ q.p.b res
res(a.g (welp a.g.res title/u.q.p.b ~))
?: ?=([[%emph ?] [[%emph ?] *] ~] b)
[/strong ^$(lim q.i.q.b)]
%+ into-inner ^$(lim q.b)
:: ?: ?=([[%emph %|] [[%emph %|] *] ~] b)
:: [/strong (sung q.i.q.b)]
%+ into-inner (sung q.b)
?- p.b
[%emph ?] ?.(p.p.b ;em; ;strong;)
[%delt ~] ;del;
[%link ^] ?~ q.p.b ;a/"{p.p.b}";
;a/"{p.p.b}"(title u.q.p.b);
[%link ^] =+ url=(urly p.p.b)
?~ q.p.b ;a/"{url}";
;a/"{url}"(title u.q.p.b);
==
--
--

View File

@ -24,7 +24,7 @@
[%list p=? q=$|(char [p=@u q=char])] :: tight, ordered?
[%item ~]
==
q=(list elem)
q=down
==
:: ++ mist |*(a=_,* ,[i=a t=$|(~ (mist a))]) :: .=(%mist +(%list))
++ node :: childless block