add json translation for frontend use

This commit is contained in:
Anton Dyudin 2016-03-28 15:36:59 -07:00
parent b886daf7c0
commit 730af1b93f
5 changed files with 19 additions and 4 deletions

View File

@ -16,10 +16,20 @@
:+ (cat 3 'User ' ?~(who 'of Urbit' who))
(cat 3 'Location ' (moon ?~(loc /unknown loc)))
%+ turn (sort (~(tap by acc)) aor)
|= {a/knot b/iden c/(unit purf)} ^- cord
|= {a/knot b/plan-acct} ^- cord
%+ rap 3
:^ a ': ' b
?~(c ~ [', ' (earf u.c)])
:^ a ': ' usr.b
?~(url.b ~ [', ' (earf u.url.b)])
::
++ plan-json
%- jobe :~
who+?~(who ~ s+who)
loc+?~(loc ~ s+(moon 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))) ~)
--
++ grab |% :: convert from
++ noun {{cord govt} (map knot plan-acct)} :: clam from %noun

View File

@ -9,6 +9,7 @@
/= sect /&json&/tree-index/
/= snip /&snip&elem&/tree-elem/
/= meta /&json&front&/|(/front/ /~[~])
/= plan /^ json /|(/plan-json/ /~[~])
/= comt /&json&/tree-comments/
!:
^- tree-include
@ -20,4 +21,5 @@
meta
sect
comt
plan
==

View File

@ -21,6 +21,7 @@
{$spur $t}
::
{$comt $j}
{$plan $j}
{$head $r}
{$sect $j}
{$snip $r}
@ -53,6 +54,7 @@
$name (from-type +.a ?^(s.bem i.s.bem q.bem))
$path (from-type +.a (crip (spud (flop s.bem))))
$spur (from-type +.a (crip (spud s.bem)))
$plan (from-type +.a plan.dat)
$comt (from-type +.a comt.dat)
$head (from-type +.a head.dat)
$snip (from-type +.a snip.dat)

View File

@ -1 +1 @@
{iden (unit purf)}
{usr/iden url/(unit purf)}

View File

@ -10,4 +10,5 @@ $: mime/mime
meta/json
sect/json
comt/json
plan/json
==