Merge branch 'factor' of github.com:ohAitch/urbit into factor

Conflicts:
	urb/zod/web/tree/main.js

(had a newer main.js)

talk@26b0befe86
tree@621235bf52
This commit is contained in:
Galen Wolfe-Pauly 2016-02-04 16:16:18 -08:00
commit 2a95c443ed
13 changed files with 74 additions and 22 deletions

View File

@ -127,6 +127,7 @@
++ poke-kiln-overload (wrap poke-overload):from-kiln
++ poke-kiln-unmount (wrap poke-unmount):from-kiln
++ poke-kiln-unsync (wrap poke-unsync):from-kiln
++ poke-write-comment (wrap poke-comment):from-write
++ poke-write-paste (wrap poke-paste):from-write
++ poke-write-tree (wrap poke-tree):from-write
++ poke-write-wipe (wrap poke-wipe):from-write

View File

@ -48,6 +48,12 @@
|= [typ=?(%hoon %md %txt) txt=@t] ^+ abet
(poke--data [`typ /web/paste/(scot %da now)] %mime / (taco txt))
::
++ poke-comment
|= [pax=path txt=@t] ^+ abet
=. pax [%web (welp pax /(scot %da now))]
=. txt (rap 3 (scot %p src) ': ' txt ~)
(poke--data [`%comment-md pax] %mime / (taco txt))
::
++ poke--data
|= [[ext=(unit ,@t) pax=path] dat=data] ^+ abet
?~ ext $(ext [~ -.dat])
@ -59,8 +65,8 @@
::
++ made
|= [pax=wire @ res=gage] ^+ abet
?. =(our src)
~|(foreign-write/[our=our src=src] !!)
:: ?. =(our src)
:: ~|(foreign-write/[our=our src=src] !!)
?+ -.res ~|(gage/-.res !!)
%| (mean p.res)
%& =- abet:(emit %info write/~ our -)

6
mar/comment-md.hoon Normal file
View File

@ -0,0 +1,6 @@
::
:::: /hoon/core/md/pro
::
/? 314
::
// /===/mar/md :: alias

View File

@ -9,7 +9,6 @@
++ hymn ;html:(head body:"+{own}") :: convert to %hymn
++ html (crip (poxo hymn)) :: convert to %html
++ mime [/text/html (taco html)] :: convert to %mime
++ front ~ :: no frontmatter
--
++ garb /snip :: grabbed by
++ grab |% :: convert from

12
mar/write/comment.hoon Normal file
View File

@ -0,0 +1,12 @@
::
:::: /hoon/core/save/mar
::
!:
|_ [pax=path txt=@t]
++ grab
|%
++ noun ,[path @t]
++ json
(corl need =>(jo (ot pax/(su fel:stab) txt/so ~)))
--
--

View File

@ -3,10 +3,19 @@
/= body /tree-elem/
/= sect /tree-index/
/= snip /&snip&elem&/tree-elem/
/= meta /&front&elem&/tree-elem/
/= meta /^ (map span cord) /|(/front/ /~[~])
/= comt /^ (list (pair time manx))
/@ /&elem&md&mime&/comment-md/
!:
^- tree-include
=+ rj=react-to-json:react
=+ fj=|=(atr=(map span span) [%o (~(run by atr) |=(a=span s/a))])
=+ ij=(map-to-json:tree |=(a=path (crip (spud a))) |=(a=marl [%a (turn a rj)]))
[mime (rj body) (rj /h1 hed.snip) (rj /div tal.snip) (fj meta) (ij sect)]
=+ cj=|=([a=time b=manx] (jobe time/(jode a) body/(rj b) ~))
:* mime
(rj body)
(rj /h1 hed.snip) :: head
(rj /div tal.snip) :: snip
[%o (~(run by meta) |=(a=span s/a))]
(ij sect)
[%a (turn (sort comt lor) cj)]
==

View File

