From 5722fe448f47042dcdc8ffdd5240d62d3c0f6926 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Mon, 8 Dec 2014 19:16:00 -0800 Subject: [PATCH] Moved sanitization logic to ++normalize --- main/mar/down/door.hook | 2 +- main/mar/down/parse.hoon | 32 ++++++++++++++++++++++++++++---- main/mar/down/rend.hoon | 4 ++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/main/mar/down/door.hook b/main/mar/down/door.hook index 1ecb7a110b..adac3d94db 100644 --- a/main/mar/down/door.hook +++ b/main/mar/down/door.hook @@ -20,7 +20,7 @@ ++ mark ~/ %dawn |= p=@t - (rash p parse) + (normalize (rash p parse)) -- ++ noun down :: clam from %noun -- diff --git a/main/mar/down/parse.hoon b/main/mar/down/parse.hoon index 0ee44b8ced..716fbca061 100644 --- a/main/mar/down/parse.hoon +++ b/main/mar/down/parse.hoon @@ -127,7 +127,7 @@ == :: ++ sang :: tight item children - |= a=(list elem) + |= a=down ^- marl ?~ a ~ %- weld :_ $(a t.a) @@ -147,7 +147,7 @@ (some (wonk vex)) -- =+ [tig=| had=*(unit mane)] - |= lum=(list elem) + |= lum=down |^ ^- marl =+ a=apex ?~ q.a @@ -773,6 +773,30 @@ [%code `[-.a (add 3 (lent b)) c] ~] -- :: +++ normalize + |= a=down ^- down + %+ turn a |= b=elem + ?^ -.b b(q (turn q.b ..$)) + =- ?+(-.b b %para b(p (- p.b)), %head b(q (- q.b))) + |= c=kids ^- kids + ?~ c ~ + ?: ?& ?=(^ t.c) + ?=(%$ -.i.c) + ?=(%$ -.i.t.c) + == + $(c t.c(p.i (weld p.i.c p.i.t.c))) + :_ $(c t.c) + ?@ -.i.c i.c + =* d q.i.c + ?~ d + i.c + ?. ?& ?=([* ~] d) + ?=([%emph %|] -.i.c) + ?=([%emph %|] -.i.d) + == + i.c(q $(c d)) + [[%emph %&] $(c q.i.d)] +:: ++ test |=(a=cord =-([- (sing -)] (rash a parseb))) ++ parseb =>(parse .(bug &)) ++ parse @@ -781,7 +805,7 @@ =. q.tub %+ scan q.tub :: tab hackery :: XX per line (star ;~(pose prn tab nal)) - =| $: $: top=(list elem) :: finished toplevel elements + =| $: $: top=down :: finished toplevel elements [sap=@u nod=node] :: spacing, currrent leaf block cur=stack :: stack of nested current blocks == @@ -1139,7 +1163,7 @@ (snack ;~(pose hez ico leaf:donp)) ~? bug feat/[bun saf blos neu] =. cur - ?.(|(bun ?=([~ [%heas ^]] neu)) cur widen) + ?.(bun cur widen) ?~ neu =. tub +:(snack (star ace)) ?. ?=(%para -.nod) diff --git a/main/mar/down/rend.hoon b/main/mar/down/rend.hoon index 0566508b38..61f517b68c 100644 --- a/main/mar/down/rend.hoon +++ b/main/mar/down/rend.hoon @@ -148,6 +148,8 @@ (lose "unclosed {}") => [ele=i.lim .(lim t.lim)] ?. ?=(%htmt -.ele) +:: ?: &(?=(%$ -.ele) ?=([[%$ *] *] lim)) +:: apex(p.i.lim (weld p.ele p.i.lim)) (push (reso ele) ~) =+ tex=(trip p.ele) =^ emo lim (chomp tex empt:poxa) @@ -208,8 +210,6 @@ :: ;img@"{p.p.b}"; ?~ q.p.b res res(a.g (welp a.g.res title/u.q.p.b ~)) -:: ?: ?=([[%emph %|] [[%emph %|] *] ~] b) -:: [/strong (sung q.i.q.b)] %+ into-inner (sung q.b) ?- p.b [%emph ?] ?.(p.p.b ;em; ;strong;)