Fix various marks, etc.

This commit is contained in:
C. Guy Yarvin 2016-01-30 19:37:03 -08:00
parent fd7ab7b473
commit 761f588cc6
12 changed files with 317 additions and 106 deletions

View File

@ -105,7 +105,7 @@
house :: program state
== ::
++ he :: per session
|_ {moz/(list move) session} ::
|_ {moz/(list move) session} ::
++ dp :: dojo parser
|%
++ dp-default-app %hood

View File

@ -7908,12 +7908,7 @@
=+ fid=(find %both hyp)
?- -.fid
$| sut
$& =- ~? =([%tango ~] hyp)
~[%bad sut+sut fid+fid res+-]
~? =([%n %g %src ~] hyp)
~[%gud sut+sut fid+fid res+-]
-
=< q
$& =< q
%+ take p.p.fid
|=(a/span ?:(pol (fuse(sut a) ref) (crop(sut a) ref)))
==
@ -9177,7 +9172,7 @@
%+ reel p.gen
|= {a/twig b/_`(unit path)`[~ u=/]}
?~ b ~
?. ?=({$sand $tas @} a) ~
?. ?=({$sand ?($ta $tas) @} a) ~
`[q.a u.b]
::
++ pray

View File

@ -816,7 +816,6 @@
::
++ cu :: transform
|* {poq/$+(* *) wit/fist}
~! +<
|= jon/json
(bind (wit jon) poq)
::
@ -865,7 +864,6 @@
|* wer/(pole {cord fist})
|= jon/json
?. ?=({$o *} jon) ~
~! +<
=+ raw=((ot-raw wer) p.jon)
?.((za raw) ~ (some (zp raw)))
::
@ -896,7 +894,6 @@
::
++ pe :: prefix
|* {pre/* wit/fist}
~! +<
(cu |*(* [pre +<]) wit)
::
++ sa :: string as tape

View File

@ -1,18 +1,18 @@
::
:::: /hoon+down-jet+lib
:::: /hoon/down-jet/lib
::
/- markdown
::
::::
::
[markdown .]
// /%/parse :: inli donp parse
// /%/parse :: inli donp parse
// /%/rend :: sing sung sang flat into-inner
~% %down ..is ~
|%
++ mark
~/ %mark
|= p/@t
|= p/@t
(normalize (rash p parse))
::
++ print sing

View File

@ -12,17 +12,17 @@
~+
=- |= tub/nail ^- (like @t) %. tub :: export context
=+(poxa enty(ent mapping))
^- mapping/(map span @tF)
^- mapping/(map knot @tF)
=+ pax=/==5%%/html5-entities/json :: XX %%/
=+ maf=%.(pax ;~(biff file (soft json) (om so):jo))
?^ maf u.maf
~& no-enty+pax
(mo amp+'&' quot+'"' apos+'\'' lt+'<' gt+'>' ~) :: fallback
(my amp+'&' quot+'"' apos+'\'' lt+'<' gt+'>' ~) :: fallback
::
++ skem-symb (star ;~(pose dot alp))
++ skem-set ~+ ^- (set cord) :: URI schemes
:: (sa `wain`/http+https+javascript)
=- (sa `wain`(rash - (more gah (cook crip skem-symb))))
=- (silt `wain`(rash - (more gah (cook crip skem-symb))))
'''
coap doi javascript aaa aaas about acap cap cid crid data dav dict dns file
ftp geo go gopher h323 http https iax icap im imap info ipp iris iris.beep
@ -121,7 +121,6 @@
::
++ child
=< |= tub/nail ^- (like inline) %. tub :: expose parsers
%+ cook |=(a/inline ~?(bug a a))
;~(pose code line link blot:link htmt)
|%
++ fens
@ -149,22 +148,22 @@
::
++ madn
|= a/mane ^- ?
=> |=(b/span ?=(^ (rush b ;~(plug alf (star aln)))))
=> |=(b/knot ?=(^ (rush b ;~(plug alf (star aln)))))
?@ a (. a)
&((. -.a) (. +.a))
::
++ htmt
%+ stag %htmt
=- (cook crip (lite -)) :: XX
%- sear :_
;~(pose empt:poxa (pech [head tail]:poxa))
%- flit
|= a/$^({marx $~} $%({$& marx} {$| p/mane}))
?- -.a
^ (madn n.a)
$& (madn n.a)
$| (madn p.a)
==
=- (cook crip (lite -))
%+ sear
%- flit
|= a/$^({marx $~} $%({$& marx} {$| p/mane}))
?- -.a
^ (madn n.a)
$& (madn n.a)
$| (madn p.a)
==
;~(pose empt:poxa (pech [head tail]:poxa))
::
++ line
%+ cold [%line ~]
@ -183,7 +182,7 @@
=- pra=;~(pose auto (cook - apex))
|=({a/kids b/{tape (unit tape)}} [[%link b] a])
|%
++ apex
++ apex
=+ ^- rob/$+(nail (like {kids $@(cord {tape (unit tape)})}))
;~(plug text(nol &) labe)
::
@ -218,8 +217,9 @@
==
::
++ blot
%- cook :_ ;~(pfix zap [.(rob ;~(plug text labe))]:apex)
|=({a/kids b/{tape (unit tape)}} [[%blot b] a])
%+ cook
|=({a/kids b/{tape (unit tape)}} [[%blot b] a])
;~(pfix zap [.(rob ;~(plug text labe))]:apex)
::
++ mail
%+ cook |=(_[a="" b='' c="" d=*wall] :(welp a b^c (zing d)))
@ -233,18 +233,19 @@
++ auto
%+ ifix gal^gar
;~ pose
(cook |=(a/tape [link+["mailto:{a}" ~] ~[`a]]) mail)
(cook |=(a/tape [link+["mailto:{a}" ~] ~[[%$ a]]]) mail)
::
=+ cha=;~(pose htm-enty ;~(less (mask "<> ") prn))
%+ cook
|= a/_["" ""]
[link+[(weld a) ~] ~[`(weld a)]]
;~(plug uri-skem col (star cha))
[link+[(weld -.a +.a) ~] ~[[%$ (weld -.a +.a)]]]
;~(plug uri-skem col (star cha))
==
::
::
++ pexp :: XX non-link nested
%- cook :_ (ifix sel^ser many)
|=(a/kids (reso:many "[" (welp a `"]" ~)))
%+ cook
|=(a/kids (reso:many "[" (welp a [[%$ "]"] ~])))
(ifix sel^ser many)
--
--
::
@ -325,15 +326,16 @@
|= a/kids
^- tape
?~ a ~
%- weld :_ $(a t.a)
?@ -.i.a
?+ -.i.a <i.a>
$~ p.i.a
%+ weld
?@ -.i.a
?+ -.i.a <i.a>
$~ p.i.a
==
=+ [p q]=i.a
?+ -.p "[{(trip -.p)}]<{$(a q)}>"
$emph "({$(a q)})"
==
=+ [p q]=i.a
?+ -.p "[{(trip -.p)}]<{$(a q)}>"
$emph "({$(a q)})"
==
$(a t.a)
--
|= tap/tape ^- kids
=. tap (trim-sp tap)
@ -341,7 +343,7 @@
?~ q.vex
~
=+ [a ~ b]=u.q.vex
?~(b a (welp a [`b]~))
?~(b a (welp a [[%$ b]]~))
::
++ many
=> pars :: XX
@ -411,10 +413,10 @@
++ dlim
^- nuft
~? bug [&3 &2]
=+ clo=&(noz !=(~ ins) (ends t p ~)) :: can close delim
?: &(clo =(ins i)) :: correct close
=+ clo=&(noz !=(~ `*`ins) (ends t p ~)) :: can close delim
?: &(clo =(`*`ins i)) :: correct close
[`~ t]
?: &(bof !=(ins i)) :: outer close
?: &(bof !=(`*`ins i)) :: outer close
?> ?=(fens i) :: XX do type stuff
[`~ t i]
?~ t
@ -427,7 +429,7 @@
?~ b
(push (empa a))
~? > bug clot+[a i t]
?: =(i u.b)
?: =(i `*`u.b)
(push (empa a))
?~ ins :: outermost
[a(- [i -.a]) t] ::(veld i a t)
@ -491,7 +493,7 @@
%script %section %style %table %tbody %td %textarea %tfoot
%th %thead %tr %ul %video
==
++ htm-head =+ blu=(flit ~(has in (sa `wain`blok)))
++ htm-head =+ blu=(flit ~(has in (silt `wain`blok)))
=+ blo=(sear blu (cook cass (star aln)))
%+ stag %html
;~ plug gal
@ -543,14 +545,15 @@
?~ a fail
=- ;~(pose fel $(a +.a))
^= fel
%- cook :_ ;~ plug
(lots 3 (just -.a))
(star ;~(less tec prn))
(ahed eol)
==
|= {b/(list) c/tape $~}
^+ [?>(?=($code -) .)]:*node :: XX do type stuff
[%code `[-.a (add 3 (lent b)) c] ~]
%+ cook
|= {b/(list) c/tape $~}
^+ [?>(?=($code -) .)]:*node :: XX do type stuff
[%code `[-.a (add 3 (lent b)) c] ~]
;~ plug
(lots 3 (just -.a))
(star ;~(less tec prn))
(ahed eol)
==
--
::
++ normalize
@ -569,15 +572,14 @@
?.(?=($$ -.i.c) i.c [%$ (trip (crip p.i.c))]) :: XX valid tapes
:_ $(c t.c)
?@ -.i.c i.c
=* d q.i.c
?~ d
?~ q.i.c
i.c
?. ?& ?=({* $~} d)
?. ?& ?=({* $~} q.i.c)
?=({$emph $|} -.i.c)
?=({$emph $|} -.i.d)
?=({$emph $|} -.i.q.i.c)
==
i.c(q $(c d))
[[%emph %&] $(c q.i.d)]
i.c(q $(c q.i.c))
[[%emph %&] $(c q.i.q.i.c)]
::
++ parseb =>(parse .(bug &))
++ parse
@ -635,8 +637,8 @@
++ snake :: advance with trace
|* fel/rule
=- (snack (here - fel))
|*({{{@ a/@u} {@ b/@u}} c/*} [p=(sub b a) q=c])
::
|* {{{@ a/@u} {@ b/@u}} c/*}
[p=(sub +<->+ +<-<+) q=c]
::
++ pop :: resolve container
^+ self
@ -714,7 +716,7 @@
=^ ren tub (snack (leas href):inli)
?^ ren
?: (~(has by ref) -.u.ren) $
$(ref (~(put by ref) u.ren))
$(ref (~(put by ref) -.u.ren +.u.ren))
=. q.tub (strip (star gah) q.tub)
?~ q.tub self(nod [%defn ~], tub olt)
self(nod [%para [%$ q.tub]~], tub olt)
@ -774,7 +776,7 @@
?~ ruc self
?. ?=($bloq -.p.q.i.ruc)
$(ruc t.ruc)
(collapse (flop ruc))
(collapse (flop ^+(cur ruc)))
::
++ nil-li
?& ?=($defn -.nod)
@ -796,7 +798,7 @@
a(p.p.q.i |)
::
++ blos :: extract elem list
(flop (turn cur |*({@ a/tops} a)))
(flop (turn cur |*({@ tops} +<+)))
::
++ eat-line :: high-level line nom
^+ .
@ -809,7 +811,7 @@
?: ?=($html -.nod)
=+ sep=(sepa:eat)
?: bun.sep sep
span:eat.+
knot:eat.+
=> [ruc .]=olds:eat
?: &(?=($~ ruc) ?=({$code ^ *} nod))
code:eat
@ -824,7 +826,7 @@
(lazy:eat ruc)
news:eat
node:eat
span:eat
knot:eat
:: ~? bug seated+[nod blos] .
==
::
@ -885,9 +887,9 @@
?~ neu [ruc self]
=> .(q.u.neu ^+(p.q.i.ruc q.u.neu)) :: XX do type stuff
?. (list-nest p.q.i.ruc q.u.neu)
=. self (collapse (flop ruc))
=. self (collapse (flop ^+(cur ruc)))
[~ (push u.neu)]
=. self (collapse (flop t.ruc))
=. self (collapse (flop ^+(cur t.ruc)))
[~ (push p.u.neu [%item ~])]
::
$item
@ -973,9 +975,9 @@
=^ buf tub (snack ;~(sfix (star ace) nal))
?^ buf
self(q.nod [(crip u.buf) q.nod])
span
knot
::
++ span :: raw text
++ knot :: raw text
^+ self
?: =(~ q.tub) halt
=^ lin tub
@ -989,10 +991,10 @@
$code self
$html self(p.nod ['' p.nod])
==
?+ -.nod (pump para+~[`u.lin])
$para self(p.nod :_(p.nod `u.lin))
?+ -.nod (pump para+~[[%$ u.lin]])
$para self(p.nod :_(p.nod [%$ u.lin]))
$head ?^ q.nod $(self cull)
self(q.nod [`(dehax u.lin)]~)
self(q.nod [[%$ (dehax u.lin)]]~)
$code self(q.nod :_(q.nod (crip u.lin)))
$html self(p.nod :_(p.nod (crip u.lin)))
==

View File

@ -12,19 +12,21 @@
|= a/marl
^- tape
?~ a ~
%- weld :_ $(a t.a)
^- 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]
%+ 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]
==
==
==
$(a t.a)
::
++ sanitize
|= a/marl ^- tape
=- (zing `wall`(scan (flat a) fel))
@ -35,10 +37,11 @@
|= a/(list elem)
^- marl
?~ a ~
%- weld :_ $(a t.a)
?. ?=($para -.i.a)
(sing i.a ~)
(sung p.i.a)
%+ weld
?. ?=($para -.i.a)
(sing i.a ~)
(sung p.i.a)
$(a t.a)
::
++ sing :: elem to manx
=> |%
@ -80,7 +83,7 @@
?~ tal
=^ cha lum (chomp tex prn)
?^ cha
(push :/([u.cha]~) ~)
(push ;/([u.cha]~) ~)
(push ;lost:"{tex}" ~)
?: =(had tal)
[~ lum]
@ -120,7 +123,7 @@
=+ num=(pojo (jone p.q.p.a))
;ol(start num);
==
?- -.a :: :/("unimplemented {<p.a>}")
?- -.a :: ;/("unimplemented {<p.a>}")
$html !! :: handled earlier XX do type stuff
$para [/p (sung p.a)]
$head
@ -135,10 +138,10 @@
::=+ (poxa tex)
::?^ - u.-
::=+ (rush tex (star ;~(pose gah comt:poxa)))
::?^ - :/(~)
::?^ - ;/(~)
::;lost: {<p.a>}
:: :/([(role (turn p.a crip))]~) :: XX haaaaaaack
$defn :/(~)
:: ;/([(role (turn p.a crip))]~) :: XX haaaaaaack
$defn ;/(~)
$code =+ lan=?~(p.a ~ (first-word r.u.p.a))
=+ tex=(trip (role q.a))
?~ lan ;pre:code:"{tex}"
@ -203,9 +206,8 @@
++ urly
|= a/tape ^- tape
?~ a ~
:: ?: (gth i.a 0xff) "XX" :: XX
?: ?| [?=(^ q)]:(alp 1^1 a)
(~(has in (sa "!*'();:@&=+$,/?/%.~_")) i.a) :: XX reparse
(~(has in (silt "!*'();:@&=+$,/?/%.~_")) i.a) :: XX reparse
==
[i.a $(a t.a)]
(weld (urle (trip i.a)) $(a t.a))
@ -215,7 +217,7 @@
^- manx
?@ -.b
?- -.b
$$ :/(p.b)
$$ ;/(p.b)
$line ;br;
$code ;code:"{p.b}"
$htmt !! ::p.b :: handled earlier :: XX do type stuff

