neo: html & json conversions

This commit is contained in:
Liam Fitzgerald 2024-03-27 12:41:23 -04:00
parent 7f6e84c488
commit 6f639fd92b
21 changed files with 594 additions and 20 deletions

View File

@ -146,7 +146,7 @@
abet:(take:sys:run rest.pole syn)
[cards this]
++ on-fail on-fail:def
++ on-peek on-peek:def
++ on-peek peek:run
++ command-parser
|= =id:sole
~(parser walk:run id)
@ -289,6 +289,37 @@
++ our-sys-name `name:neo`[our.bowl `pith:neo`#/$/sys]
++ our-sys-pith (en-pith:name:neo our-sys-name)
::
++ peek
|= pax=path
^- (unit (unit cage))
?. ?=([%x *] pax)
[~ ~]
~& pax/pax
=/ pax=(pole iota) (pave:neo t.pax)
~& pax/pax
?+ pax [~ ~]
[as=@ car=@ [%p who=@] pith=*] (run-peek [as car who pith]:pax)
==
++ run-peek
|= [as=term car=term =name:neo]
^- (unit (unit cage))
=+ ;;(=care:neo car)
?. =(our.bowl ship.name)
[~ ~] :: XX: todo
=/ res (cane:(hall pith.name) care)
?+ as [~ ~]
%noun ``neo-cane+!>(res)
%json
``json+!>((cane:enjs:neo res !<($-(pail:neo json) (all-grow %json))))
%html
=* en-html
~(. en-html:neo [#/['~']/scry/[dap.bowl]/html (en-pith:name:neo name)])
=- ``hymn+!>(-)
%+ lift-to-hymn:en-html pith.name
(cane:en-html res !<($-(pail:neo manx) (all-grow %node)))
==
::
++ take-arvo
|= [=pith syn=sign-arvo]
^+ run
@ -406,6 +437,9 @@
++ poke
|= [=mark =vase]
^+ run
?: =(%neo-raw-poke mark)
=+ !<(raw=raw-poke:neo vase)
(on-move (raw-poke:harden raw))
?: =(%neo-move mark)
=+ !<(=move:neo vase)
(on-move move)
@ -508,14 +542,18 @@
fiesta/fiesta
grow/!>(grow)
apex/!>(apex)
con/!>(con)
==
!, *hoon
|= =pail:neo
^- out
=/ =pith:neo (~(got by con.fiesta) [p.pail grow])
=+ !<([cache=(unit vase)] state.icon:(~(got of:neo pith)))
?> ?=(^ cache)
!<(out (slam u.cache q.pail))
~! p.pail
~! grow
=/ =stud:neo
~| missing-con/[p.pail grow]
(~(got by con.fiesta) [p.pail grow])
=/ conv ~(do con stud)
!<(out (slam run:conv q.pail))
::
++ juice
|_ =pulp:neo
@ -711,6 +749,10 @@
::
++ harden
|%
++ raw-poke
|= raw=raw-poke:neo
^- move:neo
[p.p.raw q.p.raw %poke (vial q.raw)]
++ vial
|= =vial:neo
:- p.vial
@ -1029,7 +1071,7 @@
#/src/reef
(snoc pat ud/(dec idx))
=. run
(slop wer prev fac)
(slop wer fac prev)
$(pros t.pros, idx +(idx))
++ make-prelude
|= [pax=pith =file:ford]
@ -1051,6 +1093,8 @@
(levy lib.file |=(lib:ford ~(exists lib name)))
==
?. has-imports
~| pro.file
~| lib.file
~| %no-imports
!!
=/ built-imports=?
@ -1539,7 +1583,13 @@
~| p.move
?> ?=([[%p @p] *] p.q.move)
+.i.p.q.move
[%agent [her dap.bowl] %poke neo-move+!>(move)]
?: =(our.bowl her)
[%agent [her dap.bowl] %poke neo-move+!>(move)]
=/ raw=raw-poke:neo
?> ?=(%poke -.q.q.move)
[[p p.q]:move (pail:soften pail.q.q.move)]
?> ?=(%poke -.q.q.move)
[%agent [her dap.bowl] %poke neo-raw-poke+!>(raw)]
++ arvo .
++ emit |=(=move:neo arvo(down [move down]))
++ trace-card
@ -1672,7 +1722,12 @@
=. apex (put:of-top here room)
[cards arvo]
::
++ si-resolve-kids ~
++ si-resolve-kids
%- ~(gas by *(map pith vase))
%+ turn ~(tap by (kid:of-top here))
|= [=pith:neo =room:neo]
^- [pith:neo vase]
[pith state.icon.room]
++ si-resolve-deps
%- ~(gas by *(map term [pith cane:neo]))
^- (list [term pith cane:neo])
@ -1986,6 +2041,7 @@
?+ scar.i.grab.race !!
%cord (stag %cord (cook crip (star prn)))
%patud (stag %patud dem:ag)
%patp (stag %patp ;~(pfix sig fed:ag))
==
--
++ shoe-ef

View File

@ -0,0 +1,85 @@
/- neo
=< p-title
|%
+$ msg
[%title title=@t]
++ pike pike:neo
++ goon goon:neo
++ get-bowl
=/ m (pike bowl:pike)
^- form:m
|= in=input:pike
^- output:m
[%done bowl.in]
++ grab
|= items=(list item:pike)
=/ m (pike (pole clot:goon))
^- form:m
|= in=input:pike
^- output:m
?^ syn.in
?. ?=(%grab -.u.syn.in)
[%fail %weird-card ~]
[%done items.u.syn.in]
[%emit %grab items]
++ grab-one
|= =item:pike
=/ m (pike clot:goon)
;< =(pole clot:goon) bind:m
(grab item ~)
?> ?=([clot=* ~] pole)
(pure:m clot.pole)
++ grab-validate
|= [items=(list item:pike) valid=$-((list clot:goon) (list (unit @t)))]
=/ m (pike (pole clot:goon))
^- form:m
|- =* loop $
;< res=(list clot:goon) bind:m
(grab items)
=/ errs (valid res)
=/ has-err=?
%+ roll errs
|= [er=(unit cord) has-err=_|]
?: has-err &
?~ er |
&
?. has-err
(pure:m res)
=/ new
=| new=(list item:pike)
|-
?~ items
new
?~ errs
new
=. err.i.items i.errs
$(items t.items, new (snoc new i.items), errs t.errs)
loop(items new)
::
++ peek
|= =path
=/ m (pike cage)
^- form:m
|= in=input:pike
^- output:m
?^ syn.in
?. ?=(%peek -.u.syn.in)
[%fail %weird-card ~]
[%done cage.u.syn.in]
[%emit %peek path]
++ p-title
=/ m (pike ewer:neo)
^- form:m
;< p=(pole clot:goon) bind:m
%- grab
=- ~[-]
:* 'Pal'
'Enter the ship you want to pal'
~
%patp
==
?> ?=([[%patp p=@p] ~] p)
;< =bowl:pike bind:m get-bowl
(pure:m %pals-action !>([%meet p.p]))
::
--

View File

@ -0,0 +1,85 @@
/- neo
=< p-title
|%
+$ msg
[%title title=@t]
++ pike pike:neo
++ goon goon:neo
++ get-bowl
=/ m (pike bowl:pike)
^- form:m
|= in=input:pike
^- output:m
[%done bowl.in]
++ grab
|= items=(list item:pike)
=/ m (pike (pole clot:goon))
^- form:m
|= in=input:pike
^- output:m
?^ syn.in
?. ?=(%grab -.u.syn.in)
[%fail %weird-card ~]
[%done items.u.syn.in]
[%emit %grab items]
++ grab-one
|= =item:pike
=/ m (pike clot:goon)
;< =(pole clot:goon) bind:m
(grab item ~)
?> ?=([clot=* ~] pole)
(pure:m clot.pole)
++ grab-validate
|= [items=(list item:pike) valid=$-((list clot:goon) (list (unit @t)))]
=/ m (pike (pole clot:goon))
^- form:m
|- =* loop $
;< res=(list clot:goon) bind:m
(grab items)
=/ errs (valid res)
=/ has-err=?
%+ roll errs
|= [er=(unit cord) has-err=_|]
?: has-err &
?~ er |
&
?. has-err
(pure:m res)
=/ new
=| new=(list item:pike)
|-
?~ items
new
?~ errs
new
=. err.i.items i.errs
$(items t.items, new (snoc new i.items), errs t.errs)
loop(items new)
::
++ peek
|= =path
=/ m (pike cage)
^- form:m
|= in=input:pike
^- output:m
?^ syn.in
?. ?=(%peek -.u.syn.in)
[%fail %weird-card ~]
[%done cage.u.syn.in]
[%emit %peek path]
++ p-title
=/ m (pike ewer:neo)
^- form:m
;< p=(pole clot:goon) bind:m
%- grab
=- ~[-]
:* 'Tag'
'Enter the tag you want to add'
~
%cord
==
?> ?=([[%cord p=@t] ~] p)
;< =bowl:pike bind:m get-bowl
(pure:m %pal-diff !>([%add-tag p.p]))
::
--

View File

@ -0,0 +1,18 @@
::
/- neo
::
|_ =move:neo
++ grad %noun
:: +grab: convert from
::
++ grab
|%
++ noun move:neo
--
:: +grow: convert to
::
++ grow
|%
++ noun move
--
--

View File

@ -0,0 +1,18 @@
::
/- neo
::
|_ =raw-poke:neo
++ grad %noun
:: +grab: convert from
::
++ grab
|%
++ noun raw-poke:neo
--
:: +grow: convert to
::
++ grow
|%
++ noun raw-poke
--
--

View File

@ -0,0 +1,9 @@
/@ chat
:- [%chat %json]
|= cat=chat
^- json
=, enjs:format
%- pairs
:~ title/s/title.cat
who/a/(turn ~(tap in who.cat) |=(=@p s/(scot %p p)))
==

View File

@ -0,0 +1,17 @@
/@ chat
:- [%chat %node]
|= cat=chat
^- manx
;dl
;dt: Title
;dd: {(trip title.cat)}
;dt: Allowed
;dd
;ul
;*
%+ turn ~(tap in who.cat)
|= s=ship
;code.ship: (scow %p s)
==
==
==

View File

@ -0,0 +1,12 @@
/@ message
:- [%message %node]
|= mes=message
^- manx
;dl
;dt: Author
;dd: {(scow %p from.mes)}
;dt: Time
;dd: {(scow %da now.mes)}
;dt: Contents
;dd: {(trip contents.mes)}
==

View File

@ -0,0 +1,3 @@
:- [%pal %htmx]
|= =bowl:neo
*manx

View File

@ -0,0 +1,35 @@
/@ pal-type=pal
/@ pal-diff
=>
|%
++ card card:neo
--
^- firm:neo
|%
++ state %pal
++ poke (sy %pal-diff ~)
++ kids *kids:neo
++ deps *deps:neo
++ form
^- form:neo
|_ [=bowl:neo =ever:neo state-vase=vase *]
+* sta !<(pal-type state-vase)
++ poke
|= [=stud:neo vax=vase]
^- (quip card:neo vase)
=/ sta sta
?> =(%pal-diff stud)
=+ !<(poke=pal-diff vax)
:- ~
!> ^- pal-type
~! sta
?- -.poke
%add-tag sta(tags (~(put in tags.sta) term.poke))
%del-tag sta(tags (~(del in tags.sta) term.poke))
==
++ init
|= old=(unit vase)
=+ !<(p=pal-type (need old))
`!>(p)
--
--

View File

@ -0,0 +1,83 @@
/@ pal-diff
/@ pals-diff
/@ pals-action
/@ pal-type=pal
=>
|%
++ kind ?(%target %leeche %mutual)
++ card card:neo
++ get-kind
|= [=bowl:neo =ship]
^- (unit kind)
=/ =pith #/pals/[p/ship]
?~ kid=(~(get by kids.bowl) pith)
~
=+ !<(child=pal-type u.kid)
`type.child
++ her-hey
|= kin=(unit kind)
^- kind
?~ kin
%leeche
?: ?=(%leeche u.kin)
%leeche
%mutual
++ her-bye
|= kin=kind
^- (unit kind)
?: ?=(%leeche kin)
~
`%target
::
++ add-pal
|= [kind=?(%target %leeche %mutual) =bowl:neo =ship]
^- card
=/ init=pal-type [ship kind ~]
[(welp here.bowl (pave:neo /pals/(scot %p ship))) %make stud/%pal `!>(init) ~]
++ tell-pal
|= [=ship diff=pals-diff]
^- card
=/ were=pith (pave:neo /(scot %p ship)/pals)
[were %poke %pals-diff !>(diff)]
--
^- firm:neo
|%
++ state %sig
++ poke (sy %pals-diff ~)
++ kids
%- ~(gas by *kids:neo)
:~ :- ~[&/%pals |/%p] :: /pals/[who=@p]
[%pal %pal-diff] :: state = %pal, diff = %pal-diff
==
++ deps *deps:neo
++ form
^- form:neo
|_ [=bowl:neo =ever:neo state=vase *]
++ poke
|= [=stud:neo vax=vase]
^- (quip card:neo vase)
?+ stud !!
%pals-diff
=+ !<(poke=pals-diff vax)
:: ?. ;;(? +:(~(gut by deps.bowl) %open [*pith &]))
:: ~&(dropping-poke/poke !>(sta))
:_ state
(add-pal %leeche bowl ship.src.bowl)^~
::
%pals-action
=+ !<(poke=pals-action vax)
=/ diff=pals-diff
?: ?=(%meet -.poke)
hey/~
bye/~
:_ state
:~ (tell-pal ship.poke diff)
(add-pal %target bowl ship.poke)
==
==
++ init
|= old=(unit vase)
`!>(~)
--
--

View File

@ -0,0 +1,34 @@
/@ tweet
/@ tweet-diff
|%
++ state %tweet
++ poke
%- ~(gas in *(set stud:neo))
:~ %tweet-diff
==
++ kids *kids:neo
++ deps *deps:neo
++ form
^- form:neo
|_ [=bowl:neo =ever:neo state-vase=vase *]
+* sta !<(tweet state-vase)
++ poke
|= [=stud:neo vax=vase]
^- (quip card:neo vase)
=/ sta sta
?> ?=(%tweet-diff stud)
=+ !<(diff=tweet-diff vax)
:- ~
!> ^- tweet
?- -.diff
%add-fave sta(favs (~(put in favs.sta) ship.src.bowl))
%del-fave sta(favs (~(del in favs.sta) ship.src.bowl))
==
::
++ init
|= vas=(unit vase)
^- (quip card:neo vase)
=+ !<(=tweet (need vas))
`!>(tweet)
--
--

View File

@ -0,0 +1 @@
,$-(bowl:neo manx)

View File

@ -0,0 +1 @@
manx

View File

@ -0,0 +1,3 @@
$% [%add-tag =term]
[%del-tag =term]
==

View File

@ -0,0 +1,4 @@
$: =ship
type=?(%target %leeche %mutual)
tags=(set term)
==

View File

@ -0,0 +1,3 @@
$% [%meet =ship]
[%part =ship]
==

View File

@ -0,0 +1,3 @@
$% [%hey ~]
[%bye ~]
==

View File

@ -0,0 +1,3 @@
$% [%add-fave ~]
[%del-fave ~]
==

View File

@ -0,0 +1 @@
,[from=ship now=time contents=@t favs=(set ship)]

View File

@ -80,12 +80,12 @@
:: ^- $-(nail (like ^pro))
%+ rune pat
;~ pose
;~(plug sym ;~(pfix tis std))
%+ cook
|= =stud
?@ stud [stud stud]
[mark.stud stud]
std
;~(plug sym ;~(pfix gap std))
==
++ lib
:: ^- $-(nail (like ^lib))
@ -123,7 +123,7 @@
|= [reef=vase faces=(list (pair term vase))]
?~ faces
reef
$(reef (slop reef (with-face i.faces)), faces t.faces)
$(reef (slop (with-face i.faces) reef), faces t.faces)
--
++ behn
|%
@ -189,7 +189,7 @@
:- '0'^'9' bisk:so
:- '-' tash:so
:- '.' zust:so
:- '~' ;~(pfix sig ;~(pose crub:so (easy [%n ~])))
:- '~' ;~(pfix sig ;~(pose (stag %da (cook year when:so)) crub:so (easy [%n ~])))
:- '\'' (stag %t qut)
==
--
@ -460,6 +460,7 @@
^- (map pith _?>(?=(^ fil.fat) u.fil.fat))
=. fat (dip pax)
=. fat snip
=. fil.fat ~
tar
::
++ kids
@ -594,10 +595,10 @@
$% [%make =code init=(unit vase) =conf] :: todo: configuration values, init cannot be ^ if installing over
[%poke =pail]
[%tomb =case]
[%link from=pith src=stud]
[%link from=pith src=stud] :: XX deprecate
==
+$ poke
(pair pith *)
+$ raw-poke
(pair flow vial)
+$ yard
$+ yard
$~ ~
@ -705,6 +706,105 @@
==
==
--
++ en-html
|_ [basename=pith here=pith]
++ basetape |=(=care (en-tape:pith :(welp basename ~[care] here)))
++ ever
|= eve=^ever
^- manx
;dl.ever-neo
;dt: Node
;dd: {(a-co:co node.eve)}
::
;dt: Tree
;dd: {(a-co:co tree.eve)}
==
++ link
|= [=care pax=pith]
^- manx
=/ href=tape "{(welp (basetape care) (en-tape:pith pax))}.html"
;a(href href): As {<care>}
++ path
|= pax=pith
^- manx
;details
;summary: {(en-tape:pith pax)}
;ul
;li
;+ (link %x pax)
==
;li
;+ (link %y pax)
==
;li
;+ (link %z pax)
==
==
==
++ stud
|= std=^stud
^- tape
?@ std
(trip std)
"{(trip mark.std)}/{(scow %p ship.std)}/{(trip desk.std)}"
::
++ cane
|= [can=^cane con=$-(pail manx)]
^- manx
;dl.cane-neo
;dt: Care
;dd.care-neo: {(trip care.can)}
::
;dt: Ever
;dd
;+ (ever ever.can)
==
;dt: Type
;dd: {(stud p.pail.can)}
::
;dt: Value
;dd
;+ (con pail.can)
==
::
;dt: Children
;dd
;*
%+ turn ~(tap by kids.can)
|= [pit=pith eve=^ever pal=pail]
^- manx
;dl
;dt: Path
;dd
;+ (path pit)
==
::
;dt: Ever
;dd
;+ (ever eve)
==
::
;dt: Value
;dd
;+ (con pal)
==
==
==
==
++ lift-to-hymn
|= [pax=pith in=manx]
^- manx
;html
;head
;title: {(en-tape:pith pax)}
==
;body
;+ in
==
==
--
::
:: !!stud refers to imp/ different from $vial
+$ diff [=pith =ever dat=(unit vial)]
@ -726,8 +826,8 @@
+$ vial (pair stud *)
+$ move (pair pith card)
+$ code
$% [%clay p=path]
[%stud p=stud]
$% [%clay p=path] :: XX: %clay is only for app/neo
[%stud p=stud] :: look in the imp directory for that name
==
+$ span (pair code firm)
+$ icon
@ -790,13 +890,13 @@
(need (de-hall-soft hal))
--
+$ bowl
$: src=name
our=@p
$: src=name :: [=ship =pith]
our=@p :: our
were=pith :: XX: rename to here
here=pith
here=pith ::
now=@da
deps=(map term (pair pith cane))
kids=(map pith vase) :: XX: vase ->
kids=(map pith vase) :: XX: vase -> pail
==
+$ quay
$% [%x =port]