ability to serve md added

This commit is contained in:
dachus 2023-02-16 11:38:22 -06:00
parent 32c04919ef
commit d821feec79
9 changed files with 45 additions and 33 deletions

View File

@ -41,8 +41,9 @@
^- (unit (unit cage))
?+ path ~
::
[%x %md ^] ``json+!>([%s q:(~(got by files) t.t.path)])
[%x %html ^] ``noun+!>(p:(~(got by files) t.t.path))
[%x %md ^] ``blog+!>(q:(~(got by files) t.t.path))
[%x %html ^] ``blog+!>(p:(~(got by files) t.t.path))
::
[%x %pages ~]
:^ ~ ~ %json
!> :- %a

View File

@ -1,15 +1,24 @@
|= [[now=@da eny=@uvJ byk=beak] ~ ~]
|= [authenticated=? =request:http]
^- simple-payload:http
=* data
%- as-octs:mimes:html
.^ @t
%gx
;: weld
/(scot %p p.byk)/blog/(scot r.byk)/html
(pa:dejs:format [%s url.request])
/noun
==
==
:_ `(unit octs)``data
`response-header:http`[200 ['Content-Type' 'text/html; charset=utf-8']~]
=/ turl=tape (trip url.request)
=/ turl-len (lent turl)
=/ scry-path=@t
=+ md=(find ".md" turl)
?: &(?=(^ md) =((add u.md 3) turl-len))
(crip (weld "/md" (swag [0 (sub turl-len 3)] turl)))
=+ html=(find ".html" turl)
?: &(?=(^ html) =((add u.html 5) turl-len))
(crip (weld "/html" (swag [0 (sub turl-len 5)] turl)))
(crip (weld "/html" turl))
::
^- [response-header:http (unit octs)]
:- [200 ['Content-Type' 'text/html; charset=utf-8']~]
%- some
%- as-octs:mimes:html
.^ @t %gx
;: weld
/(scot %p p.byk)/blog/(scot r.byk)
(rash scry-path stap) /noun
==
==

1
lib/dbug.hoon Symbolic link
View File

@ -0,0 +1 @@
../../arvo/lib/dbug.hoon

1
lib/default-agent.hoon Symbolic link
View File

@ -0,0 +1 @@
../../arvo/lib/default-agent.hoon

1
lib/skeleton.hoon Symbolic link
View File

@ -0,0 +1 @@
../../arvo/lib/skeleton.hoon

View File

@ -1,19 +0,0 @@
|_ bind=(list [binding:eyre duct action:eyre])
::
++ grab
|%
++ noun (list [binding:eyre duct action:eyre])
--
::
++ grow
|%
++ noun bind
++ json
:- %a
%+ turn bind
|= [=binding:eyre duct action:eyre]
(path:enjs:format path.binding)
--
::
++ grad %noun
--

16
mar/blog.hoon Normal file
View File

@ -0,0 +1,16 @@
:: Realy all unix/mime stuff should look something like this but w/e
::
|_ txt=@t
::
++ grab
|%
++ mime |=((pair mite octs) (@t q.q))
++ noun @t
--
++ grow
|%
++ mime [/text/plain (as-octs:mimes:html txt)]
++ json [%s txt]
--
++ grad %mime
--

1
mar/noun.hoon Symbolic link
View File

@ -0,0 +1 @@
../../arvo/mar/noun.hoon

1
mar/ship.hoon Symbolic link
View File

@ -0,0 +1 @@
../../arvo/mar/ship.hoon