36
mar/down.hoon Normal file
View File

@ -0,0 +1,36 @@
::
:::: /hoon+down+mar
::
/? 314
/- markdown
/+ down-jet, frontmatter
::
::::
::
[markdown .]
|_ don/down
++ grab :: convert from
|%
++ noun down :: clam from %noun
++ md
|= src/@t
=+ [atr mud]=(parse:frontmatter (lore src))
[[%meta atr] (mark:down-jet mud)]
--
::
++ grow :: convert into
|%
++ hymn :: convert to %hymn
;html
;head:title:"Untitled"
;body
;* (print:down-jet don)
==
==
++ elem :: convert to %elem
;div
;* (print:down-jet don)
==
:: ++ react elem
--
--

31
mar/react-snip.hoon Normal file
View File

@ -0,0 +1,31 @@
::
:::: /hoon/core/react-snip/mar
::
/? 314
/+ react
!:
::::
::
[. react]
|_ {hed/marl tal/marl}
::
++ grow :: convert to
|%
++ mime [/application/json (tact tape)]
++ tape (pojo react-snips-json)
++ elem ;div:(h1:"*{hed}" div:"*{tal}")
++ react-snip-js (crip (react-to-tape elem))
++ react-snips-json
::?> ?=([[%div ~] [[%h1 ~] *] [[%div ~] *] ~]] own) :: xx mystery fish-loop
%^ jobe
head+react-head-json
body+react-snip-json
~
::
++ react-head-json (react-to-json ;h1:"*{hed}")
++ react-snip-json (react-to-json ;div:"*{tal}")
--
++ grab |% :: convert from
++ noun manx :: clam from %noun
++ snip |=(a/{marl marl} a)
-- --

