mirror of
https://github.com/urbit/shrub.git
synced 2025-01-05 19:46:50 +03:00
Merge remote-tracking branch 'origin/shell' into dish
Conflicts: urb/urbit.pill urb/zod/main/app/shell/core.hook
This commit is contained in:
commit
34bd31893d
@ -1023,7 +1023,7 @@
|
||||
%^ ~(ha go ton.fox)
|
||||
our
|
||||
`mace`[[0 rig] ~]
|
||||
`will`[[(sign:as:loy _@ (shaf %self (sham syp))) syp fak] ~]
|
||||
`will`[[(sign:as:loy *@ (shaf %self (sham syp))) syp fak] ~]
|
||||
fak.ton
|
||||
fak
|
||||
==
|
||||
@ -1036,7 +1036,7 @@
|
||||
?: &(!fak !fim) !! :: not fake & bad fig
|
||||
=+ mac=`mace`[[0 sec:ex:loy] ~]
|
||||
=+ syp=`step`[`bray`[0 ~ our now] [%en %czar ~] pub:ex:loy]
|
||||
=+ ded=`deed`[(sign:as:loy _@ (shaf %self (sham syp))) syp fak]
|
||||
=+ ded=`deed`[(sign:as:loy *@ (shaf %self (sham syp))) syp fak]
|
||||
=+ buq=`buck`[mac [ded ~]]
|
||||
=: ton.fox (~(ha go ton.fox) our buq)
|
||||
zac.fox (~(put by zac.fox) our *corn)
|
||||
|
@ -317,7 +317,7 @@
|
||||
?+ -.luv luv
|
||||
%mid
|
||||
?. =('<html' (end 3 5 q.q.luv)) luv
|
||||
=+ scr=(roll mog |=([a=manx b=tape] (xmlt & a b)))
|
||||
=+ scr=(many:poxo mog "")
|
||||
=+ ^= hed
|
||||
|- ;~ pose
|
||||
(cook trip (jest '<head>'))
|
||||
@ -335,7 +335,7 @@
|
||||
^- httr
|
||||
?- -.luv
|
||||
%mid [200 ~[content-type/(moon p.luv)] [~ q.luv]]
|
||||
%ham [200 ~[content-type/'text/html'] [~ (tact (xmlt | p.luv ~))]]
|
||||
%ham [200 ~[content-type/'text/html'] [~ (tact (poxo p.luv))]]
|
||||
%raw p.luv
|
||||
%wan :+ 200
|
||||
~[content-type/'text/plain']
|
||||
@ -346,7 +346,7 @@
|
||||
?~(p.luv ~ [i.p.luv 10 $(p.luv t.p.luv)])
|
||||
%zap :+ p.luv
|
||||
~[content-type/'text/html']
|
||||
[~ (tact (xmlt | (loga "server error" ~ q.luv) ~))]
|
||||
[~ (tact (poxo (loga "server error" ~ q.luv)))]
|
||||
==
|
||||
--
|
||||
|% :: functions
|
||||
@ -1996,7 +1996,7 @@
|
||||
^- httr
|
||||
:+ 500
|
||||
~[content-type/'text/html']
|
||||
[~ (tact (xmlt | mad ~))]
|
||||
[~ (tact (poxo mad))]
|
||||
& [%fin (lofa mog (lopo q.p.p.pez.pip))]
|
||||
==
|
||||
==
|
||||
@ -2122,7 +2122,7 @@
|
||||
++ hark
|
||||
|= num=@ud
|
||||
^- [(unit pimp) _+>]
|
||||
=. +>.$ abet:(busk:(yule %nil) num _@ ~ %& %js !>((duty nap you)))
|
||||
=. +>.$ abet:(busk:(yule %nil) num *@ ~ %& %js !>((duty nap you)))
|
||||
[`(need (~(get by q.rey) num)) +>.$]
|
||||
::
|
||||
++ harp
|
||||
|
@ -968,7 +968,7 @@
|
||||
::
|
||||
++ body :: produce functions
|
||||
|= [cof=cafe src=(list hoop)]
|
||||
^- (bolt _..body)
|
||||
^- (bolt ,_..body)
|
||||
?~ src (fine cof ..body)
|
||||
%+ cope (wilt cof i.src)
|
||||
|= [cof=cafe sel=_..body]
|
||||
@ -1149,7 +1149,7 @@
|
||||
::
|
||||
++ wilt :: process body entry
|
||||
|= [cof=cafe hop=hoop]
|
||||
^- (bolt _..wilt)
|
||||
^- (bolt ,_..wilt)
|
||||
?- -.hop
|
||||
%& (fine cof ..wilt(boy [p.hop boy]))
|
||||
%|
|
||||
@ -1164,7 +1164,7 @@
|
||||
(fine cof sel(boy [[%tssg boy.sel] boy]))
|
||||
=+ [all=(lark (slat %tas) arc) sel=..wilt]
|
||||
%+ cope
|
||||
|- ^- (bolt (pair (map term foot) _..wilt))
|
||||
|- ^- (bolt (pair (map term foot) ,_..wilt))
|
||||
?~ all (fine cof ~ ..wilt)
|
||||
%+ cope $(all l.all)
|
||||
|= [cof=cafe lef=(map term foot) sel=_..wilt]
|
||||
|
108
arvo/hoon.hoon
108
arvo/hoon.hoon
@ -182,7 +182,7 @@
|
||||
[1 p=term q=toga] :: deep toga
|
||||
[2 p=toga q=toga] :: cell toga
|
||||
== ::
|
||||
++ trap ,_|.(_*) :: makes perfect sense
|
||||
++ trap ,_|.(**) :: makes perfect sense
|
||||
++ trel |* [a=$+(* *) b=$+(* *) c=$+(* *)] :: just a triple
|
||||
,[p=a q=b r=c] ::
|
||||
++ tuna :: tagflow
|
||||
@ -197,10 +197,9 @@
|
||||
$% ::
|
||||
[%$ p=axis] :: simple leg
|
||||
:: :::::: tiling
|
||||
[%bccb p=tile] :: bunt a tile
|
||||
[%bccm p=tile] :: clam a tile
|
||||
[%bcpt p=wing q=tile] :: whip p into q
|
||||
[%bctr p=tile] :: static bunt w/ ^~
|
||||
[%bctr p=tile] :: bunt a tile w/ ^~
|
||||
[%bczp p=base] :: bunt an axil
|
||||
:: :::::: cores
|
||||
[%brcb p=tile q=(map term foot)] :: %gold tray, sample p
|
||||
@ -309,6 +308,7 @@
|
||||
[%wtsg p=wing q=twig r=twig] :: if p is null
|
||||
[%wtsz p=tiki q=twig r=twig] :: tiki %wtsg
|
||||
[%wtts p=tile q=wing] :: if q is in tile p
|
||||
[%wttz p=tile q=tiki] :: tiki %wtts
|
||||
[%wtzp p=twig] :: logical NOT
|
||||
:: :::::: special
|
||||
[%zpcb p=spot q=twig] :: debug info in trace
|
||||
@ -659,14 +659,14 @@
|
||||
++ homo :: homogenize
|
||||
|* a=(list)
|
||||
^+ =< $
|
||||
|% +- $ ?:(_? ~ [i=(snag 0 a) t=$])
|
||||
|% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
|
||||
--
|
||||
a
|
||||
::
|
||||
++ limo :: listify
|
||||
|* a=*
|
||||
^+ =< $
|
||||
|% +- $ ?~(a ~ ?:(_? [i=-.a t=$] $(a +.a)))
|
||||
|% +- $ ?~(a ~ ?:(*? [i=-.a t=$] $(a +.a)))
|
||||
--
|
||||
a
|
||||
::
|
||||
@ -1705,7 +1705,7 @@
|
||||
++ yall :: day # to day of year
|
||||
|= day=@ud
|
||||
^- [y=@ud m=@ud d=@ud]
|
||||
=+ [era=0 cet=0 lep=_?]
|
||||
=+ [era=0 cet=0 lep=*?]
|
||||
=> .(era (div day era:yo), day (mod day era:yo))
|
||||
=> ^+ .
|
||||
?: (lth day +(cet:yo))
|
||||
@ -1771,12 +1771,12 @@
|
||||
:: section 2cI, almost macros ::
|
||||
::
|
||||
++ cury
|
||||
|* [a=_|=(^ _*) b=*]
|
||||
|* [a=_|=(^ **) b=*]
|
||||
|* c=_+<+.a
|
||||
(a b c)
|
||||
::
|
||||
++ curr
|
||||
|* [a=_|=(^ _*) c=*]
|
||||
|* [a=_|=(^ **) c=*]
|
||||
|* b=_+<+.a
|
||||
(a b c)
|
||||
::
|
||||
@ -3933,7 +3933,7 @@
|
||||
::
|
||||
++ cont
|
||||
|= [a=(map ,@u tape) b=(map ,@u tape)]
|
||||
(~(gas by _(map ,@u tape)) (weld (~(tap by a)) (~(tap by b))))
|
||||
(~(gas by *(map ,@u tape)) (weld (~(tap by a)) (~(tap by b))))
|
||||
::
|
||||
++ abor
|
||||
|= [a=char b=(unit ,[tape (map ,@u tape)])]
|
||||
@ -3959,13 +3959,13 @@
|
||||
?~ bar
|
||||
bar
|
||||
b
|
||||
++ blak (some ["" _(map ,@u tape)])
|
||||
++ blak (some ["" *(map ,@u tape)])
|
||||
++ word |=(a=char =((dis wordc:rags (bex a)) 0))
|
||||
++ deep
|
||||
|= [b=tape c=rege d=tape]
|
||||
^- (unit ,[tape (map ,@u tape)])
|
||||
?- a
|
||||
%dote ?~(b ~ (some [[i.b ~] _(map ,@u tape)]))
|
||||
%dote ?~(b ~ (some [[i.b ~] *(map ,@u tape)]))
|
||||
%ende ?~(b blak ~)
|
||||
%sart ?:(=(b d) blak ~)
|
||||
%empt blak
|
||||
@ -3991,11 +3991,11 @@
|
||||
?~ bar
|
||||
bar
|
||||
[~ [-.ft (~(put by +.ft) q.a -.ft)]]
|
||||
[%lite *] ?~(b ~ ?:(=(i.b p.a) (some [[i.b ~] _(map ,@u tape)]) ~))
|
||||
[%lite *] ?~(b ~ ?:(=(i.b p.a) (some [[i.b ~] *(map ,@u tape)]) ~))
|
||||
[%brac *] ?~ b
|
||||
~
|
||||
?. =((dis (bex `@`i.b) p.a) 0)
|
||||
(some [[i.b ~] _(map ,@u tape)])
|
||||
(some [[i.b ~] *(map ,@u tape)])
|
||||
~
|
||||
[%eith *] =+ foo=(chet(a c) $(a p.a) b d)
|
||||
=+ bar=(chet(a c) $(a q.a) b d)
|
||||
@ -4364,7 +4364,7 @@
|
||||
::
|
||||
++ mule :: typed virtual
|
||||
~/ %mule
|
||||
|* taq=_|.(_*)
|
||||
|* taq=_|.(**)
|
||||
=+ mud=(mute taq)
|
||||
?- -.mud
|
||||
& [%& p=$:taq]
|
||||
@ -4372,7 +4372,7 @@
|
||||
==
|
||||
::
|
||||
++ mute :: untyped virtual
|
||||
|= taq=_^?(|.(_*))
|
||||
|= taq=_^?(|.(**))
|
||||
^- (each ,* (list tank))
|
||||
=+ ton=(mock [taq 9 2 0 1] |=(* ~))
|
||||
?- -.ton
|
||||
@ -4714,7 +4714,7 @@
|
||||
++ ramp :: make r-m prime
|
||||
|= [a=@ b=(list ,@) c=@] ^- @ux :: [bits snags seed]
|
||||
=> .(c (shas %ramp c))
|
||||
=+ d=_@
|
||||
=+ d=*@
|
||||
|-
|
||||
?: =((mul 100 a) d)
|
||||
~|(%ar-ramp !!)
|
||||
@ -4874,10 +4874,10 @@
|
||||
=> |%
|
||||
++ cipa :: AES params
|
||||
$_ ^? |%
|
||||
++ co _[p=@ q=@ r=@ s=@] :: col coefs
|
||||
++ ix |+(a=@ _@) :: key index
|
||||
++ ro _[p=@ q=@ r=@ s=@] :: row shifts
|
||||
++ su _@ :: s-box
|
||||
++ co *[p=@ q=@ r=@ s=@] :: col coefs
|
||||
++ ix |+(a=@ *@) :: key index
|
||||
++ ro *[p=@ q=@ r=@ s=@] :: row shifts
|
||||
++ su *@ :: s-box
|
||||
--
|
||||
--
|
||||
|%
|
||||
@ -4931,7 +4931,7 @@
|
||||
::
|
||||
++ mcol
|
||||
|= [a=(list ,@) b=[p=@ q=@ r=@ s=@]] ^- (list ,@)
|
||||
=+ c=[p=_@ q=_@ r=_@ s=_@]
|
||||
=+ c=[p=*@ q=*@ r=*@ s=*@]
|
||||
|- ^- (list ,@)
|
||||
?~ a ~
|
||||
=> .(p.c (cut 3 [0 1] i.a))
|
||||
@ -5028,7 +5028,7 @@
|
||||
$(i +(i))
|
||||
++ ix :: key expand, inv
|
||||
|= a=@ ^- @
|
||||
=+ [i=1 j=_@ b=_@ c=co:pin]
|
||||
=+ [i=1 j=*@ b=*@ c=co:pin]
|
||||
|-
|
||||
?: =(nnr i)
|
||||
a
|
||||
@ -5975,7 +5975,7 @@
|
||||
?@(p.lot [%dtzy %$ p.lot] [$(p.lot -.p.lot) $(p.lot +.p.lot)])
|
||||
::
|
||||
%many
|
||||
|-(^-(twig ?~(p.lot [%bczp %null] [^$(lot i.p.lot) $(p.lot t.p.lot)])))
|
||||
[%cltr (turn p.lot |=(a=coin ^$(lot a)))]
|
||||
==
|
||||
::
|
||||
++ look
|
||||
@ -6141,7 +6141,7 @@
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 2fB, macro expansion ::
|
||||
::
|
||||
++ ah
|
||||
++ ah :: tiki engine
|
||||
|_ tig=tiki
|
||||
++ blue
|
||||
|= gen=twig
|
||||
@ -6149,6 +6149,17 @@
|
||||
?. &(?=(| -.tig) ?=(~ p.tig)) gen
|
||||
[%tsgr [~ 3] gen]
|
||||
::
|
||||
++ pink
|
||||
|= tyl=tile
|
||||
^- tile
|
||||
?. &(?=(| -.tig) ?=(~ p.tig)) tyl
|
||||
?- -.tyl
|
||||
?(%leaf %axil) tyl
|
||||
%herb [%herb [%tsgr [~ 3] p.tyl]]
|
||||
%weed [%weed [%tsgr [~ 3] p.tyl]]
|
||||
* [%herb [%tsgr [~ 3] [%bccm tyl]]]
|
||||
==
|
||||
::
|
||||
++ gray
|
||||
|= gen=twig
|
||||
^- twig
|
||||
@ -6165,7 +6176,7 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
++ al
|
||||
++ al :: tile engine
|
||||
~% %al
|
||||
+>+
|
||||
==
|
||||
@ -6335,7 +6346,7 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
++ ap
|
||||
++ ap :: twig engine
|
||||
~% %ap
|
||||
+>
|
||||
==
|
||||
@ -6377,9 +6388,8 @@
|
||||
?- gen
|
||||
[~ *] [%cnts [gen ~] ~]
|
||||
[%bccm *] ~(clam al p.gen)
|
||||
[%bccb *] ~(bunt al p.gen)
|
||||
[%bctr *] [%ktsg ~(bunt al p.gen)]
|
||||
[%bczp *] [%bccb %axil p.gen]
|
||||
[%bczp *] [%bctr %axil p.gen]
|
||||
[%brcb *] [%tsls [%bctr p.gen] [%brcn q.gen]]
|
||||
[%brdt *] [%brcn (~(put by *(map term foot)) %$ [%ash p.gen])]
|
||||
[%brtr *] [%brfs p.gen (~(put by *(map term foot)) %$ [%elm q.gen])]
|
||||
@ -6500,7 +6510,7 @@
|
||||
:^ %wtcl :: ?:
|
||||
[%bczp %bean] :: ?
|
||||
[%bczp %null] :: ~
|
||||
:- [%ktts %i [%dtzy 'tD' _@]] :: :- i=~~
|
||||
:- [%ktts %i [%dtzy 'tD' *@]] :: :- i=~~
|
||||
[%ktts %t [%cnzy %$]] :: t=$
|
||||
|- ^- twig ::
|
||||
?~ p.gen ::
|
||||
@ -6653,6 +6663,11 @@
|
||||
=+ vaw=~(. ah p.gen)
|
||||
%- gray:vaw
|
||||
[%wtpt puce:vaw (blue:vaw q.gen) (blue:vaw r.gen)]
|
||||
::
|
||||
[%wttz *]
|
||||
=+ vaw=~(. ah q.gen)
|
||||
%- gray:vaw
|
||||
[%wtts (pink:vaw p.gen) puce:vaw]
|
||||
::
|
||||
[%zpcb *] q.gen
|
||||
[%zpgr *]
|
||||
@ -8774,9 +8789,7 @@
|
||||
:- '('
|
||||
(stag %cnhp (ifix [pel per] (most ace wide)))
|
||||
:- '*'
|
||||
;~ pose
|
||||
(stag %bctr ;~(pfix tar hill))
|
||||
==
|
||||
(stag %bctr ;~(pfix tar hill))
|
||||
:- '+'
|
||||
;~ pose
|
||||
(stag %dtls ;~(pfix lus (ifix [pel per] wide)))
|
||||
@ -8802,15 +8815,7 @@
|
||||
==
|
||||
:- '.'
|
||||
;~ pose
|
||||
%+ cook
|
||||
|= a=coin ^- twig
|
||||
?- -.a
|
||||
~ [%dtzy p.a]
|
||||
%blob [%dtzz %$ p.a]
|
||||
%many [%cltr (turn p.a |=(b=coin ^$(a b)))]
|
||||
==
|
||||
;~(pfix dot perd:so)
|
||||
::
|
||||
(cook (jock |) ;~(pfix dot perd:so))
|
||||
(cook |=(a=wing [%cnts a ~]) rope)
|
||||
==
|
||||
:- ['0' '9']
|
||||
@ -8850,8 +8855,6 @@
|
||||
(stag %cnzz rope)
|
||||
(stag %bczp (cold %cell ket))
|
||||
==
|
||||
:- '_'
|
||||
(stag %bccb ;~(pfix cab hill))
|
||||
:- '`'
|
||||
;~ pfix tec
|
||||
;~ pose
|
||||
@ -8940,7 +8943,7 @@
|
||||
['=' (rung tis %bark exqe)]
|
||||
:- '+'
|
||||
%+ cook
|
||||
|=([a=tile b=tile] [%weed [%brls a [%bccb b]]])
|
||||
|=([a=tile b=tile] [%weed [%brls a [%bctr b]]])
|
||||
;~(pfix lus (toad exqb))
|
||||
:- '%'
|
||||
;~ pfix cen
|
||||
@ -9022,7 +9025,6 @@
|
||||
==
|
||||
:- '$'
|
||||
;~ pose
|
||||
(rune cab %bccb expv)
|
||||
(rune com %bccm expv)
|
||||
(stag %bccm (noil tol))
|
||||
==
|
||||
@ -9121,7 +9123,7 @@
|
||||
['>' (rune gar %wtgr expb)]
|
||||
['-' (rune hep %wthz expx)]
|
||||
['^' (rune ket %wtkz expf)]
|
||||
['=' (rune tis %wtts expw)]
|
||||
['=' (rune tis %wttz expw)]
|
||||
['+' (rune lus %wtlz expy)]
|
||||
['&' (rune pam %wtpm exps)]
|
||||
['@' (rune pat %wtpz expf)]
|
||||
@ -9255,7 +9257,7 @@
|
||||
++ expt |.((butt ;~(gunk loaf race))) :: twig, [tile twig]s
|
||||
++ expu |.(;~(gunk lobe wisp)) :: tile, core tail
|
||||
++ expv |.(lobe) :: tile
|
||||
++ expw |.(;~(gunk lobe rope)) :: tile and wing
|
||||
++ expw |.(;~(gunk lobe teak)) :: tile and tiki
|
||||
++ expx |.((butt ;~(gunk teak race))) :: tiki, [tile twig]s
|
||||
++ expy |.((butt ;~(gunk teak loaf race))) :: tiki twig [tile twig]s
|
||||
++ expz |.(loaf(bug &)) :: twig with tracing
|
||||
@ -9741,7 +9743,7 @@
|
||||
^- vase
|
||||
?: &(=(-.q.ves -.q.sev) =(+>.q.ves +>.q.sev))
|
||||
ves :: unchanged, use old
|
||||
sev(+<.q [_@da _@ =>(~ |+(* ~))]) :: clear to stop leak
|
||||
sev(+<.q [*@da *@ =>(~ |+(* ~))]) :: clear to stop leak
|
||||
::
|
||||
++ swim
|
||||
|= $: org=@tas
|
||||
@ -9779,10 +9781,10 @@
|
||||
|= but=type
|
||||
^- vile
|
||||
=+ pal=|=(a=@t ^-(type (~(play ut but) (vice a))))
|
||||
:* typ=(pal '_type')
|
||||
duc=(pal '_duct')
|
||||
pah=(pal '_path')
|
||||
mev=(pal '_[%meta vase]')
|
||||
:* typ=(pal '*type')
|
||||
duc=(pal '*duct')
|
||||
pah=(pal '*path')
|
||||
mev=(pal '*[%meta vase]')
|
||||
==
|
||||
::
|
||||
++ is :: operate in time
|
||||
@ -9964,7 +9966,7 @@
|
||||
?: ?=(%verb -.q.i.ova)
|
||||
$(ova t.ova, lac !lac)
|
||||
?: ?=(%veer -.q.i.ova)
|
||||
$(ova t.ova, +>.^$ (veer _@da q.i.ova))
|
||||
$(ova t.ova, +>.^$ (veer *@da q.i.ova))
|
||||
=+(avo=$(ova t.ova) [[i.ova -.avo] +.avo])
|
||||
::
|
||||
++ peek :: external inspect
|
||||
|
315
arvo/zuse.hoon
315
arvo/zuse.hoon
@ -607,6 +607,134 @@
|
||||
==
|
||||
==
|
||||
::
|
||||
::
|
||||
++ poxo :: node to tape
|
||||
=< |=(a=manx `tape`(apex a ~))
|
||||
|_ unq=?
|
||||
++ apex :: top level
|
||||
|= [mex=manx rez=tape]
|
||||
^- tape
|
||||
?: ?=([%$ [[%$ *] ~]] g.mex)
|
||||
(escp v.i.a.g.mex rez)
|
||||
=+ man=`mane`n.g.mex
|
||||
=. unq |(unq =(%script man) =(%style man))
|
||||
=+ tam=(name man)
|
||||
=. rez :(weld "</" tam ">" rez)
|
||||
=+ att=`mart`a.g.mex
|
||||
:- '<'
|
||||
%+ welp tam
|
||||
=. rez ['>' (many c.mex rez)]
|
||||
?~(att rez [' ' (attr att rez)])
|
||||
::
|
||||
++ attr :: attributes to tape
|
||||
|= [tat=mart rez=tape]
|
||||
^- tape
|
||||
?~ tat rez
|
||||
=. rez $(tat t.tat)
|
||||
;: weld
|
||||
(name n.i.tat)
|
||||
"=\""
|
||||
(escp(unq |) v.i.tat '"' ?~(t.tat rez [' ' rez]))
|
||||
==
|
||||
::
|
||||
++ escp :: escape for xml
|
||||
|= [tex=tape rez=tape]
|
||||
?: unq
|
||||
(weld tex rez)
|
||||
=+ xet=`tape`(flop tex)
|
||||
|- ^- tape
|
||||
?~ xet rez
|
||||
%= $
|
||||
xet t.xet
|
||||
rez ?- i.xet
|
||||
34 ['&' 'q' 'u' 'o' 't' ';' rez]
|
||||
38 ['&' 'a' 'm' 'p' ';' rez]
|
||||
39 ['&' '#' '3' '9' ';' rez]
|
||||
60 ['&' 'l' 't' ';' rez]
|
||||
62 ['&' 'g' 't' ';' rez]
|
||||
* [i.xet rez]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ name :: name to tape
|
||||
|= man=mane ^- tape
|
||||
?@ man (trip man)
|
||||
(weld (trip -.man) `tape`[':' (trip +.man)])
|
||||
::
|
||||
++ many :: nodelist to tape
|
||||
|= [lix=(list manx) rez=tape]
|
||||
|- ^- tape
|
||||
?~ lix rez
|
||||
(apex i.lix $(lix t.lix))
|
||||
--
|
||||
::
|
||||
++ poxa :: xml parser
|
||||
=< |=(a=cord (rush a apex))
|
||||
|%
|
||||
++ apex
|
||||
=+ spa=;~(pose comt whit)
|
||||
%+ knee *manx |. ~+
|
||||
%+ ifix [(star spa) (star spa)]
|
||||
;~ pose
|
||||
%+ sear |=([a=marx b=marl c=mane] ?.(=(c n.a) ~ (some [a b])))
|
||||
;~(plug head (more (star comt) ;~(pose apex chrd)) tail)
|
||||
empt
|
||||
==
|
||||
::
|
||||
++ attr :: attributes
|
||||
%+ knee *mart |. ~+
|
||||
%- star
|
||||
;~ pfix (plus whit)
|
||||
;~ plug
|
||||
;~(sfix name tis)
|
||||
;~ pose
|
||||
(ifix [doq doq] (star ;~(less doq escp)))
|
||||
(ifix [soq soq] (star ;~(less soq escp)))
|
||||
==
|
||||
==
|
||||
==
|
||||
::
|
||||
++ chrd :: character data
|
||||
%+ cook |=(a=tape ^-(mars :/(a)))
|
||||
(plus ;~(less soq doq ;~(pose (just `@`10) escp)))
|
||||
::
|
||||
++ comt :: comments
|
||||
=- (ifix [(jest '<!--') (jest '-->')] (star -))
|
||||
;~ pose
|
||||
;~(less hep prn)
|
||||
whit
|
||||
;~(less (jest '-->') hep)
|
||||
==
|
||||
::
|
||||
++ escp
|
||||
;~ pose
|
||||
;~(less gal gar pam prn)
|
||||
(cold '>' (jest '>'))
|
||||
(cold '<' (jest '<'))
|
||||
(cold '&' (jest '&'))
|
||||
(cold '"' (jest '"'))
|
||||
(cold '\'' (jest '''))
|
||||
==
|
||||
++ empt :: self-closing tag
|
||||
%+ ifix [gal (jest '/>')]
|
||||
;~(plug ;~(plug name attr) (cold ~ (star whit)))
|
||||
::
|
||||
++ head :: opening tag
|
||||
(ifix [gal gar] ;~(plug name attr))
|
||||
::
|
||||
++ name :: tag name
|
||||
=+ ^= chx
|
||||
%+ cook crip
|
||||
;~ plug
|
||||
;~(pose cab alf)
|
||||
(star ;~(pose cab dot alp))
|
||||
==
|
||||
;~(pose ;~(plug ;~(sfix chx col) chx) chx)
|
||||
::
|
||||
++ tail (ifix [(jest '</') gar] name) :: closing tag
|
||||
++ whit (mask ~[' ' `@`0x9 `@`0xa]) :: whitespace
|
||||
--
|
||||
::
|
||||
++ jo :: json reparser
|
||||
=> |% ++ grub (unit ,*)
|
||||
++ fist $+(json grub)
|
||||
@ -833,129 +961,10 @@
|
||||
=+ buf=(rap 3 (turn wol |=(a=tape (crip (weld a `tape`[`@`10 ~])))))
|
||||
[(met 3 buf) buf]
|
||||
::
|
||||
::
|
||||
++ txml :: string to xml
|
||||
|= tep=tape ^- mars
|
||||
[[%$ [%$ tep] ~] ~]
|
||||
::
|
||||
++ xmla :: attributes to tape
|
||||
|= [tat=mart rez=tape]
|
||||
^- tape
|
||||
?~ tat rez
|
||||
=+ ryq=$(tat t.tat)
|
||||
:(weld (xmln n.i.tat) "=\"" (xmle | v.i.tat '"' ?~(t.tat ryq [' ' ryq])))
|
||||
::
|
||||
++ xmle :: escape for xml
|
||||
|= [unq=? tex=tape rez=tape]
|
||||
?: unq
|
||||
(weld tex rez)
|
||||
=+ xet=`tape`(flop tex)
|
||||
|- ^- tape
|
||||
?~ xet rez
|
||||
%= $
|
||||
xet t.xet
|
||||
rez ?- i.xet
|
||||
34 ['&' 'q' 'u' 'o' 't' ';' rez]
|
||||
38 ['&' 'a' 'm' 'p' ';' rez]
|
||||
39 ['&' '#' '3' '9' ';' rez]
|
||||
60 ['&' 'l' 't' ';' rez]
|
||||
62 ['&' 'g' 't' ';' rez]
|
||||
* [i.xet rez]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ xmln :: name to tape
|
||||
|= man=mane ^- tape
|
||||
?@ man (trip man)
|
||||
(weld (trip -.man) `tape`[':' (trip +.man)])
|
||||
::
|
||||
++ xmll :: nodelist to tape
|
||||
|= [unq=? lix=(list manx) rez=tape]
|
||||
|- ^- tape
|
||||
?~ lix rez
|
||||
(xmlt unq i.lix $(lix t.lix))
|
||||
::
|
||||
++ xmlt :: node to tape
|
||||
|= [unq=? mex=manx rez=tape]
|
||||
^- tape
|
||||
?: ?=([%$ [[%$ *] ~]] g.mex)
|
||||
(xmle unq v.i.a.g.mex rez)
|
||||
=+ man=`mane`-.g.mex
|
||||
=. unq |(unq =(%script man) =(%style man))
|
||||
=+ tam=(xmln man)
|
||||
=+ end=:(weld "</" tam ">" rez)
|
||||
=+ bod=['>' (xmll unq c.mex :(weld "</" tam ">" rez))]
|
||||
=+ att=`mart`a.g.mex
|
||||
:- '<'
|
||||
%+ weld tam
|
||||
`_tam`?~(att bod [' ' (xmla att bod)])
|
||||
::
|
||||
++ xmlp :: xml parser
|
||||
=< |=(a=cord (rush a apex))
|
||||
|%
|
||||
++ apex
|
||||
=+ spa=;~(pose comt whit)
|
||||
%+ knee *manx |. ~+
|
||||
%+ ifix [(star spa) (star spa)]
|
||||
;~ pose
|
||||
%+ sear |=([a=marx b=marl c=mane] ?.(=(c n.a) ~ (some [a b])))
|
||||
;~(plug head (more (star comt) ;~(pose apex chrd)) tail)
|
||||
empt
|
||||
==
|
||||
::
|
||||
++ attr :: attributes
|
||||
%+ knee *mart |. ~+
|
||||
%- star
|
||||
;~ pfix (plus whit)
|
||||
;~ plug
|
||||
;~(sfix name tis)
|
||||
;~ pose
|
||||
(ifix [doq doq] (star ;~(less doq escp)))
|
||||
(ifix [soq soq] (star ;~(less soq escp)))
|
||||
==
|
||||
==
|
||||
==
|
||||
::
|
||||
++ chrd :: character data
|
||||
%+ cook |=(a=tape ^-(mars :/(a)))
|
||||
(plus ;~(less soq doq ;~(pose (just `@`10) escp)))
|
||||
::
|
||||
++ comt :: comments
|
||||
=- (ifix [(jest '<!--') (jest '-->')] (star -))
|
||||
;~ pose
|
||||
;~(less hep prn)
|
||||
whit
|
||||
;~(less (jest '-->') hep)
|
||||
==
|
||||
::
|
||||
++ escp
|
||||
;~ pose
|
||||
;~(less gal gar pam prn)
|
||||
(cold '>' (jest '>'))
|
||||
(cold '<' (jest '<'))
|
||||
(cold '&' (jest '&'))
|
||||
(cold '"' (jest '"'))
|
||||
(cold '\'' (jest '''))
|
||||
==
|
||||
++ empt :: self-closing tag
|
||||
%+ ifix [gal (jest '/>')]
|
||||
;~(plug ;~(plug name attr) (cold ~ (star whit)))
|
||||
::
|
||||
++ head :: opening tag
|
||||
(ifix [gal gar] ;~(plug name attr))
|
||||
::
|
||||
++ name :: tag name
|
||||
=+ ^= chx
|
||||
%+ cook crip
|
||||
;~ plug
|
||||
;~(pose cab alf)
|
||||
(star ;~(pose cab dot alp))
|
||||
==
|
||||
;~(pose ;~(plug ;~(sfix chx col) chx) chx)
|
||||
::
|
||||
++ tail (ifix [(jest '</') gar] name) :: closing tag
|
||||
++ whit (mask ~[' ' `@`0x9 `@`0xa]) :: whitespace
|
||||
--
|
||||
::
|
||||
|= tep=tape ^- mars
|
||||
[[%$ [%$ tep] ~] ~]
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 3bE, tree sync ::
|
||||
::
|
||||
@ -1123,7 +1132,7 @@
|
||||
|= p=tako :: XX slow
|
||||
^- (set tako)
|
||||
=+ y=(tako-to-yaki p)
|
||||
=+ t=(~(put in _(set tako)) p)
|
||||
=+ t=(~(put in *(set tako)) p)
|
||||
%+ roll p.y
|
||||
|= [q=tako s=_t]
|
||||
?: (~(has in s) q) :: already done
|
||||
@ -1281,7 +1290,7 @@
|
||||
=+ nak=(~(get by r.ank) i.pat)
|
||||
%= ank
|
||||
r %+ ~(put by r.ank) i.pat
|
||||
$(pat t.pat, ank (fall nak _ankh))
|
||||
$(pat t.pat, ank (fall nak *ankh))
|
||||
==
|
||||
::
|
||||
++ forge-yaki :: forge-yaki:ze
|
||||
@ -1327,8 +1336,8 @@
|
||||
|= [p=yaki q=yaki] :: (future zeal)
|
||||
^- (set yaki) :: zear still uses zule
|
||||
%- reduce-merge-points :: this is test-only
|
||||
=+ s=(~(put in _(set tako)) r.p) :: not actually used
|
||||
=+ t=(~(put in _(set tako)) t.p) :: but might be active
|
||||
=+ s=(~(put in *(set tako)) r.p) :: not actually used
|
||||
=+ t=(~(put in *(set tako)) t.p) :: but might be active
|
||||
=| u=(set yaki) :: eventually
|
||||
|- ^- (set yaki)
|
||||
=+ v=(~(int in s) t) :: found common
|
||||
@ -1359,7 +1368,7 @@
|
||||
%- reduce-merge-points
|
||||
=+ r=(reachable-takos r.p)
|
||||
|- ^- (set yaki)
|
||||
?: (~(has in r) q) (~(put in _(set yaki)) q) :: done
|
||||
?: (~(has in r) q) (~(put in *(set yaki)) q) :: done
|
||||
%+ roll p.q
|
||||
|= [t=tako s=(set yaki)]
|
||||
?: (~(has in r) t)
|
||||
@ -1705,7 +1714,7 @@
|
||||
%init :: force fine
|
||||
?. =(let 0) :: hell no
|
||||
!!
|
||||
=+ hot=(~(put by _(map aeon tako)) 1 (~(got by hit.for) let.for))
|
||||
=+ hot=(~(put by *(map aeon tako)) 1 (~(got by hit.for) let.for))
|
||||
[~ [~ [1 hot hut lat]]] :: trivial
|
||||
%fine
|
||||
=+ der=(~(got by hit.for) let.for)
|
||||
@ -1733,9 +1742,9 @@
|
||||
=+ yak=-.gar
|
||||
=+ hek=+.gar
|
||||
=. lat -:(update-lat hek ~) :: add new blobs
|
||||
=. hut (~(put by _(map tako yaki)) r.yak yak)
|
||||
=. hut (~(put by *(map tako yaki)) r.yak yak)
|
||||
=. let +(let)
|
||||
=. hit (~(put by _(map aeon tako)) let r.yak)
|
||||
=. hit (~(put by *(map aeon tako)) let r.yak)
|
||||
[~ [~ [let hit hut lat]]]
|
||||
==
|
||||
::
|
||||
@ -1815,7 +1824,7 @@
|
||||
%+ mix ?~(q.ank 0 p.u.q.ank)
|
||||
=+ axe=1
|
||||
|- ^- cash
|
||||
?~ r.ank _@
|
||||
?~ r.ank *@
|
||||
;: mix
|
||||
(shaf %dash (mix axe (shaf %dush (mix p.n.r.ank p.q.n.r.ank))))
|
||||
$(r.ank l.r.ank, axe (peg axe 2))
|
||||
@ -1932,16 +1941,6 @@
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 3bF, filesystem interface ::
|
||||
::
|
||||
++ fain :: path restructure
|
||||
|= [hom=path raw=path]
|
||||
=+ bem=(need (tome raw))
|
||||
=+ [mer=(flop s.bem) moh=(flop hom)]
|
||||
|- ^- (pair beam path)
|
||||
?~ moh
|
||||
[bem(s hom) (flop mer)]
|
||||
?> &(?=(^ mer) =(i.mer i.moh))
|
||||
$(mer t.mer, moh t.moh)
|
||||
::
|
||||
++ feel :: simple file write
|
||||
|= [pax=path val=*]
|
||||
^- miso
|
||||
@ -2043,6 +2042,16 @@
|
||||
:- p.pok
|
||||
[i.rax q.pok]
|
||||
::
|
||||
++ fain :: path restructure
|
||||
|= [hom=path raw=path]
|
||||
=+ bem=(need (tome raw))
|
||||
=+ [mer=(flop s.bem) moh=(flop hom)]
|
||||
|- ^- (pair beam path)
|
||||
?~ moh
|
||||
[bem(s hom) (flop mer)]
|
||||
?> &(?=(^ mer) =(i.mer i.moh))
|
||||
$(mer t.mer, moh t.moh)
|
||||
::
|
||||
++ fest :: web synthesizer
|
||||
|= [hom=path raw=path]
|
||||
|* yax=$+(epic *)
|
||||
@ -2112,17 +2121,17 @@
|
||||
++ sifo :: 64-bit encode
|
||||
|= tig=@
|
||||
^- tape
|
||||
=+ poc=(mod (sub 3 (mod (met 3 tig) 3)) 3)
|
||||
=+ poc=(~(dif fo 3) 0 (met 3 tig))
|
||||
=+ pad=(lsh 3 poc (swap 3 tig))
|
||||
=+ ^= ska
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
=+ ^= cha
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||
=+ ^= sif
|
||||
%- flop
|
||||
|- ^- tape
|
||||
?~ pad
|
||||
~
|
||||
=+ d=(end 0 6 pad)
|
||||
[(snag d ska) $(pad (rsh 0 6 pad))]
|
||||
[(cut 3 [0 d] cha) $(pad (rsh 0 6 pad))]
|
||||
(weld (scag (sub (lent sif) poc) sif) (trip (fil 3 poc '=')))
|
||||
::
|
||||
++ urle :: URL encode
|
||||
@ -2327,7 +2336,7 @@
|
||||
?: (lte wid 8) %earl
|
||||
?> (lte wid 16) %pawn
|
||||
::
|
||||
++ glam
|
||||
++ glam :: carrier names
|
||||
|= zar=@pD ^- tape
|
||||
%+ snag zar
|
||||
^- (list tape)
|
||||
@ -2387,7 +2396,7 @@
|
||||
"Ataturk"
|
||||
==
|
||||
::
|
||||
++ glon
|
||||
++ glon :: ISO language codes
|
||||
|= lag=lang
|
||||
^- (unit tape)
|
||||
?+ lag ~
|
||||
@ -2680,18 +2689,18 @@
|
||||
++ acru :: asym cryptosuite
|
||||
$_ ^? |% :: opaque object
|
||||
++ as ^? :: asym ops
|
||||
|% ++ seal |=([a=pass b=@ c=@] _@) :: encrypt to a
|
||||
++ sign |=([a=@ b=@] _@) :: certify as us
|
||||
|% ++ seal |=([a=pass b=@ c=@] *@) :: encrypt to a
|
||||
++ sign |=([a=@ b=@] *@) :: certify as us
|
||||
++ sure |=([a=@ b=@] *(unit ,@)) :: authenticate from us
|
||||
++ tear |= [a=pass b=@] :: accept from a
|
||||
*(unit ,[p=@ q=@]) ::
|
||||
-- ::
|
||||
++ de |+([a=@ b=@] *(unit ,@)) :: symmetric de, soft
|
||||
++ dy |+([a=@ b=@] _@) :: symmetric de, hard
|
||||
++ en |+([a=@ b=@] _@) :: symmetric en
|
||||
++ dy |+([a=@ b=@] *@) :: symmetric de, hard
|
||||
++ en |+([a=@ b=@] *@) :: symmetric en
|
||||
++ ex ^? :: export
|
||||
|% ++ fig _@uvH :: fingerprint
|
||||
++ pac _@uvG :: default passcode
|
||||
|% ++ fig *@uvH :: fingerprint
|
||||
++ pac *@uvG :: default passcode
|
||||
++ pub *pass :: public key
|
||||
++ sec *ring :: private key
|
||||
-- ::
|
||||
|
@ -54,6 +54,7 @@
|
||||
[%ins p=path q=(unit twig)] :: add file
|
||||
[%mut p=path q=twig] :: change file
|
||||
[%hoon p=twig] :: eval expression
|
||||
[%comt ~] :: comment
|
||||
[%var p=term q=twig] :: set variable
|
||||
[%rvar p=term] :: unset variable
|
||||
== ::
|
||||
@ -102,7 +103,7 @@
|
||||
%+ ifix [(star ace) gaw]
|
||||
;~ pose
|
||||
(stag %run ;~(plug (star ;~(sfix (task(tol %0) bar) ace)) (task col)))
|
||||
(stag %end ;~(pfix sem ;~(pose (stag %& dem) (stag %| sym))))
|
||||
(stag %end ;~(pfix col sem ;~(pose (stag %& dem) (stag %| sym))))
|
||||
(stag %del ;~(pfix hep ace loca))
|
||||
(stag %mut ;~(pfix col ace ;~(plug loca expg)))
|
||||
(stag %ins ;~(pfix lus ace ;~(plug loca (opts expg))))
|
||||
@ -110,6 +111,7 @@
|
||||
(stag %var ;~(plug ;~(pfix tis sym) expg))
|
||||
(stag %rvar ;~(pfix ;~(plug tis tis) sym))
|
||||
(stag %hoon expr)
|
||||
(stag %comt ;~(pfix col col (cold ~ (star prn))))
|
||||
==
|
||||
::
|
||||
++ expg (rais ;~(pfix ace expr(tol %1)) ;~(pfix gap expr))
|
||||
@ -167,15 +169,16 @@
|
||||
++ eat
|
||||
|= [you=ship com=coma]
|
||||
?- -.com
|
||||
%path (eat-path +.com)
|
||||
%comt +>.$
|
||||
%del (eat-del +.com)
|
||||
%end (eat-end +.com)
|
||||
%hoon (eat-hoon +.com)
|
||||
%ins (eat-ins +.com)
|
||||
%mut (eat-mut +.com)
|
||||
%del (eat-del +.com)
|
||||
%path (eat-path +.com)
|
||||
%run (eat-run you +.com)
|
||||
%end (eat-end +.com)
|
||||
%var (eat-var +.com)
|
||||
%rvar (eat-rvar +.com)
|
||||
%hoon (eat-hoon +.com)
|
||||
%var (eat-var +.com)
|
||||
==
|
||||
::
|
||||
++ eat-del
|
||||
|
@ -127,12 +127,7 @@
|
||||
==
|
||||
%- full
|
||||
;~ pose
|
||||
;~ pfix (jest '######') (stag 6 hed) ==
|
||||
;~ pfix (jest '#####') (stag 5 hed) ==
|
||||
;~ pfix (jest '####') (stag 4 hed) ==
|
||||
;~ pfix (jest '###') (stag 3 hed) ==
|
||||
;~ pfix (jest '##') (stag 2 hed) ==
|
||||
;~ pfix (jest '#') (stag 1 hed) ==
|
||||
:~(plug (cook lent (stun [1 6] hax)) hed)
|
||||
(stag 1 (ifix [wits ;~(plug eol (plus tis))] sed))
|
||||
(stag 2 (ifix [wits ;~(plug eol (plus hep))] sed))
|
||||
==
|
||||
@ -147,7 +142,7 @@
|
||||
;~(plug (stun [0 3] ace) cab wits cab wits cab (star ;~(pose cab ace)))
|
||||
==
|
||||
::
|
||||
++ html (stag %hem apex:xmlp) :: html barb
|
||||
++ html (stag %hem apex:poxa) :: html barb
|
||||
++ lasd :: top level list
|
||||
%+ stag %lit
|
||||
%- full
|
||||
|
@ -10,7 +10,7 @@
|
||||
++ grow :: convert to
|
||||
|% ::
|
||||
++ mime [/text/html (met 3 htm) htm] :: to %mime
|
||||
++ hymn (rash htm apex:xmlp) :: to %hymn
|
||||
++ hymn (need (poxa htm)) :: to %hymn
|
||||
-- ::
|
||||
++ grab |% :: convert from
|
||||
++ noun ,@t :: clam from %noun
|
||||
|
@ -6,7 +6,7 @@
|
||||
::
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ html (crip (xmlt | own ~)) :: convert to %html
|
||||
++ html (crip (poxo own)) :: convert to %html
|
||||
++ mime [/text/html (taco html)] :: convert to %mime
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
|
@ -7,7 +7,7 @@
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ hymn ;html:(head:title:"Untitled" body:"+{own}") :: convert to %hymn
|
||||
++ html (crip (xmlt | hymn ~)) :: convert to %html
|
||||
++ html (crip (poxo hymn)) :: convert to %html
|
||||
++ mime [/text/html (taco html)] :: convert to %mime
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
|
@ -37,7 +37,7 @@
|
||||
== ==
|
||||
== ==
|
||||
++ html
|
||||
(crip (xmlt | hymn ~))
|
||||
(crip (poxo hymn))
|
||||
++ mime
|
||||
[/text/html (taco html)]
|
||||
--
|
||||
|
@ -397,7 +397,7 @@ Used nowhere XX
|
||||
|
||||
++ mane $|(@tas [@tas @tas]) :: XML name/space
|
||||
|
||||
Parsed by ++name:xmlp, rendered by ++xmln, section 3bD
|
||||
Parsed by ++name:poxa, rendered by ++node:poxo, section 3bD
|
||||
|
||||
---
|
||||
|
||||
@ -407,7 +407,7 @@ Parsed by ++name:xmlp, rendered by ++xmln, section 3bD
|
||||
|
||||
Top level xml node.
|
||||
|
||||
Parsed by ++apex:xmlp, rendered by ++xmlt, section 3bD
|
||||
Parsed by ++apex:poxa, rendered by ++apex:poxo, section 3bD
|
||||
|
||||
---
|
||||
|
||||
@ -415,7 +415,7 @@ Parsed by ++apex:xmlp, rendered by ++xmlt, section 3bD
|
||||
|
||||
++ marl (list manx) :: XML node list
|
||||
|
||||
Parsed within ++apex:xmlp, rendered by ++xmll, section 3bD
|
||||
Parsed within ++apex:poxa, rendered by ++many:poxo, section 3bD
|
||||
|
||||
---
|
||||
|
||||
@ -423,7 +423,7 @@ Parsed within ++apex:xmlp, rendered by ++xmll, section 3bD
|
||||
|
||||
++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata
|
||||
|
||||
,_:/(tape), used nowhere XX should be in ++chrd:xmlp
|
||||
,_:/(tape), used nowhere XX should be in ++chrd:poxa and ++chrd:poxo
|
||||
|
||||
Is a valid ++manx
|
||||
|
||||
@ -433,7 +433,7 @@ Is a valid ++manx
|
||||
|
||||
++ mart (list ,[n=mane v=tape]) :: XML attributes
|
||||
|
||||
Parsed by ++attr:xmlp, rendered by ++xmla, section 3bD
|
||||
Parsed by ++attr:poxa, rendered by ++attr:poxo, section 3bD
|
||||
|
||||
---
|
||||
|
||||
@ -441,7 +441,7 @@ Parsed by ++attr:xmlp, rendered by ++xmla, section 3bD
|
||||
|
||||
++ marx ,[n=mane a=mart] :: XML tag
|
||||
|
||||
Parsed by ++head:xmlp, rendered within ++xmlt, section 3bD
|
||||
Parsed by ++head:poxa, rendered within ++apex:poxo, section 3bD
|
||||
|
||||
---
|
||||
|
||||
|
@ -28,19 +28,18 @@ This represents an XML node, an opening and a closing tag with no attributes
|
||||
nor children:
|
||||
|
||||
```
|
||||
~zod/try=> (xmlt | ;div; "")
|
||||
~zod/try=> (poxo ;div;)
|
||||
"<div></div>"
|
||||
~zod/try=> (xmlt | ;namespaced_div; ~)
|
||||
~zod/try=> (poxo ;namespaced_div;)
|
||||
"<namespaced:div></namespaced:div>"
|
||||
```
|
||||
|
||||
**Note**: `++xmlt` takes three arguments: a loobean determening whether text should be
|
||||
xml-escaped, the `manx` to be rendered, and a tape onto which to append the
|
||||
results. `<script>` and `<style>` tags are unescaped by default. For more
|
||||
information, see the XML documentation in Volume 3, section 3bD.
|
||||
**Note**: `++poxo` renders a `manx` into a tape. `<script>` and `<style>` tags
|
||||
become unescaped. For more information, see the XML documentation in Volume 3,
|
||||
section 3bD.
|
||||
|
||||
However, `%gall` applications operate on nouns of the type `[%hymn manx]`,
|
||||
making direct calls to `++xmlt` rare.
|
||||
making direct calls to `++poxo` rare.
|
||||
|
||||
Attributes and child nodes
|
||||
--------------------------
|
||||
@ -68,20 +67,17 @@ In wide form, a child node is appended with a `':'`:
|
||||
```
|
||||
~zod/try=> ;div:p;
|
||||
[[%div ~] [[%p ~] ~] ~]
|
||||
~zod/try=> :poxo ;div:p;
|
||||
<div><p></p></div>
|
||||
~zod/try=> (poxo ;div:p;)
|
||||
"<div><p></p></div>"
|
||||
```
|
||||
|
||||
**Note:**`/~zod/try/1/bin/poxo/hoon` is a shell script that applies `(curr (cury xmlt |) ~)`
|
||||
to a `manx`, rendering it as a `tape`.
|
||||
|
||||
Multiple nodes can be represented inside of parentheses, separated by single spaces:
|
||||
|
||||
```
|
||||
~zod/try=> ;div:(p ul:(li li))
|
||||
[[%div ~] [[%p ~] ~] [[%ul ~] [[%li ~] ~] [[%li ~] ~] ~] ~]
|
||||
~zod/try=> :poxo ;div:(p ul:(li li))
|
||||
<div><p></p><ul><li></li><li></li></ul></div>
|
||||
~zod/try=> (poxo ;div:(p ul:(li li)))
|
||||
"<div><p></p><ul><li></li><li></li></ul></div>"
|
||||
```
|
||||
|
||||
Tags must always be closed. In wide form, this is done either with a `';'` if the
|
||||
@ -102,8 +98,8 @@ pairs are contained within parentheses, which immediately follow a `mane`:
|
||||
```
|
||||
~zod/try=> ;div(id "me", class "elem");
|
||||
[[%div [%id "me"] [%class "elem"] ~] ~]
|
||||
~zod/try=> :poxo ;div(class "elem", id "me"); ~))
|
||||
<div class="elem" id="me"></div>
|
||||
~zod/try=> (poxo ;div(class "elem", id "me"); ~)))
|
||||
"<div class="elem" id="me"></div>"
|
||||
```
|
||||
|
||||
The characters `'.'`, `'#'`, and `'/'` are short forms of the attributes `class`,
|
||||
@ -121,8 +117,8 @@ terms instead of tapes.
|
||||
The resulting XML is, of course, identical:
|
||||
|
||||
```
|
||||
~zod/try=> :poxo ;div.elem#me;
|
||||
<div id="me" class="elem"></div>
|
||||
~zod/try=> (poxo ;div.elem#me;)
|
||||
"<div id="me" class="elem"></div>"
|
||||
```
|
||||
|
||||
Character data
|
||||
@ -133,8 +129,8 @@ Nodes can also contain text:
|
||||
```
|
||||
~zod/try=> ;p:"contents of paragraph"
|
||||
[[%p ~] [[%~. [%~. "contents of paragraph"] ~] ~] ~]
|
||||
~zod/try=> :poxo ;p:"contents of paragraph"
|
||||
<p>contents of paragraph</p>
|
||||
~zod/try=> (poxo ;p:"contents of paragraph")
|
||||
"<p>contents of paragraph</p>"
|
||||
```
|
||||
|
||||
Text is stored as a `mars` (a cdata node):
|
||||
@ -183,8 +179,8 @@ is that of embedded nodes:
|
||||
[[%~. [%~. " more text"] ~] ~]
|
||||
~
|
||||
]
|
||||
~zod/try=> :poxo ;p:"Text text ;{b "bolded text"} more text"
|
||||
<p>Text text <b>bolded text</b> more text</p>
|
||||
~zod/try=> (poxo ;p:"Text text ;{b "bolded text"} more text")
|
||||
"<p>Text text <b>bolded text</b> more text</p>"
|
||||
```
|
||||
|
||||
Notice that the syntax calls for a `marx`, followed by zero or more wide-form children
|
||||
@ -214,8 +210,8 @@ If no glyph prefix is present, a`'-'` is assumed:
|
||||
[[%~. [%~. "d text"] ~] ~]
|
||||
~
|
||||
]
|
||||
~zod/try=> :poxo ;p:"Paragraph with {(weld "inter" (trip %polate))}d text"
|
||||
<p>Paragraph with interpolated text</p>
|
||||
~zod/try=> (poxo ;p:"Paragraph with {(weld "inter" (trip %polate))}d text")
|
||||
"<p>Paragraph with interpolated text</p>"
|
||||
```
|
||||
|
||||
A prefix of `'+'` accepts a `manx`:
|
||||
@ -223,8 +219,8 @@ A prefix of `'+'` accepts a `manx`:
|
||||
```
|
||||
~zod/try=> ;p:"This text +{?:((gth 2 1) ;b:"be bold" ;i:"be scared")}"
|
||||
[[%p ~] [[%~. [%~. "This text "] ~] ~] [[%b ~] [[%~. [%~. "be bold"] ~] ~] ~] ~]
|
||||
~zod/try=> :poxo ;p:"This text +{?:((gth 2 1) ;b:"be bold" ;i:"be scared")}"
|
||||
<p>This text <b>be bold</b></p>
|
||||
~zod/try=> (poxo ;p:"This text +{?:((gth 2 1) ;b:"be bold" ;i:"be scared")}")
|
||||
"<p>This text <b>be bold</b></p>"
|
||||
```
|
||||
|
||||
A prefix of `'*'` accepts a `marl`:
|
||||
@ -240,8 +236,8 @@ A prefix of `'*'` accepts a `marl`:
|
||||
]
|
||||
]
|
||||
]
|
||||
~zod/try=> :poxo ;p:"Today *{(turn `wain`~[%live %love] |=(a=@tas ;span:"we {(trip a)}, "))}"
|
||||
<p>Today <span>we live, </span><span>we love, </span></p>
|
||||
~zod/try=> (poxo ;p:"Today *{(turn `wain`~[%live %love] |=(a=@tas ;span:"we {(trip a)}, "))}")
|
||||
"<p>Today <span>we live, </span><span>we love, </span></p>"
|
||||
```
|
||||
|
||||
A prefix of `'%'` accepts `$+(marl marl)`, a gate with both a sample and product of `marl`. The gate is then slammed by the nodes that follow it:
|
||||
@ -251,8 +247,8 @@ A prefix of `'%'` accepts `$+(marl marl)`, a gate with both a sample and product
|
||||
[ [%p ~]
|
||||
~[[g=[n=%$ a=~[[n=%$ v="dup"]]] c=~] [g=[n=%$ a=~[[n=%$ v="dup"]]] c=~]]
|
||||
]
|
||||
~zod/try=> :poxo ;p:"%{|=(a=marl (weld a a))}dup"
|
||||
<p>dupdup</p>
|
||||
~zod/try=> (poxo ;p:"%{|=(a=marl (weld a a))}dup")
|
||||
"<p>dupdup</p>"
|
||||
```
|
||||
|
||||
Interpolation can be disabled by replacing double quotes with single quotes.
|
||||
@ -342,7 +338,7 @@ with no tag:
|
||||
|
||||
```
|
||||
!:
|
||||
=- [- (xmll | - ~)]
|
||||
=- [- (many:poxo - ~)]
|
||||
;=
|
||||
;p: node
|
||||
;node(with "attribute");
|
||||
|
@ -145,7 +145,7 @@
|
||||
;~(plug (stun [0 3] ace) cab wits cab wits cab (star ;~(pose cab wite)))
|
||||
==
|
||||
::
|
||||
++ html (stag %html apex:xmlp) :: html bloc
|
||||
++ html (stag %html apex:poxa) :: html bloc
|
||||
++ lasd :: top level list
|
||||
%+ stag %list
|
||||
%- full
|
||||
@ -340,5 +340,5 @@ look like:
|
||||
:_ ~ :_ ~
|
||||
:- %$
|
||||
!>
|
||||
(xmll | (apex:dank (scan samp apex)) ~)
|
||||
(many:poxo (apex:dank (scan samp apex)) ~)
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|= ^
|
||||
|= [a=manx ~]
|
||||
=- ~[te/[-]~]~
|
||||
(crip (xmlt | a ""))
|
||||
=- ~[te/[(crip (poxo a))]~]~
|
||||
|
@ -1,3 +1,3 @@
|
||||
!:
|
||||
|= mex=manx
|
||||
(crip (xmlt | mex ~))
|
||||
(crip (poxo mex))
|
||||
|
Loading…
Reference in New Issue
Block a user