@ -3,8 +3,11 @@
/- tree-include
/= dat /% /tree-json/ :: default include
/= tub /$ |=([bem=beam *] (flop s.bem))
/= aut /; |=(gas=epic (~(has ju aut.ced.gas) %$ (scot %p p.bem.gas)))
/$ fuel
/= aut
/$ %+ cork fuel :: after parsing params,
|= gas=epic ^- ? :: check that the fcgi
%+ lien (~(tap in (~(get ju aut.ced.gas) %$))) :: has an identity
|=(a=span !=(%pawn (slav %p a))) :: which isn't a comet
::
!:
::::
@ -31,8 +34,8 @@
;script(type "text/javascript", src "/tree/main.js");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/".
"codemirror/4.3.0/mode/markdown/markdown.min.js");
;* ?. aut ~
[;script(type "text/javascript", src "/~/as/own/~/at/lib/js/urb.js");]~
;script(type "text/javascript", src "{?.(aut "" "/~~")}".
"/~/at/lib/js/urb.js");
==
;body
;script(type "text/javascript"): window.tree = {(pojo (joba %data dat))}
@ -43,4 +46,4 @@
==
==
==
==
==

View File

@ -18,9 +18,11 @@
[%name %t]
[%path %t]
[%spur %t]
::
[%comt %j]
[%head %r]
[%sect %j]
[%snip %r]
[%head %r]
[%body %r]
[%meta %j]
[%mime %m]
@ -52,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)))
%comt (from-type +.a comt.dat)
%head (from-type +.a head.dat)
%snip (from-type +.a snip.dat)
%sect (from-type +.a sect.dat)
@ -69,7 +72,8 @@
::
[tree .]
^- json
=+ default='spur.t_mime.m_body.r_comt.j_kids.name.t'
=+ ^= schem
=+ seh=(fall (~(get by qix.gas) 'q') 'spur.t_mime.m_body.r_kids.name.t')
=+ seh=(fall (~(get by qix.gas) 'q') default)
~|(bad-noun/seh ;;(schema (rash seh read-schem)))
(from-queries bem.gas(s but.gas) (to-queries schem))

View File

@ -5,4 +5,5 @@ $: mime=mime
snip=json
meta=json
sect=json
comt=json
==

14
web.md
View File

@ -1,3 +1,15 @@
---
anchor: none
---
# Hello.
Nice day today, isn't it?
<hr></hr>
## <a class="red" href="/~~/talk">Talk</a>
## <a class="green" href="/~~/dojo">Dojo</a>
<hr></hr>
## <a class="blue" href="/static">Static files</a>

View File

@ -282,14 +282,12 @@ window.urb.util = {
if(spur === '/') spur = ''
pathname = pathname || window.location.pathname
if(pathname[0] == '/') pathname = pathname.slice(1)
if(pathname[0] != '~' && pathname[0] != '='){
return spur
}
pathname = pathname.split("/")
var pref, pred, prec, base = ""
while(base += "/"+(pref = pathname.shift()), pathname.length>0){
if(pref[0] !== '~') break;
while(pref = pathname.shift(), pathname.length>0){
if(pref[0] != '~' && pref[0] != '=') break;
base += "/"+pref;
if(pref === "~~") continue;
base += "/"+(pred = pathname.shift())
if(/[a-z\-]+/.test(pref.slice(1))){

View File

@ -1,5 +1,5 @@
# Static
You can put static files in here to serve them to the web. Actually, you can put static files anywhere in `/web`.
You can put static files in here to serve them to the web. Actually, you can put static files anywhere in `/web` and see them in a browser.
Docs on static publishing with urbit are forthcoming — but feel free to drop markdown files in `/web/static` to try it out.
Docs on static publishing with urbit are forthcoming — but feel free to drop markdown files in `/web` to try it out.

View File

@ -690,6 +690,7 @@ module.exports = React.createFactory(recl({
displayName: "Dpad",
renderUp: function() {
if (this.props.sein) {
console.log(util.basepath(this.props.sein));
return this.renderArrow("up", this.props.sein);
}
},
@ -2066,7 +2067,7 @@ module.exports = {
path = "/" + path;
}
_path = prefix + path;
if (_path.slice(-1) === "/") {
if (_path.slice(-1) === "/" && _path.length > 1) {
_path = _path.slice(0, -1);
}
return _path;