on 492ae2f help sign in
255 lines 4.8 kB history raw
1### `++poxo`
3Print XML
5Renders a `++manx` `a` as a [`++tape`]().
7Accepts
8-------
10`a` is a [`++manx`]().
12Produces
13--------
15A `++tape`.
17Source
18------
20 ++ poxo :: node to tape
21 =< |=(a=manx `tape`(apex a ~))
22 |_ unq=? :: unq
24Examples
25--------
27 ~zod/try=> (poxo ;div;)
28 "<div></div>"
29 ~zod/try=> (poxo ;div:(p a))
30 "<div><p></p><a></a></div>"
31 ~zod/try=> (poxo ;div:(p:"tree > text" a))
32 "<div><p>tree &gt; text</p><a></a></div>"
35### `++apex`
37Inner XML printer
39Renders a [`++manx`]() as a [`++tape`](), appending a suffix `rez`.
41XX is `rez/` a typo or is the `/` intentional
43Accepts
44-------
46`rez` is a [`++tape`]().
48Produces
49--------
51A `++tape`.
53Source
54------
56 ++ apex :: top level
57 |= [mex=manx rez=tape]
58 ^- tape
59 ?: ?=([%$ [[%$ *] ~]] g.mex)
60 (escp v.i.a.g.mex rez)
61 =+ man=`mane`n.g.mex
62 =. unq |(unq =(%script man) =(%style man))
63 =+ tam=(name man)
64 =. rez :(weld "</" tam ">" rez)
65 =+ att=`mart`a.g.mex
66 :- '<'
67 %+ welp tam
68 =. rez ['>' (many c.mex rez)]
69 ?~(att rez [' ' (attr att rez)])
70 ::
72Examples
73--------
75 ~zod/try=> (apex:poxo ;div; "")
76 "<div></div>"
77 ~zod/try=> (apex:poxo ;div:(p a) "").
78 "<div><p></p><a></a></div>"
79 ~zod/try=> (apex:poxo ;div:(p a) "--sfix")
80 "<div><p></p><a></a></div>--sfix"
81 ~zod/try=> (apex:poxo ;div:(p:"tree > text" a) "")
82 "<div><p>tree &gt; text</p><a></a></div>"
83 ~zod/try=> (~(apex poxo &) ;div:(p:"tree > text" a) "")
84 "<div><p>tree > text</p><a></a></div>"
86### `++attr`
88Print attributes
90Render XML attributes as a [`++tape`]().
92Accepts
93-------
95`tat` is a [`++mart`]().
97`rez` is a `++tape`.
99Produces
100--------
102A `++tape`.
104Source
105------
107 ++ attr :: attributes to tape
108 |= [tat=mart rez=tape]
109 ^- tape
110 ?~ tat rez
111 =. rez $(tat t.tat)
112 ;: weld
113 (name n.i.tat)
114 "=\""
115 (escp(unq |) v.i.tat '"' ?~(t.tat rez [' ' rez]))
116 ==
118Examples
119--------
121 ~zod/try=> (attr:poxo ~ "")
122 ""
123 ~zod/try=> (crip (attr:poxo ~[sam/"hem" [%tok %ns]^"reptor"] ""))
124 'sam="hem" tok:ns="reptor"'
125 ~zod/try=> (crip (attr:poxo ~[sam/"hem" [%tok %ns]^"reptor"] "|appen"))
126 'sam="hem" tok:ns="reptor"|appen'
128### `++escp`
130Escape XML
132Escapes the XML special characters `"`, `&`, `'`, `<`, `>`.
134Accepts
135-------
137`tex`is a [`++tape`]().
139`rez` is a `++tape`.
141Produces
142--------
144`++tape`.
146Source
147------
149 ++ escp :: escape for xml
150 |= [tex=tape rez=tape]
151 ?: unq
152 (weld tex rez)
153 =+ xet=`tape`(flop tex)
154 |- ^- tape
155 ?~ xet rez
156 %= $
157 xet t.xet
158 rez ?- i.xet
159 34 ['&' 'q' 'u' 'o' 't' ';' rez]
160 38 ['&' 'a' 'm' 'p' ';' rez]
161 39 ['&' '#' '3' '9' ';' rez]
162 60 ['&' 'l' 't' ';' rez]
163 62 ['&' 'g' 't' ';' rez]
164 * [i.xet rez]
165 ==
166 ==
167 ::
169Examples
170--------
172 ~zod/try=> (escp:poxo "astra" ~)
173 ~[~~a ~~s ~~t ~~r ~~a]
174 ~zod/try=> `tape`(escp:poxo "astra" ~)
175 "astra"
176 ~zod/try=> `tape`(escp:poxo "x > y" ~)
177 "x &gt; y"
178 ~zod/try=> `tape`(~(escp poxo &) "x > y" ~)
179 "x > y"
181### `++name`
183Print name
185Renders a [`++mane`]() as a [`++tape`]().
187Accepts
188-------
190`man` is a `++mane`.
192Produces
193--------
195A `++tape`.
197Source
198------
200 ++ name :: name to tape
201 |= man=mane ^- tape
202 ?@ man (trip man)
203 (weld (trip -.man) `tape`[':' (trip +.man)])
204 ::
206Examples
207--------
209 ~zod/try=> (name:poxo %$)
210 ""
211 ~zod/try=> (name:poxo %ham)
212 "ham"
213 ~zod/try=> (name:poxo %ham^%tor)
214 "ham:tor"
216### `++many`
218Print node list
220Renders multiple XML nodes as a [`++tape`]().
222Accepts
223-------
225`lix` is a [`++list`]() of [`++manx`]().
227`rez` is a `++tape`.
229Produces
230--------
232A `++tape`.
234Source
235------
237 ++ many :: nodelist to tape
238 |= [lix=(list manx) rez=tape]
239 |- ^- tape
240 ?~ lix rez
241 (apex i.lix $(lix t.lix))
242 ::
244Examples
245--------
247 ~zod/try=> (many:poxo ~ "")
248 ""
249 ~zod/try=> (many:poxo ;"hare" "")
250 "hare"
251 ~zod/try=> (many:poxo ;"hare;{lep}ton" "")
252 "hare<lep></lep>ton"
253 ~zod/try=> ;"hare;{lep}ton"
254 [[[%~. [%~. "hare"] ~] ~] [[%lep ~] ~] [[%~. [%~. "ton"] ~] ~] ~]