canonize jo..:js:eyre into enjs:format

This commit is contained in:
Anton Dyudin 2016-12-02 15:47:16 -08:00
parent e7d08ac15f
commit 44288642bf
14 changed files with 71 additions and 69 deletions

View File

@ -47,7 +47,6 @@
::
++ sing :: elem to manx
=* xml xml:eyre
=, js:eyre
=, html
=> |%
++ first-word
@ -125,7 +124,7 @@
$item ;li;
$list ?@ q.p.a ;ul;
?: =(1 p.q.p.a) ;ol;
=+ num=(en-json (jone p.q.p.a))
=+ num=(en-json (numb:enjs p.q.p.a))
;ol(start num);
==
?- -.a :: ;/("unimplemented {<p.a>}")

View File

@ -3,7 +3,7 @@
:::: /hoon/elem-to-react-json/lib
::
/? 310
=, js:eyre
=, format
|%
++ react-attrs :: uppercase mapping
~+ ^- (map term cord)
@ -54,18 +54,18 @@
++ elem-to-react-json :: serialize DOM as json
|= src/manx ^- json
?: ?=(_;/(**) src)
(jape v.i.a.g.src)
(tape:enjs v.i.a.g.src)
=+ atr=(molt `(list (pair mane tape))`a.g.src)
?: (~(has by atr) [%urb %codemirror])
$(src (urb-codemirror src))
?: (~(has by atr) [%urb %exec]) :: runnable code attribute tag
$(src (urb-exec src))
%- jobe :~
%- pairs:enjs :~
c+a+(turn c.src ..$)
gn+s+(mane-to-cord n.g.src)
=< ga+(jobe (turn a.g.src .))
=< ga+(pairs:enjs (turn a.g.src .))
|= {a/mane b/tape} ^- {cord json}
:_ (jape b)
:_ (tape:enjs b)
?^ a (mane-to-cord a)
(fall (~(get by react-attrs) a) a)
==

View File

@ -3,6 +3,7 @@
:::: /hoon/map-to-json/lib
::
/? 310
=, format
|* {a/_cord b/_json} :: XX {a/$-(* cord) b/$-(* json)}
|= c/(map _+<.a _+<.b)
(jobe:js:eyre (turn (~(tap by c)) |*(d/^ [(a -.d) (b +.d)])))
(pairs:enjs (turn (~(tap by c)) |*(d/^ [(a -.d) (b +.d)])))

View File

@ -2,7 +2,6 @@
:::: /hoon/elem/mar
::
/? 310
=, js:eyre
|_ own/manx
::
++ grow :: convert to

View File

@ -6,7 +6,6 @@
:::: compute
::
=, ^eyre
=, js:eyre
=, format
=, html
|_ jon/json
@ -20,8 +19,8 @@
|% :: convert from
++ mime |=({p/mite q/octs} (fall (rush (@t q.q) apex:de-json) *json))
++ noun json :: clam from %noun
++ numb jone
++ time jode
++ numb numb:enjs
++ time time:enjs
--
++ grad %mime
--

View File

@ -7,7 +7,6 @@
:::: ~fyr
::
=, ^eyre
=, js:eyre
=, url:eyre
=, format
|_ all/{{who/@txname loc/@txloc} acc/(map knot plan-acct)}
@ -26,14 +25,15 @@
?~(url.b ~ [', ' (earf u.url.b)])
::
++ plan-json
%- jobe :~
%- pairs:enjs :~
who+?~(who ~ s+who)
loc+?~(loc ~ s+loc)
acc+o+(~(run by acc) json-acct)
==
++ json-acct :: helper
|= a/plan-acct ^- json
(jobe usr+s+usr.a url+?~(url.a ~ (jape (earf u.url.a))) ~)
=/ url ?~(url.a ~ (tape:enjs (earf u.url.a)))
(pairs:enjs usr+s+usr.a url+url ~)
--
++ grab |% :: convert from
++ noun {{cord cord} (map knot plan-acct)} :: clam from %noun

View File