23
mar/react.hoon Normal file
View File

@ -0,0 +1,23 @@
::
:::: /hoon/core/react/mar
::
/? 314
/+ react
!:
::::
::
[. react]
|_ own/manx
::
++ grow :: convert to
|%
++ tape (pojo react-json)
++ react-js (crip (react-to-tape own))
:: ++ js react-js :: convert to %js
++ react-json (react-to-json own)
++ mime [/application/json (tact tape)] :: convert to %mime
--
++ grab |% :: convert from
++ noun manx :: clam from %noun
++ elem |= a/manx a
-- --

125
mar/talk/command.hoon Normal file
View File

@ -0,0 +1,125 @@
::
:::: /hoon+talk-command+mar
::
/? 314
/- talk
!:
[talk .]
|_ cod/command
::
++ grab :: convert from
|%
++ noun command :: clam from %noun
++ json
=> [jo ..command]
|= a/json ^- command
=- (need ((of -) a))
=< :~ publish+(ar thot)
review+(ar thot)
design+(ot party+so config+(mu conf) ~)
==
|%
++ op :: parse keys of map
|* {fel/rule wit/fist}
%+ cu malt
%+ ci
|= a/(map cord _(need *wit))
^- (unit (list _[(wonk *fel) (need *wit)]))
(zl (turn (~(tap by a)) (head-rush fel)))
(om wit)
::
++ ke :: callbacks
|* {gar/* sef/_|.(fist)}
|= jon/json
^- (unit _gar)
=- ~! gar ~! (need -) -
((sef) jon)
::
++ as :: array as set
|* a/fist
(cu ~(gas in *(set _(need *a))) (ar a))
::
++ lake |*(a/_* $+(json (unit a)))
++ peach
|* a/{rule rule}
|= tub/nail
^- (like (each _(wonk (-.a)) _(wonk (+.a))))
%. tub
;~(pose (stag %& -.a) (stag %| +.a))
::
++ head-rush
|* a/rule
|* {cord *}
=+ nit=(rush +<- a)
?~ nit ~
(some [u.nit +>->])
::
::
++ thot
^- $+(json (unit thought))
%- ot :~
serial+ceri
audience+audi
statement+stam
==
::
++ ceri
^- $+(json (unit serial))
(ci (slat %uv) so)
::
++ audi
^- $+(json (unit audience))
(op parn memb)
::
++ auri (op parn (ci (soft presence) so))
++ memb (ot [envelope+lope delivery+(ci (soft delivery) so) ~])
++ lope (ot [visible+bo sender+(mu (su parn)) ~])
::
++ parn
^- $+(nail (like partner))
%+ peach
;~((glue fas) ;~(pfix sig fed:ag) urs:ab)
%+ sear (soft passport)
;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15}
::
++ speech-or-eval $?(speech {$eval p/@t} {$mor p/(list speech-or-eval)})
++ eval
|= a/(trel @da bouquet speech-or-eval)
^- statement
%= a r ^- speech
|-
?: ?=($mor -.r.a)
[%mor (turn p.r.a |=(b/speech-or-eval ^$(r.a b)))]
?. ?=($eval -.r.a) r.a
=- [%fat tank+- %exp p.r.a]
=+ pax=[&1:% &2:% (scot %da p.a) |3:%]
p:(mule |.([(sell (slap !>(..zuse) (rain pax p.r.a)))]~))
==
::
++ stam
^- $+(json (unit statement))
%+ cu eval
(ot date+di bouquet+(as (ar so)) speech+spec ~)
::
++ spec
%+ ke *speech-or-eval |.
%- of
:~ lin+(ot say+bo txt+so ~)
url+(su aurf:urlp)
eval+so
mor+(ar spec)
:: exp+(cu |=(a=cord [a ~]) so)
:: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~)
==
::
++ conf
^- $+(json (unit config))
%- ot :~
sources+(as (su parn))
caption+so
:- %cordon
(ot posture+(ci (soft posture) so) list+(as (su fed:ag)) ~)
==
--
-- --

View File

@ -1,7 +1,7 @@
$: pax=path ::
$= jof ::
$% [%line p=cord] ::
[%res p=span] ::
[%res p=knot] ::
[%cmd p=char] ::
[%type p=?] ::
== == ::

View File

@ -1,5 +1,5 @@
|%
++ twit-do => twit {p/span q/command} :: user and action
++ twit-do => twit {p/knot q/command} :: user and action
++ twit-stat {id/@u who/@ta now/@da txt/@t} :: received tweet
++ twit
|%