mirror of
https://github.com/urbit/shrub.git
synced 2024-12-12 10:29:01 +03:00
Various fixes and improvements.
This commit is contained in:
parent
9b865ed8f6
commit
deaa14d27a
126
arvo/eyre.hoon
126
arvo/eyre.hoon
@ -26,9 +26,11 @@
|
||||
++ loco ,[p=? q=(unit ,@tas) r=path] :: logical construct
|
||||
++ pest :: request in progress
|
||||
$| $? %new :: virgin
|
||||
%way :: waiting for %clay
|
||||
== ::
|
||||
$% [%err p=@ud q=(list tank)] :: error report
|
||||
[%fin p=love] :: ready to send
|
||||
[%haz p=riot] :: clay responded
|
||||
[%raw p=hiss] :: wild url
|
||||
== ::
|
||||
++ pimp :: traced request
|
||||
@ -84,7 +86,13 @@
|
||||
%mid [200 ~[content-type/(moon p.luv)] [~ q.luv]]
|
||||
%ham [200 ~[content-type/'text/html'] [~ (tact (xmlt | p.luv ~))]]
|
||||
%raw p.luv
|
||||
%wan !!
|
||||
%wan :+ 200
|
||||
~[content-type/'text/plain']
|
||||
:- ~
|
||||
%- taco
|
||||
%+ rap 3
|
||||
|- ^- (list ,@)
|
||||
?~(p.luv ~ [i.p.luv 10 $(p.luv t.p.luv)])
|
||||
%zap :+ p.luv
|
||||
~[content-type/'text/plain']
|
||||
:- ~
|
||||
@ -201,6 +209,12 @@
|
||||
::
|
||||
%went
|
||||
+.$
|
||||
::
|
||||
%writ
|
||||
?. ?=([%hoot @ @ ~] tea)
|
||||
+.$
|
||||
?> ?=(^ wru)
|
||||
(gout q.u.wru i.t.tea (need (slaw %ud i.t.t.tea)) p.fav)
|
||||
==
|
||||
::
|
||||
++ doss :: host to ship
|
||||
@ -229,6 +243,14 @@
|
||||
fon (~(put by fon) him rot(q.rem (~(del by q.rem.rot) num)))
|
||||
==
|
||||
::
|
||||
++ gout
|
||||
|= [our=ship ses=hole num=@ud rot=riot]
|
||||
^+ +>
|
||||
~& [%gout our ses num]
|
||||
=+ sef=`serf`(need (~(get by own) our))
|
||||
=+ cyz=`cyst`(need (~(get by wup.sef) ses))
|
||||
abet:work:(~(iota ya [our ses] sef cyz) num rot)
|
||||
::
|
||||
++ hajj :: send %pr response
|
||||
|= [him=ship tus=path har=httr]
|
||||
^+ +>
|
||||
@ -263,6 +285,16 @@
|
||||
?: (~(has by fon) who) |
|
||||
!=(~ (sky /a/(scot %p who)/buck/(scot %da now)))
|
||||
::
|
||||
++ hoot :: clay request
|
||||
|= [our=ship num=@ud ses=hole rif=riff]
|
||||
%_ +>
|
||||
mow
|
||||
:_ mow
|
||||
:+ [~ %gold our]
|
||||
[/c [%e %hoot ses (scot %ud num) ~] hen]
|
||||
[%warp our rif]
|
||||
==
|
||||
::
|
||||
++ hork :: remote request
|
||||
|= [him=ship hyx=httx]
|
||||
^+ +>
|
||||
@ -446,6 +478,30 @@
|
||||
[[%$ %t p.i.quy] [%$ %t q.i.quy] $(quy t.quy)]
|
||||
==
|
||||
::
|
||||
++ foin :: version request
|
||||
|= [fur=(unit term) paw=(list ,@t) quy=quay]
|
||||
^- (unit seam)
|
||||
?. ?& ?=(~ fur)
|
||||
?=(~ quy)
|
||||
?=([@ @ ~] paw)
|
||||
((sane %tas) i.t.paw)
|
||||
== ~
|
||||
%+ bind
|
||||
^- (unit moat)
|
||||
=+ soy=(slay i.paw)
|
||||
?~ soy ~
|
||||
?+ u.soy
|
||||
~
|
||||
::
|
||||
[%$ ?(%da %ud %tas) @]
|
||||
[~ (case p.u.soy) (case p.u.soy)]
|
||||
::
|
||||
[%many [%$ ?(%da %ud %tas) @] [%$ ?(%da %ud %tas) @] ~]
|
||||
[~ (case i.p.u.soy) (case i.t.p.u.soy)]
|
||||
==
|
||||
|= mot=moat
|
||||
`seam`[%det i.t.paw mot]
|
||||
::
|
||||
++ funk :: functional request
|
||||
|= [nep=@tas fur=(unit term) paw=(list ,@t) quy=quay]
|
||||
^- (unit seam)
|
||||
@ -459,7 +515,7 @@
|
||||
?. ?=([~ %$ ?(%ud %da %tas) *] zac) ~
|
||||
[~ i.paw t.paw]
|
||||
?: ?| ?=(~ zac)
|
||||
?=(~ q.u.zac)
|
||||
?=(~ q.u.zac)
|
||||
!(levy t.q.u.zac (sane %ta))
|
||||
== ~
|
||||
:+ ~ ?~(fur %html u.fur)
|
||||
@ -500,6 +556,7 @@
|
||||
?= $? %p :: application
|
||||
%c :: console
|
||||
%f :: functional
|
||||
%v :: version
|
||||
%l :: login
|
||||
%n :: now
|
||||
==
|
||||
@ -509,9 +566,33 @@
|
||||
~
|
||||
?- tri
|
||||
?(%f %n) (funk nep p.q.pul paw r.pul)
|
||||
%v (foin p.q.pul paw r.pul)
|
||||
?(%p %c %l) !!
|
||||
==
|
||||
::
|
||||
++ into
|
||||
|= [pul=purl moh=moth]
|
||||
^+ +>
|
||||
=+ num=p.rey
|
||||
%= +>.$
|
||||
p.rey +(num)
|
||||
q.rey
|
||||
%+ ~(put by q.rey) num
|
||||
^- pimp
|
||||
:* !?=(%head p.moh)
|
||||
hen
|
||||
*seam
|
||||
`pest`[%raw pul moh]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ iota :: change response
|
||||
|= [num=@ud rot=riot]
|
||||
^+ +>
|
||||
=+ pip=`pimp`(need (~(get by q.rey) num))
|
||||
?> ?=(%way pez.pip)
|
||||
+>.$(q.rey (~(put by q.rey) num pip(pez [%haz rot])))
|
||||
::
|
||||
++ lace :: load and execute
|
||||
|= [pax=path sam=vase]
|
||||
^- [gank _+>]
|
||||
@ -519,7 +600,13 @@
|
||||
:_ +>.$
|
||||
=+ mud=(need hum)
|
||||
?: ?=(| -.mud) mud
|
||||
(mule |.((slam p.mud sam)))
|
||||
=+ typ=(~(play ut [%cell p.p.mud p.sam]) [%cncl [~ 2] [~ 3]])
|
||||
=+ ton=(mong [q.p.mud q.sam] sky)
|
||||
?- -.ton
|
||||
%0 [%& typ p.ton]
|
||||
%1 [%| (turn p.ton |=(a=* (smyt (path a))))]
|
||||
%2 [%| p.ton]
|
||||
==
|
||||
::
|
||||
++ lack :: probe/load
|
||||
|= pax=path
|
||||
@ -780,6 +867,8 @@
|
||||
=^ mun +>.$ (lobo for pre p.u.gun)
|
||||
[[~ mun] +>.$]
|
||||
::
|
||||
++ moil :: filter search
|
||||
::
|
||||
++ step :: step in work
|
||||
|- ^+ +
|
||||
=^ zib +.$
|
||||
@ -788,17 +877,24 @@
|
||||
?~ yub [~ +.^$]
|
||||
=^ sin +.^$ $(yub l.yub)
|
||||
=^ dex +.^$ $(yub r.yub)
|
||||
=^ top +.^$ (wink q.n.yub)
|
||||
=^ top +.^$ (wink n.yub)
|
||||
=+ pot=`(list ,[p=@ud q=pimp])`?~(top ~ [[p.n.yub u.top] ~])
|
||||
[:(weld pot dex sin) +.^$]
|
||||
+.$(q.rey (~(gas by `_q.rey`~) zib))
|
||||
::
|
||||
++ wink :: advance request
|
||||
|= pip=pimp
|
||||
|= [num=@ud pip=pimp]
|
||||
^- [(unit pimp) _+>]
|
||||
?- pez.pip
|
||||
%way [[~ pip] +>.$]
|
||||
%new
|
||||
?- -.som.pip
|
||||
%det
|
||||
~& [%wink-det som.pip num ses]
|
||||
:- [~ pip(pez %way)]
|
||||
=+ rif=`riff`[p.som.pip ~ [%| q.som.pip]]
|
||||
+>.$(..ya (hoot our num ses rif))
|
||||
::
|
||||
%fun
|
||||
=^ syt +>.$ (lude p.som.pip q.som.pip)
|
||||
:_ +>.$
|
||||
@ -822,6 +918,10 @@
|
||||
=+ har=(loft p.pez.pip)
|
||||
=. q.har (weld (turn cug |=(a=@t ['set-cookie' a])) q.har)
|
||||
[~ +>.$(..ya (muff [%thou har]))]
|
||||
::
|
||||
[%haz *]
|
||||
:_ +>.$
|
||||
[~ pip(pez [%fin %wan 'Hello, world' ~])]
|
||||
::
|
||||
[%raw *]
|
||||
:_ +>.$
|
||||
@ -838,22 +938,6 @@
|
||||
=+ sez=step
|
||||
?: =(rey.sez rey) sez
|
||||
$(+ sez)
|
||||
::
|
||||
++ into
|
||||
|= [pul=purl moh=moth]
|
||||
^+ +>
|
||||
=+ num=p.rey
|
||||
%= +>.$
|
||||
p.rey +(num)
|
||||
q.rey
|
||||
%+ ~(put by q.rey) num
|
||||
^- pimp
|
||||
:* !?=(%head p.moh)
|
||||
hen
|
||||
*seam
|
||||
`pest`[%raw pul moh]
|
||||
==
|
||||
==
|
||||
--
|
||||
--
|
||||
--
|
||||
|
@ -6610,7 +6610,7 @@
|
||||
;~(pfix lus (stag %b ;~(pfix gap tall)))
|
||||
;~(pfix tar (stag %c ;~(pfix gap tall)))
|
||||
;~(pfix cen (stag %d ;~(pfix gap tall)))
|
||||
(easy [%f [%a [%smdq " "]] ~])
|
||||
(easy [%f [%a [%smdq 10 ~]] ~])
|
||||
==
|
||||
::
|
||||
++ bat :: wide outer top
|
||||
@ -6675,22 +6675,22 @@
|
||||
(easy ~)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ hoy :: tall attributes
|
||||
%- star
|
||||
;~ pfix ;~(plug gap tis)
|
||||
;~ plug
|
||||
(stag %dtzz (stag %tas sym))
|
||||
;~(pfix gap tall)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ hul :: tall preface
|
||||
%+ cook
|
||||
|= [a=[p=twig q=(list twig)] b=(list twig) c=(list tuna)]
|
||||
^- [twig (list tuna)]
|
||||
[[p.a %clsg (weld q.a b)] c]
|
||||
;~ plug
|
||||
hog
|
||||
%+ more gap
|
||||
;~ pfix tis
|
||||
;~ plug
|
||||
(stag %dtzz (stag %tas sym))
|
||||
;~(pfix gap tall)
|
||||
==
|
||||
==
|
||||
nol
|
||||
==
|
||||
;~(plug hog hoy nol)
|
||||
::
|
||||
++ jaw :: wide attributes
|
||||
;~ pose
|
||||
@ -6713,7 +6713,13 @@
|
||||
%+ cook |=(a=(list tuna) a)
|
||||
%+ ifix [gap ;~(plug gap duz)]
|
||||
%+ most gap
|
||||
;~(pfix ;~(plug sem ace) (stag %a (stag %smdq (star (shim 32 255)))))
|
||||
;~ pfix
|
||||
;~(plug sem ace)
|
||||
%+ cook
|
||||
|= a=tape
|
||||
[%a %smdq (weld a `tape`[`@`10 ~])]
|
||||
(star (shim 32 255))
|
||||
==
|
||||
::
|
||||
++ nol :: tall tail
|
||||
?> tol
|
||||
@ -6772,7 +6778,7 @@
|
||||
?~ reb
|
||||
=. sim
|
||||
?. tol sim
|
||||
[32 |-(?~(sim sim ?:(=(32 i.sim) $(sim t.sim) sim)))]
|
||||
[10 |-(?~(sim sim ?:(=(32 i.sim) $(sim t.sim) sim)))]
|
||||
?~(sim tuz [[%a %smdq (flop sim)] tuz])
|
||||
?@ i.reb
|
||||
$(reb t.reb, sim [i.reb sim])
|
||||
|
@ -561,7 +561,6 @@
|
||||
++ tact :: tape to octstream
|
||||
|= tep=tape ^- octs
|
||||
(taco (rap 3 tep))
|
||||
|
||||
::
|
||||
++ tell :: wall to octstream
|
||||
|= wol=wall ^- octs
|
||||
@ -1099,6 +1098,59 @@
|
||||
:- p.pok
|
||||
[i.rax q.pok]
|
||||
::
|
||||
++ gist :: html with now
|
||||
|= yax=$+(epic marl)
|
||||
%- give
|
||||
|= piq=epic
|
||||
^- manx
|
||||
=+ ^= sip
|
||||
|= mal=marl
|
||||
?~(mal ~ ?.(|(=(:/(~) i.mal) =(:/([10 ~]) i.mal)) mal $(mal t.mal)))
|
||||
=+ zay=`marl`(yax piq)
|
||||
=. zay (sip zay)
|
||||
=+ ^= twa
|
||||
|- ^- [p=marl q=marl]
|
||||
?~ zay [~ ~]
|
||||
?: ?=([[[%head *] *] *] zay)
|
||||
[c.i.zay ?:(?=([[[%body *] *] ~] t.zay) c.i.t.zay t.zay)]
|
||||
?: ?=([[[%title *] *] *] zay)
|
||||
[[i.zay ~] t.zay]
|
||||
[~ zay]
|
||||
=. q.twa ^- marl
|
||||
?. =(%n (cut 3 [2 1] nep.piq)) q.twa
|
||||
=- =+ pey=(cat 3 (end 3 2 nep.piq) %v)
|
||||
=+ ven=+((,@ .^(%cw pos.piq)))
|
||||
=+ ^= cal :/
|
||||
"call('".
|
||||
"/{+:(scow %p own.piq)}".
|
||||
"/{(trip pey)}".
|
||||
"/{(scow %ud ven)}".
|
||||
"/{(trip q.pos.piq)}');"
|
||||
~& [%ven ven %call cal]
|
||||
(weld q.twa `marl`[[-.sac (weld `marl`+.sac `marl`[cal ~])] ~])
|
||||
^= sac
|
||||
;script
|
||||
; tries = 0;
|
||||
; call = function(path) {
|
||||
; xhr = new XMLHttpRequest();
|
||||
; xhr.open('GET', path, true);
|
||||
; xhr.addEventListener('load', function() {
|
||||
; if(this.status !== 200) {
|
||||
; return keep();
|
||||
; }
|
||||
; document.location.reload();
|
||||
; });
|
||||
; xhr.addEventListener('error', keep);
|
||||
; xhr.addEventListener('abort', keep);
|
||||
; xhr.send();
|
||||
; }
|
||||
; keep = function() {
|
||||
; setTimeout(call,1000*tries);
|
||||
; tries++;
|
||||
; }
|
||||
==
|
||||
[/html [/head p.twa] [/body q.twa] ~]
|
||||
::
|
||||
++ give !: :: web synthesizer
|
||||
|* yax=$+(epic *)
|
||||
|= [for=@tas pre=path suf=path but=path]
|
||||
@ -2236,6 +2288,7 @@
|
||||
++ seam :: logical request
|
||||
$% :: [%app p=seep] :: application
|
||||
:: [%con p=seer] :: console
|
||||
[%det p=disc q=moat] :: load changes
|
||||
[%fun p=term q=tube] :: functional
|
||||
:: [%log p=seal] :: login
|
||||
== ::
|
||||
|
@ -1,49 +1,57 @@
|
||||
!:
|
||||
:: Some uses of template syntax
|
||||
::
|
||||
%- give
|
||||
%- gist
|
||||
|= epic
|
||||
^- manx
|
||||
^- marl
|
||||
=+ lim=;li:"second ;{a/funky."http://www.urbit.org" "link"} item"
|
||||
=+ lum=;li:"third [owner: {(scow %p own)}] item"
|
||||
=+ lom=;li:"fourth (;{i "italics"}) item"
|
||||
=+ bar=;br;
|
||||
=+ foo=`manx`i/;"foobar"
|
||||
=+ foo=`manx`i/;"foobarz"
|
||||
=+ lam=`(list manx)`[lim lum lom ~]
|
||||
;html
|
||||
;head
|
||||
;title: Urbi et Gorby
|
||||
==
|
||||
;body
|
||||
;p: Hello, world.
|
||||
;p:"Hello"
|
||||
;- "Goodbye"
|
||||
;+ ;p:"Hello again"
|
||||
;* ~[;p:"One" ;p:"Two" ;p:"Three"]
|
||||
;br;
|
||||
;p: Behold a <p>aragraph with an embedded {"string"}.
|
||||
;p: Or an embedded ;{i "tag"}.
|
||||
;p: Or even a *{;i:"list" ;i:" of" ;i:" tags" ~},
|
||||
;p: Sometimes %{|*(a=* [;i:"functionally " ;i:"applied" a])}.
|
||||
;p: It's nice to just be able to use "quotes."
|
||||
; Now, some flow at the same level
|
||||
; as the paragraph tag above;
|
||||
; it is fun to flow along,
|
||||
;a."http://www.urbit.org": with fun links
|
||||
;
|
||||
; ;{a."http://www.urbit.org" "and more fun links,"}
|
||||
; or without,
|
||||
; but not accepting any kind of trailing whitespace
|
||||
;p
|
||||
; We are also very good at lists:
|
||||
;ul
|
||||
;li: first item
|
||||
;* lam
|
||||
;li: last item
|
||||
==
|
||||
;=
|
||||
;title: Hi again!
|
||||
;
|
||||
;p: Hello, world.
|
||||
;p:"Hello: pos is {<pos>}"
|
||||
;- "Goodbye"
|
||||
;+ ;p:"Hello again"
|
||||
;* ~[;p:"One" ;p:"Two" ;p:"Three"]
|
||||
;br;
|
||||
;p: Let's add some more stuff and just type
|
||||
;p: of text! It could definitely be snappier, jowever!
|
||||
;p: Behold a <p>aragraph with an embedded {"string"}.
|
||||
;p: Or an embedded ;{i "tag"}.
|
||||
;p: Or even a *{;i:"list" ;i:" of" ;i:" tags" ~},
|
||||
;p: Sometimes %{|*(a=* [;i:"functionally " ;i:"applied" a])}.
|
||||
;p: It's nice to just be able to use "quotes." Maybe it works!
|
||||
; Now, some flow at the same level or above
|
||||
; I'm going to write some more text
|
||||
; as the paragraph tag
|
||||
; it is fun to flow along,
|
||||
;a."http://www.urbit.org": with
|
||||
;
|
||||
; ;{a."http://www.urbit.org" "and more fun links,"}
|
||||
; or without,
|
||||
; but not accepting any kind of trailing whitespace
|
||||
;p
|
||||
; We are also very good at random odd foo lists:
|
||||
;ul
|
||||
;li: first item
|
||||
;* lam
|
||||
;li: last item
|
||||
==
|
||||
:: ;script
|
||||
:: ; alert("I am not an alert box!");
|
||||
:: ==
|
||||
==
|
||||
;p
|
||||
; And we can also do
|
||||
;pre
|
||||
; preformatted text?
|
||||
; in lines?
|
||||
; with linebreaks!
|
||||
==
|
||||
==
|
||||
:: ;script
|
||||
:: ; alert("I am not an alert box!");
|
||||
:: ==
|
||||
==
|
||||
|
Loading…
Reference in New Issue
Block a user