mirror of
https://github.com/urbit/shrub.git
synced 2024-08-17 08:00:39 +03:00
put txt->sail parsing in lib file
This commit is contained in:
parent
dd4ece70ad
commit
aac2cbb6b5
@ -4,4 +4,9 @@
|
||||
:- [%node %$ %hoon]
|
||||
|= nod=node
|
||||
^- hoon
|
||||
(~(vol manx-utils nod) "text")
|
||||
=/ raw=tape (need (val:mu "text"))
|
||||
%- crip
|
||||
?: =(0 (lent raw)) raw
|
||||
?. =((rear raw) '\0a') raw
|
||||
:: remove newline by html encoding nonsense
|
||||
(snip raw)
|
||||
|
@ -1,41 +1,15 @@
|
||||
/@ node
|
||||
/@ sail
|
||||
/- manx-utils
|
||||
/- sail
|
||||
:- [%node %$ %sail]
|
||||
|= nod=node
|
||||
|^
|
||||
^- sail
|
||||
=/ mu ~(. manx-utils nod)
|
||||
=/ code
|
||||
=/ raw=tape (need (val:mu "code"))
|
||||
?: =(0 (lent raw)) (crip raw)
|
||||
?. =((rear raw) '\0a') (crip raw)
|
||||
(crip (snip raw))
|
||||
=/ class (vol:mu "classes")
|
||||
[code class `(render-udon code)]
|
||||
++ render-udon
|
||||
|= code=@t
|
||||
^- (each manx tang)
|
||||
=/ newline (trip 10)
|
||||
=/ udon
|
||||
:: format as udon document
|
||||
%- crip
|
||||
;: welp
|
||||
";>" newline newline
|
||||
(trip code) newline
|
||||
==
|
||||
=/ mul
|
||||
%- mule
|
||||
|.
|
||||
!< manx
|
||||
%+ slap
|
||||
;: slop
|
||||
!>(..zuse)
|
||||
!>(manx-utils=manx-utils)
|
||||
==
|
||||
(ream udon)
|
||||
?- -.mul
|
||||
%.y [%.y (manx p.mul)]
|
||||
%.n [%.n (tang p.mul)]
|
||||
==
|
||||
--
|
||||
=/ mu ~(. manx-utils nod)
|
||||
=/ code
|
||||
=/ raw=tape (need (val:mu "code"))
|
||||
%- crip
|
||||
?: =(0 (lent raw)) raw
|
||||
?. =((rear raw) '\0a') raw
|
||||
:: remove newline by html encoding nonsense
|
||||
(snip raw)
|
||||
=/ class (vol:mu "classes")
|
||||
[code class `(render-udon:sail code)]
|
||||
|
@ -8,7 +8,6 @@
|
||||
:~
|
||||
[%iframe iframe/!>('')]
|
||||
[%txt txt/!>('')]
|
||||
[%sail sail/!>(['' '' ~])]
|
||||
==
|
||||
--
|
||||
^- kook:neo
|
||||
|
@ -1,6 +1,6 @@
|
||||
/@ sail
|
||||
/- sl=sail
|
||||
^- kook:neo
|
||||
=<
|
||||
|%
|
||||
++ state pro/%sail
|
||||
++ poke (sy %sail ~)
|
||||
@ -21,35 +21,8 @@
|
||||
?~ pal sail/!>(*sail)
|
||||
:: non-empty init unit always re-renders the code
|
||||
=/ sal !<(sail q.u.pal)
|
||||
|
||||
:- %sail
|
||||
!>
|
||||
sal(result `(render-udon code.sal))
|
||||
sal(result `(render-udon:sl code.sal))
|
||||
--
|
||||
--
|
||||
|%
|
||||
++ render-udon
|
||||
|= code=@t
|
||||
^- (each manx tang)
|
||||
=/ newline (trip 10)
|
||||
=/ udon
|
||||
:: format as udon document
|
||||
%- crip
|
||||
;: welp
|
||||
";>" newline newline
|
||||
(trip code) newline
|
||||
==
|
||||
=/ mul
|
||||
%- mule
|
||||
|.
|
||||
!< manx
|
||||
%+ slap
|
||||
;: slop
|
||||
!>(..zuse)
|
||||
==
|
||||
(ream udon)
|
||||
?- -.mul
|
||||
%.y [%.y (manx p.mul)]
|
||||
%.n [%.n (tang p.mul)]
|
||||
==
|
||||
--
|
||||
|
26
pkg/arvo/neo/cod/std/src/lib/sail.hoon
Normal file
26
pkg/arvo/neo/cod/std/src/lib/sail.hoon
Normal file
@ -0,0 +1,26 @@
|
||||
|%
|
||||
++ render-udon
|
||||
|= code=@t
|
||||
^- (each manx tang)
|
||||
=/ newline (trip 10)
|
||||
=/ udon
|
||||
:: format as udon document
|
||||
%- crip
|
||||
;: welp
|
||||
";>" newline
|
||||
(trip code) newline
|
||||
==
|
||||
=/ mul
|
||||
%- mule
|
||||
|.
|
||||
!< manx
|
||||
%+ slap
|
||||
;: slop
|
||||
!>(..zuse)
|
||||
==
|
||||
(ream udon)
|
||||
?- -.mul
|
||||
%.y [%.y (manx p.mul)]
|
||||
%.n [%.n (tang p.mul)]
|
||||
==
|
||||
--
|
Loading…
Reference in New Issue
Block a user