2014-12-09 02:44:20 +03:00
|
|
|
:: ++down rendering arms
|
2016-02-12 02:29:52 +03:00
|
|
|
::
|
2016-02-05 06:05:37 +03:00
|
|
|
:::: /hoon/rend/down-jet/lib
|
2014-12-09 02:44:20 +03:00
|
|
|
::
|
2016-02-18 02:36:43 +03:00
|
|
|
/? 310
|
2016-11-17 04:42:58 +03:00
|
|
|
::
|
2014-12-09 02:44:20 +03:00
|
|
|
|%
|
|
|
|
++ into-inner
|
2016-01-26 03:52:58 +03:00
|
|
|
|= {a/marl b/manx}
|
2014-12-09 02:44:20 +03:00
|
|
|
?~ c.b b(c a)
|
|
|
|
$(b i.c.b)
|
|
|
|
::
|
|
|
|
++ flat
|
2016-01-26 03:52:58 +03:00
|
|
|
|= a/marl
|
2014-12-09 02:44:20 +03:00
|
|
|
^- tape
|
|
|
|
?~ a ~
|
2016-01-31 06:37:03 +03:00
|
|
|
%+ weld
|
|
|
|
^- tape
|
|
|
|
?~ n.g.i.a
|
|
|
|
?>(?=(_;/(**) i.a) v.i.a.g.i.a)
|
|
|
|
?+ n.g.i.a $(a c.i.a)
|
|
|
|
$img
|
|
|
|
%- zing ^- wall
|
|
|
|
%+ murn a.g.i.a |= {a/mane b/tape}
|
|
|
|
^- (unit tape)
|
|
|
|
?+ a ~
|
|
|
|
$alt [~ b]
|
|
|
|
==
|
2014-12-09 02:44:20 +03:00
|
|
|
==
|
2016-01-31 06:37:03 +03:00
|
|
|
$(a t.a)
|
|
|
|
::
|
2015-08-12 00:31:16 +03:00
|
|
|
++ sanitize
|
2016-01-26 03:52:58 +03:00
|
|
|
|= a/marl ^- tape
|
2015-08-12 00:31:16 +03:00
|
|
|
=- (zing `wall`(scan (flat a) fel))
|
|
|
|
=< fel=;~(sfix (star ;~(plug (cold '-' -) (plus +))) (star next))
|
2016-01-26 03:52:58 +03:00
|
|
|
[(star ;~(less aln prn)) ;~(pose nud low (cook |=(a/@ (add a ' ')) hig))]
|
2014-12-09 02:44:20 +03:00
|
|
|
::
|
|
|
|
++ sang :: tight item children
|
2016-01-26 03:52:58 +03:00
|
|
|
|= a/(list elem)
|
2014-12-09 02:44:20 +03:00
|
|
|
^- marl
|
|
|
|
?~ a ~
|
2016-01-31 06:37:03 +03:00
|
|
|
%+ weld
|
|
|
|
?. ?=($para -.i.a)
|
|
|
|
(sing i.a ~)
|
|
|
|
(sung p.i.a)
|
|
|
|
$(a t.a)
|
2014-12-09 02:44:20 +03:00
|
|
|
::
|
|
|
|
++ sing :: elem to manx
|
2016-12-03 02:09:58 +03:00
|
|
|
=, html
|
2014-12-09 02:44:20 +03:00
|
|
|
=> |%
|
|
|
|
++ first-word
|
2016-01-26 03:52:58 +03:00
|
|
|
|= a/tape
|
2014-12-09 02:44:20 +03:00
|
|
|
=. a (trip (crip a)) :: XX valid tapes
|
|
|
|
^- (unit tape)
|
|
|
|
=. a q.q:(need q:((star ace) [1 1] a))
|
|
|
|
=+ vex=((plus ;~(less ace prn)) [1 1] a)
|
|
|
|
?~ q.vex ~
|
|
|
|
(some (wonk vex))
|
|
|
|
--
|
|
|
|
=+ [tig=| had=*(unit mane)]
|
2016-01-26 03:52:58 +03:00
|
|
|
|= lum/(list elem)
|
2014-12-09 02:44:20 +03:00
|
|
|
|^ ^- marl
|
|
|
|
=+ a=apex
|
|
|
|
?~ q.a
|
|
|
|
p.a
|
|
|
|
(weld p.a $(lum q.a))
|
|
|
|
::
|
|
|
|
++ apex
|
2016-01-26 03:52:58 +03:00
|
|
|
^- {p/marl q/_lum}
|
2014-12-09 02:44:20 +03:00
|
|
|
?~ lum
|
|
|
|
?~ had [~ ~]
|
|
|
|
(lose "unclosed {<u.had>}")
|
|
|
|
=> [ele=i.lum .(lum t.lum)]
|
2016-01-26 03:52:58 +03:00
|
|
|
?. ?=($html -.ele)
|
2014-12-09 02:44:20 +03:00
|
|
|
(push (reso ele) ~)
|
2015-11-10 01:32:49 +03:00
|
|
|
:: begin reparsing of html that the spec jankily lets through ::
|
2016-12-03 01:14:39 +03:00
|
|
|
=+ tex=(trip (of-wain p.ele))
|
2016-12-03 03:11:54 +03:00
|
|
|
=^ mar lum (chomp tex (sear |=(a/marl ?~(a ~ (some a))) many:de-xml))
|
2014-12-09 02:44:20 +03:00
|
|
|
?^ mar
|
2015-11-10 01:32:49 +03:00
|
|
|
(push u.mar)
|
2016-12-03 03:11:54 +03:00
|
|
|
=^ hed lum (chomp tex head:de-xml)
|
2014-12-09 02:44:20 +03:00
|
|
|
?^ hed
|
|
|
|
=+ max=`marx`u.hed
|
|
|
|
(push(lum q) [max p] ~):[apex(had `n.max) .]
|
2016-12-03 03:11:54 +03:00
|
|
|
=^ tal lum (chomp tex tail:de-xml)
|
2014-12-09 02:44:20 +03:00
|
|
|
?~ tal
|
2015-11-10 01:32:49 +03:00
|
|
|
=^ cha lum (chomp tex prn)
|
|
|
|
?^ cha
|
2016-01-31 06:37:03 +03:00
|
|
|
(push ;/([u.cha]~) ~)
|
2014-12-09 02:44:20 +03:00
|
|
|
(push ;lost:"{tex}" ~)
|
|
|
|
?: =(had tal)
|
|
|
|
[~ lum]
|
|
|
|
?^ had
|
|
|
|
=. lum [ele lum]
|
|
|
|
(lose "unclosed {<u.had>}")
|
|
|
|
(lose "close {<u.tal>}")
|
2015-11-10 01:32:49 +03:00
|
|
|
:: end reparsing of html that the spec jankily lets through ::
|
2014-12-09 02:44:20 +03:00
|
|
|
::
|
2016-01-26 03:52:58 +03:00
|
|
|
++ lose |=(a/tape [[;lost:"{a}"]~ lum])
|
2014-12-09 02:44:20 +03:00
|
|
|
++ chomp
|
2016-01-26 03:52:58 +03:00
|
|
|
|* {tap/tape fel/rule}
|
|
|
|
^- {(unit _(wonk *fel)) _lum}
|
2014-12-09 02:44:20 +03:00
|
|
|
=+ vex=(fel 1^1 tap)
|
|
|
|
?~ q.vex [~ lum]
|
|
|
|
:- [~ (wonk vex)]
|
2016-12-03 01:14:39 +03:00
|
|
|
?~(q.q.u.q.vex lum [[%html (to-wain (crip q.q.u.q.vex))] lum])
|
2014-12-09 02:44:20 +03:00
|
|
|
::
|
|
|
|
++ push
|
2016-01-26 03:52:58 +03:00
|
|
|
|= a/marl
|
2014-12-09 02:44:20 +03:00
|
|
|
^+ apex
|
|
|
|
?~ a apex
|
|
|
|
[[b p] q]:[b=i.a (push t.a)]
|
|
|
|
::
|
|
|
|
++ reso
|
2016-01-26 03:52:58 +03:00
|
|
|
|= a/elem
|
2014-12-09 02:44:20 +03:00
|
|
|
?^ -.a
|
2016-01-26 03:52:58 +03:00
|
|
|
=. tig ?.(?=($list -.p.a) tig p.p.a)
|
|
|
|
?: &(tig ?=($item -.p.a))
|
2014-12-09 02:44:20 +03:00
|
|
|
[/li (sang q.a)]
|
|
|
|
%+ into-inner ^$(lum q.a)
|
|
|
|
?- -.p.a
|
2016-01-26 03:52:58 +03:00
|
|
|
$bloq ;blockquote;
|
|
|
|
$item ;li;
|
|
|
|
$list ?@ q.p.a ;ul;
|
2014-12-09 02:44:20 +03:00
|
|
|
?: =(1 p.q.p.a) ;ol;
|
2016-12-03 02:47:16 +03:00
|
|
|
=+ num=(en-json (numb:enjs p.q.p.a))
|
2014-12-09 02:44:20 +03:00
|
|
|
;ol(start num);
|
|
|
|
==
|
2016-01-31 06:37:03 +03:00
|
|
|
?- -.a :: ;/("unimplemented {<p.a>}")
|
2016-01-26 03:52:58 +03:00
|
|
|
$html !! :: handled earlier XX do type stuff
|
|
|
|
$para [/p (sung p.a)]
|
|
|
|
$head
|
2015-08-12 00:31:16 +03:00
|
|
|
=+ [hed=(add %h0 (lsh 3 1 p.a)) kid=(sung q.a)]
|
2016-01-26 03:52:58 +03:00
|
|
|
[[hed id+(sanitize kid) ~] kid]
|
2015-08-12 00:31:16 +03:00
|
|
|
::
|
2016-01-26 03:52:58 +03:00
|
|
|
$hrul ;hr;
|
2016-02-01 07:37:49 +03:00
|
|
|
$meta ?: =(~ p.a) ;/(~)
|
2016-02-01 09:16:26 +03:00
|
|
|
=+ jon=`json`o+(~(run by p.a) |=(cord s++<))
|
2016-12-03 02:09:58 +03:00
|
|
|
;meta(value "{(en-json jon)}", name "frontmatter", urb_front "");
|
2014-12-09 02:44:20 +03:00
|
|
|
:: %html
|
2016-12-03 01:14:39 +03:00
|
|
|
::=+ tex=(of-wain (turn p.a crip))
|
2016-12-03 03:11:54 +03:00
|
|
|
::=+ (de-xml tex)
|
2014-12-09 02:44:20 +03:00
|
|
|
::?^ - u.-
|
2016-12-03 03:11:54 +03:00
|
|
|
::=+ (rush tex (star ;~(pose gah comt:de-xml)))
|
2016-01-31 06:37:03 +03:00
|
|
|
::?^ - ;/(~)
|
2014-12-09 02:44:20 +03:00
|
|
|
::;lost: {<p.a>}
|
2016-12-03 01:14:39 +03:00
|
|
|
:: ;/([(of-wain (turn p.a crip))]~) :: XX haaaaaaack
|
2016-01-31 06:37:03 +03:00
|
|
|
$defn ;/(~)
|
2016-01-26 03:52:58 +03:00
|
|
|
$code =+ lan=?~(p.a ~ (first-word r.u.p.a))
|
2016-12-03 01:14:39 +03:00
|
|
|
=+ tex=(trip (of-wain q.a))
|
2014-12-09 02:44:20 +03:00
|
|
|
?~ lan ;pre:code:"{tex}"
|
|
|
|
;pre:code(class "language-{u.lan}"):"{tex}"
|
|
|
|
|
|
|
|
==
|
|
|
|
--
|
2016-01-26 03:52:58 +03:00
|
|
|
::
|
2014-12-09 02:44:20 +03:00
|
|
|
++ sung
|
2016-01-26 03:52:58 +03:00
|
|
|
|= lim/kids
|
2014-12-09 02:44:20 +03:00
|
|
|
=+ had=*(unit mane)
|
|
|
|
|^ ^- marl
|
|
|
|
=+ a=apex
|
|
|
|
?~ q.a
|
|
|
|
p.a
|
|
|
|
(weld p.a $(lim q.a))
|
|
|
|
::
|
|
|
|
++ apex
|
2016-01-26 03:52:58 +03:00
|
|
|
^- {p/marl q/_lim}
|
2014-12-09 02:44:20 +03:00
|
|
|
?~ lim
|
|
|
|
?~ had [~ ~]
|
|
|
|
(lose "unclosed {<u.had>}")
|
|
|
|
=> [ele=i.lim .(lim t.lim)]
|
2016-01-26 03:52:58 +03:00
|
|
|
?. ?=($htmt -.ele)
|
|
|
|
?: &(?=($$ -.ele) ?=({{$$ *} *} lim))
|
|
|
|
apex(p.i.lim (weld p.ele p.i.lim))
|
2014-12-09 02:44:20 +03:00
|
|
|
(push (reso ele) ~)
|
|
|
|
=+ tex=(trip p.ele)
|
2016-12-03 03:11:54 +03:00
|
|
|
=^ emo lim (chomp tex empt:de-xml)
|
2014-12-09 02:44:20 +03:00
|
|
|
?^ emo
|
|
|
|
=+ man=`manx`u.emo
|
|
|
|
(push man ~)
|
2016-12-03 03:11:54 +03:00
|
|
|
=^ hed lim (chomp tex head:de-xml)
|
2014-12-09 02:44:20 +03:00
|
|
|
?^ hed
|
|
|
|
=+ max=`marx`u.hed
|
|
|
|
(push(lim q) [max p] ~):[apex(had `n.max) .]
|
2016-12-03 03:11:54 +03:00
|
|
|
=^ tal lim (chomp tex tail:de-xml)
|
2014-12-09 02:44:20 +03:00
|
|
|
?~ tal
|
|
|
|
(push ;lost:"{tex}" ~)
|
|
|
|
?: =(had tal)
|
|
|
|
[~ lim]
|
|
|
|
?^ had
|
|
|
|
=. lim [ele lim]
|
|
|
|
(lose "unclosed {<u.had>}")
|
2015-08-13 03:26:22 +03:00
|
|
|
(lose "unopened {<u.tal>}")
|
2014-12-09 02:44:20 +03:00
|
|
|
::
|
2016-01-26 03:52:58 +03:00
|
|
|
++ lose |=(a/tape [[;lost:"{a}"]~ lim])
|
2014-12-09 02:44:20 +03:00
|
|
|
++ chomp
|
2016-01-26 03:52:58 +03:00
|
|
|
|* {tap/tape fel/rule}
|
|
|
|
^- {(unit _(wonk *fel)) _lim}
|
2014-12-09 02:44:20 +03:00
|
|
|
=+ vex=(fel 1^1 tap)
|
|
|
|
?~ q.vex [~ lim]
|
|
|
|
:- [~ (wonk vex)]
|
|
|
|
?~(q.q.u.q.vex lim [[%htmt (crip q.q.u.q.vex)] lim])
|
|
|
|
::
|
|
|
|
++ push
|
2016-01-26 03:52:58 +03:00
|
|
|
|= a/marl
|
2014-12-09 02:44:20 +03:00
|
|
|
^+ apex
|
|
|
|
?~ a apex
|
|
|
|
[[b p] q]:[b=i.a (push t.a)]
|
|
|
|
::
|
|
|
|
++ urly
|
2016-01-26 03:52:58 +03:00
|
|
|
|= a/tape ^- tape
|
2014-12-09 02:44:20 +03:00
|
|
|
?~ a ~
|
|
|
|
?: ?| [?=(^ q)]:(alp 1^1 a)
|
2016-04-06 21:52:06 +03:00
|
|
|
(~(has in (silt "#!*'();:@&=+$,/?/%.~_")) i.a) :: XX reparse
|
2014-12-09 02:44:20 +03:00
|
|
|
==
|
|
|
|
[i.a $(a t.a)]
|
2016-12-03 04:11:44 +03:00
|
|
|
(weld (en-urlt:html (trip i.a)) $(a t.a))
|
2014-12-09 02:44:20 +03:00
|
|
|
::
|
|
|
|
++ reso
|
2016-01-26 03:52:58 +03:00
|
|
|
|= b/inline
|
2014-12-09 02:44:20 +03:00
|
|
|
^- manx
|
|
|
|
?@ -.b
|
|
|
|
?- -.b
|
2016-01-31 06:37:03 +03:00
|
|
|
$$ ;/(p.b)
|
2016-01-26 03:52:58 +03:00
|
|
|
$line ;br;
|
|
|
|
$code ;code:"{p.b}"
|
|
|
|
$htmt !! ::p.b :: handled earlier :: XX do type stuff
|
2014-12-09 02:44:20 +03:00
|
|
|
==
|
2016-01-26 03:52:58 +03:00
|
|
|
?: ?=($blot -.p.b)
|
2014-12-09 02:44:20 +03:00
|
|
|
=+ res=`manx`;img(src (urly p.p.b), alt (flat (turn q.b ..$)));
|
|
|
|
:: ;img@"{p.p.b}";
|
|
|
|
?~ q.p.b res
|
2016-01-26 03:52:58 +03:00
|
|
|
res(a.g (welp a.g.res title+u.q.p.b ~))
|
2015-08-13 03:26:22 +03:00
|
|
|
=+ kid=(sung q.b)
|
|
|
|
%+ into-inner kid
|
2014-12-09 02:44:20 +03:00
|
|
|
?- p.b
|
2016-01-26 03:52:58 +03:00
|
|
|
{$emph ?} ?.(p.p.b ;em; ;strong;)
|
|
|
|
{$delt $~} ;del;
|
|
|
|
{$link ^} =+ url=(urly p.p.b)
|
|
|
|
=. url ?^(url url "#{(sanitize kid)}")
|
|
|
|
?~ q.p.b ;a/"{url}";
|
|
|
|
;a/"{url}"(title u.q.p.b);
|
2014-12-09 02:44:20 +03:00
|
|
|
==
|
|
|
|
--
|
|
|
|
--
|