mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
mar: better HTML-related conversions
This commit is contained in:
parent
6a618aa88f
commit
a42b74bc5c
@ -13,7 +13,6 @@
|
||||
=> v=.
|
||||
|%
|
||||
++ mime => v [/text/plain (as-octs (of-wain pem))]
|
||||
++ elem => v ;pre: {(trip (of-wain pem))}
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
||||
|
@ -3,42 +3,6 @@
|
||||
::
|
||||
/? 310
|
||||
=, html
|
||||
|%
|
||||
++ words 1
|
||||
++ hedtal
|
||||
=| met=marl
|
||||
|= a=marl ^- [hed=marl tal=marl]
|
||||
?~ a [~ ~]
|
||||
?. ?=(%h1 n.g.i.a)
|
||||
?: ?=(%meta n.g.i.a)
|
||||
$(a t.a, met [i.a met])
|
||||
=+ had=$(a c.i.a)
|
||||
?^ -.had had
|
||||
$(a t.a)
|
||||
[c.i.a (weld (flop met) (limit words t.a))]
|
||||
::
|
||||
++ limit
|
||||
|= [lim=@u mal=marl]
|
||||
=< res
|
||||
|- ^- [rem=@u res=marl]
|
||||
?~ mal [lim ~]
|
||||
?~ lim [0 ~]
|
||||
=/ [lam=@u hed=manx]
|
||||
?: ?=(_;/(**) i.mal)
|
||||
[lim ;/(tay)]:(deword lim v.i.a.g.i.mal)
|
||||
[rem ele(c res)]:[ele=i.mal $(mal c.i.mal)]
|
||||
[rem - res]:[hed $(lim lam, mal t.mal)]
|
||||
::
|
||||
++ deword
|
||||
|= [lim=@u tay=tape] ^- [lim=@u tay=tape]
|
||||
?~ tay [lim tay]
|
||||
?~ lim [0 ~]
|
||||
=+ wer=(dot 1^1 tay)
|
||||
?~ q.wer
|
||||
[lim - tay]:[i.tay $(tay t.tay)]
|
||||
=+ nex=$(lim (dec lim), tay q.q.u.q.wer)
|
||||
[-.nex [(wonk wer) +.nex]]
|
||||
--
|
||||
::
|
||||
::
|
||||
=, mimes:html
|
||||
@ -50,14 +14,18 @@
|
||||
++ mime
|
||||
=< mime
|
||||
|%
|
||||
++ elem ;div:(h1:"*{hed}" div:"*{tal}") :: convert to %elem
|
||||
++ hymn ;html:(head:title:"snip" body:"+{elem}") :: convert to %hymn
|
||||
++ hymn :: convert to %hymn
|
||||
|^ html
|
||||
++ div ;div:(h1:"*{hed}" div:"*{tal}")
|
||||
++ html ;html:(head:title:"snip" body:"+{div}")
|
||||
--
|
||||
++ html (crip (en-xml hymn)) :: convert to %html
|
||||
++ mime [/text/html (as-octs html)] :: convert to %mime
|
||||
--
|
||||
++ noun [hed tal]
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
++ noun ,[marl marl] :: clam from %noun
|
||||
++ elem |=(a=manx (hedtal +.a))
|
||||
-- --
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ noun ,[marl marl] :: clam from %noun
|
||||
--
|
||||
--
|
||||
|
@ -1,12 +0,0 @@
|
||||
|_ a=manx
|
||||
++ grad %noun
|
||||
++ grab
|
||||
|%
|
||||
++ noun manx
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ htm a
|
||||
++ noun a
|
||||
--
|
||||
--
|
@ -1,11 +0,0 @@
|
||||
|_ a=manx
|
||||
++ grad %noun
|
||||
++ grab
|
||||
|%
|
||||
++ noun manx
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ noun a
|
||||
--
|
||||
--
|
1
pkg/arvo/mar/xhtml.hoon
Symbolic link
1
pkg/arvo/mar/xhtml.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../base-dev/mar/xhtml.hoon
|
@ -6,11 +6,15 @@
|
||||
=, mimes:html
|
||||
|_ mud=@t
|
||||
++ grow :: convert to
|
||||
|% ++ mime [/text/css (as-octs mud)] :: convert to %mime
|
||||
++ elem ;style :: convert to %hymn
|
||||
;- (trip mud)
|
||||
==
|
||||
++ hymn ;html:(head:"{elem}" body)
|
||||
|%
|
||||
++ mime [/text/css (as-octs mud)] :: convert to %mime
|
||||
++ hymn :: convert to %hymn
|
||||
|^ html
|
||||
++ style ;style
|
||||
;- (trip mud)
|
||||
==
|
||||
++ html ;html:(head:"{style}" body)
|
||||
--
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
|
@ -8,20 +8,7 @@
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ mime `^mime`[/text/x-hoon (as-octs:mimes:html own)] :: convert to %mime
|
||||
++ elem :: convert to %html
|
||||
;div:pre(urb_codemirror "", mode "hoon"):"{(trip own)}"
|
||||
:: =+ gen-id="src-{<`@ui`(mug own)>}"
|
||||
:: ;div
|
||||
:: ;textarea(id "{gen-id}"):"{(trip own)}"
|
||||
:: ;script:"""
|
||||
:: CodeMirror.fromTextArea(
|
||||
:: window[{<gen-id>}],
|
||||
:: \{lineNumbers:true, readOnly:true}
|
||||
:: )
|
||||
:: """
|
||||
:: ==
|
||||
++ hymn
|
||||
:: ;html:(head:title:"Source" "+{elem}")
|
||||
;html
|
||||
;head
|
||||
;title:"Source"
|
||||
|
@ -2,14 +2,5 @@
|
||||
:::: /hoon/htm/mar
|
||||
::
|
||||
/? 310
|
||||
|_ own=manx
|
||||
::
|
||||
++ grad %noun
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ noun own
|
||||
++ hymn own
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
++ noun manx :: clam from %noun
|
||||
-- --
|
||||
/= htm /mar/html
|
||||
htm
|
||||
|
@ -8,10 +8,13 @@
|
||||
++ grow
|
||||
|%
|
||||
++ mime [/application/javascript (as-octs:mimes:html (@t mud))]
|
||||
++ elem ;script
|
||||
;- (trip (@t mud))
|
||||
==
|
||||
++ hymn ;html:(head:"+{elem}" body)
|
||||
++ hymn :: convert to %hymn
|
||||
|^ html
|
||||
++ script ;script
|
||||
;- (trip (@t mud))
|
||||
==
|
||||
++ html ;html:(head:"{script}" body)
|
||||
--
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
|
@ -16,11 +16,6 @@
|
||||
%& a+p.result
|
||||
%| a+[a+[%s '[[output rendering error]]']~]~
|
||||
==
|
||||
::
|
||||
++ elem
|
||||
=- ;pre:code:"{(of-wall -)}"
|
||||
^- wall %- zing ^- (list wall)
|
||||
(turn (flop tan) |=(a=tank (wash 0^160 a)))
|
||||
--
|
||||
++ grab :: convert from
|
||||
|%
|
||||
|
@ -18,7 +18,6 @@
|
||||
=> v=.
|
||||
|%
|
||||
++ mime => v [/text/plain (as-octs (of-wain txt))]
|
||||
++ elem => v ;pre: {(trip (of-wain txt))}
|
||||
--
|
||||
++ grad
|
||||
|%
|
||||
|
@ -9,10 +9,6 @@
|
||||
++ mime [/text/x-unmark (as-octs:mimes:html mud)]
|
||||
++ txt
|
||||
(to-wain:format mud)
|
||||
++ elem
|
||||
^- manx
|
||||
=, cram
|
||||
elm:(static (ream mud))
|
||||
++ front :: XX performance, types
|
||||
^- (map term knot)
|
||||
%- ~(run by inf:(static:cram (ream mud)))
|
||||
|
@ -9,10 +9,6 @@
|
||||
++ mime [/text/x-unmark (as-octs:mimes:html mud)]
|
||||
++ txt
|
||||
(to-wain:format mud)
|
||||
++ elem
|
||||
^- manx
|
||||
=, cram
|
||||
elm:(static (ream mud))
|
||||
++ front :: XX performance, types
|
||||
^- (map term knot)
|
||||
%- ~(run by inf:(static:cram (ream mud)))
|
||||
|
@ -1,5 +1,5 @@
|
||||
::
|
||||
:::: /hoon/elem/urb/mar
|
||||
:::: /hoon/urb/mar
|
||||
::
|
||||
/? 310
|
||||
=, mimes:html
|
||||
|
5
pkg/base-dev/mar/xhtml.hoon
Normal file
5
pkg/base-dev/mar/xhtml.hoon
Normal file
@ -0,0 +1,5 @@
|
||||
::
|
||||
:::: /hoon/xhtml/mar
|
||||
::
|
||||
/= xhtml /mar/html
|
||||
xhtml
|
@ -1,21 +0,0 @@
|
||||
::
|
||||
:::: /hoon/css/mar
|
||||
::
|
||||
/? 310
|
||||
=, eyre
|
||||
=, mimes:html
|
||||
|_ mud=@t
|
||||
++ grow :: convert to
|
||||
|% ++ mime [/text/css (as-octs mud)] :: convert to %mime
|
||||
++ elem ;style :: convert to %hymn
|
||||
;- (trip mud)
|
||||
==
|
||||
++ hymn ;html:(head:"{elem}" body)
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
++ mime |=([p=mite q=octs] (@t q.q))
|
||||
++ noun @t :: clam from %noun
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
1
pkg/landscape/mar/css.hoon
Symbolic link
1
pkg/landscape/mar/css.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../base-dev/mar/css.hoon
|
@ -1,18 +0,0 @@
|
||||
::
|
||||
:::: /hoon/elem/mar
|
||||
::
|
||||
/? 310
|
||||
=, mimes:html
|
||||
=, html
|
||||
|_ own=manx
|
||||
::
|
||||
++ grad %noun
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ hymn ;html:(head body:"+{own}") :: convert to %hymn
|
||||
++ html (crip (en-xml hymn)) :: convert to %html
|
||||
++ mime [/text/html (as-octs html)] :: convert to %mime
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
++ noun manx :: clam from %noun
|
||||
-- --
|
@ -18,5 +18,4 @@
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
++ noun (map knot cord) :: clam from %noun
|
||||
:: ++ elem ,~
|
||||
-- --
|
||||
|
@ -1,12 +0,0 @@
|
||||
|_ a=manx
|
||||
++ grad %noun
|
||||
++ grab
|
||||
|%
|
||||
++ noun manx
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ htm a
|
||||
++ noun a
|
||||
--
|
||||
--
|
1
pkg/landscape/mar/xhtml.hoon
Symbolic link
1
pkg/landscape/mar/xhtml.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../base-dev/mar/xhtml.hoon
|
Loading…
Reference in New Issue
Block a user