@ -2,7 +2,6 @@
:::: /hoon/ships/mar
::
/? 310
=, js:eyre
=, format
|_ all/(list ship)
++ grab |%
@ -10,7 +9,7 @@
++ json (ar (su fed:ag)):dejs
--
++ grow |%
++ json `^json`[%a (turn all |=(a/ship (jape +:<a>)))]
++ json `^json`[%a (turn all ship:enjs)]
--
++ grad %json
--

View File

@ -7,21 +7,23 @@
::::
::
=, sole
=, format
|%
++ mar-sole-change :: XX dependency
|_ cha/sole-change
++ grow
|% ++ json
^- ^json
=+ cha
=< (jobe ted+(. ted) ler+a+~[(jone own.ler) (jone his.ler)] ~)
=, enjs
=; edi
=,(cha (pairs ted+(edi ted) ler+a+~[(numb own.ler) (numb his.ler)] ~))
|= det/sole-edit
?- -.det
$nop [%s 'nop']
$mor [%a (turn p.det ..$)]
$del (joba %del (jone p.det))
$set (joba %set (jape (tufa p.det)))
$ins (joba %ins (jobe at+(jone p.det) cha+s+(tuft q.det) ~))
$del (frond %del (numb p.det))
$set (frond %set (tape (tufa p.det)))
$ins (frond %ins (pairs at+(numb p.det) cha+s+(tuft q.det) ~))
==
--
--
@ -37,7 +39,6 @@
?@(a (trip a) ^$(a q.a))
--
::
=, js:eyre
|_ sef/sole-effect
::
++ grab :: convert from
@ -45,14 +46,15 @@
++ noun sole-effect :: clam from %noun
--
++ grow
=, enjs
|%
++ lens-json :: json for cli client
^- ?($~ ^json) :: null = ignore
?+ -.sef ~
$tan (jape (of-wall (turn (flop p.sef) ~(ram re a))))
$tan (wall (turn (flop p.sef) ~(ram re a))))
$txt s+(crip p.sef)
$sav
(jobe file+s+(crip <`path`p.sef>) data+s+(crip (sifo q.sef)) ~)
(pairs file+s+(crip <`path`p.sef>) data+s+(crip (sifo q.sef)) ~)
::
$mor
=+ all=(turn p.sef |=(a/sole-effect lens-json(sef a)))
@ -67,17 +69,17 @@
?+ -.sef
~|(unsupported-effect+-.sef !!)
$mor [%a (turn p.sef |=(a/sole-effect json(sef a)))]
$err (joba %hop (jone p.sef))
$txt (joba %txt (jape p.sef))
$tan (joba %tan (jape (wush 160 p.sef)))
$det (joba %det json:~(grow mar-sole-change +.sef))
$err (frond %hop (numb p.sef))
$txt (frond %txt (tape p.sef))
$tan (frond %tan (tape (wush 160 p.sef)))
$det (frond %det json:~(grow mar-sole-change +.sef))
::
$pro
%+ joba %pro
(jobe vis+b+vis.sef tag+s+tag.sef cad+(jape (purge cad.sef)) ~)
%+ frond %pro
(pairs vis+b+vis.sef tag+s+tag.sef cad+(tape (purge cad.sef)) ~)
::
?($bel $clr $nex)
(joba %act %s -.sef)
(frond %act %s -.sef)
==
--
--

View File

