mirror of
https://github.com/tadad/blog.git
synced 2024-09-11 12:55:07 +03:00
better style
This commit is contained in:
parent
e882d40579
commit
64ca1fbd3a
@ -1,13 +1,11 @@
|
||||
|= [[now=@da eny=@uvJ byk=beak] ~ ~]
|
||||
|= [authenticated=? =request:http]
|
||||
^- simple-payload:http
|
||||
:: TODO this code is ugly. Either:
|
||||
:: split this into two generators
|
||||
:: put the logic in a mark
|
||||
=/ turl=tape (trip url.request)
|
||||
=/ turl-len (lent turl)
|
||||
:: TODO all the text parsing here is super ugly, might
|
||||
:: be a better way to do it, but basically just detect
|
||||
:: .md or .html, manipulate the scry-path, add
|
||||
:: proper headers, and that's it.
|
||||
=/ [content-type=@t scry-path=@t]
|
||||
=^ content-type=@t url.request
|
||||
=+ md=(find ".md" turl)
|
||||
?: &(?=(^ md) =((add u.md 3) turl-len))
|
||||
:- 'text/plain; charset=utf-8'
|
||||
@ -18,13 +16,13 @@
|
||||
(crip (weld "/html" (swag [0 (sub turl-len 5)] turl)))
|
||||
(crip (weld "/html" turl))
|
||||
::
|
||||
^- [response-header:http (unit octs)]
|
||||
^- simple-payload:http
|
||||
:- [200 ['Content-Type' content-type]~]
|
||||
%- some
|
||||
%- as-octs:mimes:html
|
||||
.^ @t %gx
|
||||
;: weld
|
||||
/(scot %p p.byk)/blog/(scot r.byk)
|
||||
(rash scry-path stap) /noun
|
||||
(rash url.request stap) /noun
|
||||
==
|
||||
==
|
Loading…
Reference in New Issue
Block a user