urbit/main/pub/fab/dirs/hymn.hook

42 lines
1.2 KiB
Plaintext
Raw Normal View History

2014-08-29 05:28:13 +04:00
:: %clay browser
::
:::: /hook/hymn/dirs/fab/pub
::
/= gas /$ fuel
/= rut /$ |= [a=beam path] ^- [p=path q=path]
[(tope a(s ~)) (flop (slag 1 s.a))]
!:
:::: ~pittyp-pittyp
::
=+ pax=`path`(flop but.gas)
2014-09-02 22:11:37 +04:00
=+ cot=(trip ;;(,@ (fall (file (welp p.rut pax)) '')))
2014-08-29 05:28:13 +04:00
=+ js="""
window.location = "/gen/main{<q.rut>}/" + pax.value
"""
;html
;head:title:"{<pax>}"
;body
;input#pax(onchange js, value (slag 1 <pax>));
2014-09-02 22:11:37 +04:00
;+ =+ ups="%"
|-
?: =(~ pax) ;div:a/"/gen/main{<q.rut>}":"/==="
=: ups "%{ups}"
pax (scag (dec (lent pax)) pax)
==
=+ sul=;;(arch .^(%cy (welp p.rut pax)))
?: (gte 2 ~(wyt by r.sul)) $
;div:a/"/gen/main{<q.rut>}{<pax>}":"{ups}"
::
;* =+ sub=;;(arch .^(%cy (welp p.rut pax)))
=| don=tape
%+ turn (~(tap by r.sub)) |= [a=span ~]
=: don "{don}/{(trip a)}"
pax (welp pax /[a])
==
=+ sus=;;(arch .^(%cy (welp p.rut pax)))
?: =(2 ~(wyt by r.sus)) $(a p.n.-.r.sus)
;div:a/"/gen/main{<q.rut>}{<pax>}":"{(slag 1 don)}"
2014-08-29 05:28:13 +04:00
;pre:"{cot}"
==
==