@ -3,7 +3,7 @@
::
/? 310
/+ elem-to-react-json, time-to-id
=, js:eyre
=, format
::
::::
::
@ -17,7 +17,8 @@
(sort all |=({a/* b/*} (lor b a)))
|= {a/time b/ship c/marl} ^- ^json
=+ bod=[[%div id+(time-to-id a) ~] c]
(jobe time+(jode a) user+(jape +:<b>) body+(elem-to-react-json bod) ~)
=, enjs
(pairs time+(time a) user+(ship b) body+(elem-to-react-json bod) ~)
--
++ grab |% :: convert from
++ noun (list {time manx}) :: clam from %noun

View File

@ -3,7 +3,7 @@
::
/? 310
/= urb-wasp-data-js /: /%/wasp-data /js/
=, js:eyre
=, format
=, xml:eyre
=, bytes:eyre
=, html

View File

@ -7,9 +7,10 @@
/~ ~
==
=, xml:eyre
=, js:eyre
=, format
=, html
^- marl
;= ;script(type "text/javascript"): window.tree = {(en-json (jobe data+dat sein+dat-sen ~))}
=/ tree (en-json (pairs:enjs data+dat sein+dat-sen ~))
;= ;script(type "text/javascript"): window.tree = {tree}
;div#tree;
==

View File

@ -9,7 +9,6 @@
/= kid /^ (map knot tree-include)
/_ /tree-include/
=, format
=, js:eyre
=, bytes:eyre
=, base64:eyre
::
@ -48,13 +47,13 @@
|= a/$%({$t p/cord} {$r p/json} {$j p/json} {$m mime})
?- -.a
$t [%s p.a]
$m (jobe mite+[%s (moon p.a)] octs+(jape (sifo q.q.a)) ~)
$m (pairs:enjs mite+[%s (moon p.a)] octs+(tape:enjs (sifo q.q.a)) ~)
$r p.a
$j p.a
==
++ from-queries
|= {bem/beam quy/(list query)}
=< (jobe (turn quy .))
=< (pairs:enjs (turn quy .))
|= a/query
:- -.a
?- -.a

View File

@ -5,7 +5,6 @@
=, ^eyre
=, crypto
=, bytes:eyre
=, js:eyre
=, url:eyre
=, wired
=, xml:eyre
@ -262,7 +261,7 @@
::
++ ares-to-json
|= err/ares ^- json
=- (jobe fail+s+typ mess+(jape mez) ~)
=- (pairs:enjs fail+s+typ mess+(tape:enjs mez) ~)
^- {typ/term mez/tape}
?~ err [%fail "Unknown Error"]
[p.u.err (of-wall (wush 160 q.u.err))]
@ -521,7 +520,7 @@
;head:title:"Redirecting..."
;body
;p: Redirecting to ;{a/"{url}" "{url}"}
;script: setTimeout(function()\{document.location = {(en-json (jape url))}}, 3000)
;script: setTimeout(function()\{document.location = {(en-json (tape:enjs url))}}, 3000)
==
==
::
@ -1185,7 +1184,7 @@
[%tang !>(p.res)]
::
++ mean-json |=({sas/@uG err/ares} (give-json sas ~ (ares-to-json err)))
++ nice-json |=(* (give-json 200 ~ (joba %ok %b &)))
++ nice-json |=(* (give-json 200 ~ (frond:enjs %ok %b &)))
::
++ pass-note |=(noe/{whir note} %_(+> mow :_(mow [hen %pass noe])))
++ host-to-ship :: host to ship
@ -1280,7 +1279,9 @@
{$~ $js}
$(pez [%js auth-redir:js])
{$~ $json}
$(pez [%json (jobe ok+b+| red+(jape url) ~)])
=/ red
(pairs:enjs ok+b+| red+(tape:enjs url) ~)
$(pez [%json red])
==
==
::
@ -1549,7 +1550,7 @@
$poll
?: ?=({$~ $js} p.pok) :: XX treat non-json cases?
=+ deps=[%a (turn `(list @uvH)`p.hem |=(a/@ s+(scot %uv a)))]
[%& %js (add-json (joba %deps deps) poll:js)]
[%& %js (add-json (frond:enjs %deps deps) poll:js)]
=. lyv (~(put by lyv) hen %wasp p.hem)
|-
=. done (new-deps i.p.hem %& hen)
@ -1599,7 +1600,7 @@
:~ (set-cookie cookie-domain cookie-prefix '~')
(set-cookie cookie-domain %ship '~')
==
[%| (give-json 200 cug (joba %ok %b &))]
[%| (give-json 200 cug (frond:enjs %ok %b &))]
::
$get
|-
@ -1695,12 +1696,13 @@
^+ [*json ..ya]
=^ orx ..ya new-view
:_ ..ya
%- jobe :~
=, enjs
%- pairs :~
oryx+s+orx
ixor+s+(oryx-to-ixor orx)
sein+(jape +:<(sein:title our)>)
ship+(jape +:<our>)
user+(jape +:<(fall get-user anon)>) :: XX crash on unsaved session?
sein+(ship (sein:title our))
ship+(ship our)
user+(ship (fall get-user anon)) :: XX crash on unsaved session?
==
::
++ get-user
@ -1769,7 +1771,7 @@
::
++ get-rush
|= {a/whir-of b/json} ^+ ..ix
(get-even [%rush [[(slav %p p.a) q.a] s.a] (joba %json b)])
(get-even [%rush [[(slav %p p.a) q.a] s.a] (frond:enjs %json b)])
::
++ get-quit
|= a/whir-of ^+ ..ix
@ -1796,7 +1798,7 @@
mow ?.(?=($rush -.ven) mow mow:(pass-took [- %mess +]:p.ven))
==
%^ give-json 200 ~
%^ jobe id+(jone num) type+[%s -.ven]
%^ pairs:enjs id+(numb:enjs num) type+[%s -.ven]
?- -.ven
$news ~[from+[%s (scot %uv p.ven)]]
$quit ~[from+(subs-to-json p.ven)]
@ -1830,10 +1832,10 @@
::
++ subs-to-json
|= {a/dock b/path}
%- jobe :~
%- pairs:enjs :~
ship+[%s (rsh 3 1 (scot %p p.a))]
appl+[%s q.a]
path+(jape (spud b))
path+(tape:enjs (spud b))
==
::
++ get-jael
@ -1847,7 +1849,7 @@
$token-beat
?~ pol abet :: recieved other response
~? !=(hen u.pol) [%oryx-beat-weird-duct hen]
(give-json:abet(pol ~, hen u.pol) 200 ~ (joba %beat %b &))
(give-json:abet(pol ~, hen u.pol) 200 ~ (frond:enjs %beat %b &))
==
--
++ lens :: urb.py engine
@ -1867,10 +1869,10 @@
++ get-ack
|= a/(unit (pair term tang)) ^+ ..lens
?~ a
..lens :: (give-json 200 ~ (joba %okey-dokey %b &))
..lens :: (give-json 200 ~ (frond:enjs %okey-dokey %b &))
=+ tag=(flop `tang`[>[%eyre-lens-fail p.u.a]< q.u.a])
%- (slog tag)
(give-json:abet 500 ~ (jape (of-wall (wush 160 tag))))
(give-json:abet 500 ~ (wall:enjs (wush 160 tag)))
::
++ get-diff
|= fec/json ^+ ..lens
@ -1880,7 +1882,7 @@
`note`[%g %deal [him our] %dojo %pull ~]
(give-json:abet 200 ~ fec)
::
++ get-quit (give-json:abet 500 ~ (joba %quit b+&))
++ get-quit (give-json:abet 500 ~ (frond:enjs %quit b+&))
--
++ vi :: auth engine
~% %eyre-v ..is ~

View File

@ -2964,6 +2964,16 @@
|= a/^tape
^- json
[%s (crip a)]
:: :: ++wall:enjs:format
++ wall :: string from wall
|= a/^wall
^- json
(tape (of-wall a))
:: :: ++ship:enjs:format
++ ship :: string from ship
|= a/^ship
^- json
(tape (slag 1 (scow %p a)))
:: :: ++numb:enjs:format
++ numb :: number from unsigned
|= a/@u
@ -4562,16 +4572,6 @@
|%
++ base64 [sifo=en-base64 ofis=de-base64]:mime:html
++ bytes [moon=en-mite taco=as-octs tact=as-octt]:mime:html
++ js
=> format ^?
|%
++ joba frond:enjs
++ jobe pairs:enjs
++ jape tape:enjs
++ jone numb:enjs
++ jode time:enjs
--
::
++ xml [print=en-xml parse=de-xml]:html
++ url
=> html ^?