mirror of
https://github.com/tadad/blog.git
synced 2024-09-11 12:55:07 +03:00
Merge branch 'master' into cache
This commit is contained in:
commit
a03817b66d
21
README.md
21
README.md
@ -14,11 +14,26 @@
|
|||||||
Install %blog with
|
Install %blog with
|
||||||
|
|
||||||
```
|
```
|
||||||
|install ~hanrut-sillet-dachus-tiprel blog
|
|install ~hanrut-sillet-dachus-tiprel %blog
|
||||||
```
|
```
|
||||||
|
|
||||||
## Export
|
## Export
|
||||||
|
If you want to move your blog to another Urbit, run `:blog|export %.y`. If you want to serve your blog from a normal server, run `:blog|export %.n`. The file format for each of these cases is slightly different.
|
||||||
|
|
||||||
You can export your %blog with `:blog|export` in the dojo. This will create a folder inside your blog desk called `/export`.
|
To see it, ensure you have mounted the blog desk with `|mount %blog`, and it will appear in unix.
|
||||||
|
|
||||||
To see it, ensure you have mounted the blog desk with `|mount %blog`.
|
## Import
|
||||||
|
|
||||||
|
After an export (or if you have files from elsewhere), you can import files into %blog. First make sure they have the same structure as an export, it should look something like this in your desk:
|
||||||
|
|
||||||
|
```
|
||||||
|
/blog
|
||||||
|
/import
|
||||||
|
/published
|
||||||
|
/md
|
||||||
|
/html
|
||||||
|
/drafts
|
||||||
|
/themes
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run `-blog!import` in the dojo.
|
||||||
|
@ -147,7 +147,7 @@
|
|||||||
++ on-peek
|
++ on-peek
|
||||||
|= =path
|
|= =path
|
||||||
^- (unit (unit cage))
|
^- (unit (unit cage))
|
||||||
?+ path (on-peek:def path)
|
?+ path ~& "unexpected scry into {<dap.bowl>} on path {<path>}" ~
|
||||||
::
|
::
|
||||||
[%x %md ^] ``blog+!>(+<:(~(got by files) t.t.path)) :: TODO bad practice
|
[%x %md ^] ``blog+!>(+<:(~(got by files) t.t.path)) :: TODO bad practice
|
||||||
[%x %html ^] ``blog+!>(-:(~(got by files) t.t.path))
|
[%x %html ^] ``blog+!>(-:(~(got by files) t.t.path))
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
:- %say
|
:- %say
|
||||||
|= *
|
:: css is whether to append the css to exported html in <style> tags
|
||||||
|
|= [[*] [css=? ~] ~]
|
||||||
:- %blog-action
|
:- %blog-action
|
||||||
[%export ~]
|
[%export css]
|
@ -25,7 +25,7 @@
|
|||||||
++ add-style
|
++ add-style
|
||||||
|= css=@t
|
|= css=@t
|
||||||
^- @t
|
^- @t
|
||||||
(cat 3 (cat 3 '<style>' css) '<style/>')
|
(cat 3 (cat 3 '<style>' css) '</style>')
|
||||||
::
|
::
|
||||||
++ http-response-cards
|
++ http-response-cards
|
||||||
|= [id=@tas hed=response-header:http data=(unit octs)]
|
|= [id=@tas hed=response-header:http data=(unit octs)]
|
||||||
|
1
lib/strandio.hoon
Symbolic link
1
lib/strandio.hoon
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../base-dev/lib/strandio.hoon
|
@ -1 +0,0 @@
|
|||||||
../../arvo/mar/noun.hoon
|
|
22
mar/noun.hoon
Normal file
22
mar/noun.hoon
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
::
|
||||||
|
:::: /hoon/noun/mar
|
||||||
|
::
|
||||||
|
/? 310
|
||||||
|
!:
|
||||||
|
|_ non=*
|
||||||
|
++ grab |%
|
||||||
|
++ noun *
|
||||||
|
++ mime |=([p=mite q=octs] (cue q.q))
|
||||||
|
--
|
||||||
|
++ grow |%
|
||||||
|
++ mime [/application/octet-stream (as-octs:mimes:html (jam non))]
|
||||||
|
--
|
||||||
|
++ grad
|
||||||
|
|%
|
||||||
|
++ form %noun
|
||||||
|
++ diff |=(* +<)
|
||||||
|
++ pact |=(* +<)
|
||||||
|
++ join |=([* *] *(unit *))
|
||||||
|
++ mash |=([[ship desk *] [ship desk *]] `*`~|(%noun-mash !!))
|
||||||
|
--
|
||||||
|
--
|
@ -2,7 +2,7 @@
|
|||||||
+$ action
|
+$ action
|
||||||
$% [%publish =path html=@t md=@t theme=@tas]
|
$% [%publish =path html=@t md=@t theme=@tas]
|
||||||
[%unpublish =path]
|
[%unpublish =path]
|
||||||
[%export ~]
|
[%export css=?]
|
||||||
[%save-draft =path md=@t]
|
[%save-draft =path md=@t]
|
||||||
[%delete-draft =path]
|
[%delete-draft =path]
|
||||||
[%save-theme theme=@tas css=@t]
|
[%save-theme theme=@tas css=@t]
|
||||||
|
82
ted/import.hoon
Normal file
82
ted/import.hoon
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/- spider, blog
|
||||||
|
/+ *strandio
|
||||||
|
=, strand=strand:spider
|
||||||
|
=, strand-fail=strand-fail:libstrand:spider
|
||||||
|
^- thread:spider
|
||||||
|
|= arg=vase
|
||||||
|
=/ m (strand ,vase)
|
||||||
|
^- form:m
|
||||||
|
;< our=@p bind:m get-our
|
||||||
|
;< now=@da bind:m get-time
|
||||||
|
=/ files-path=path /(scot %p our)/blog/(scot %da now)/import
|
||||||
|
=/ files=(axal *)
|
||||||
|
|-
|
||||||
|
=+ .^(=arch %cy files-path)
|
||||||
|
?: (test dir.arch ~)
|
||||||
|
=/ mark
|
||||||
|
?+ (rear files-path) !!
|
||||||
|
%md wain
|
||||||
|
%html @t
|
||||||
|
%css @t
|
||||||
|
%noun noun
|
||||||
|
==
|
||||||
|
:- [~ .^(mark %cx files-path)]
|
||||||
|
(~(urn by dir.arch) |=([name=@ta ~] ^$(files-path (snoc files-path name))))
|
||||||
|
:- fil.arch
|
||||||
|
(~(urn by dir.arch) |=([name=@ta ~] ^$(files-path (snoc files-path name))))
|
||||||
|
::
|
||||||
|
=| $= imp
|
||||||
|
$: pub=(map path [html=@t md=@t theme=@tas])
|
||||||
|
dra=(map path md=@t)
|
||||||
|
thm=(map @tas css=@t)
|
||||||
|
==
|
||||||
|
=. imp
|
||||||
|
=/ all-files ~(tap of files)
|
||||||
|
|-
|
||||||
|
?~ all-files imp
|
||||||
|
%. i.all-files
|
||||||
|
|= [=path content=*]
|
||||||
|
%= ^$
|
||||||
|
all-files t.all-files
|
||||||
|
imp
|
||||||
|
?+ (rear path) imp
|
||||||
|
%md
|
||||||
|
=+ content=(of-wain:format ((list cord) content))
|
||||||
|
?: ?=(%published (snag 0 path))
|
||||||
|
=/ file-name (oust [0 2] (snip path))
|
||||||
|
=/ file (~(gut by pub.imp) file-name [html='' md='' theme=%default])
|
||||||
|
imp(pub (~(put by pub.imp) file-name file(md content)))
|
||||||
|
=/ draft-name (oust [0 1] (snip path))
|
||||||
|
=/ draft (~(gut by dra.imp) draft-name [md=''])
|
||||||
|
imp(dra (~(put by dra.imp) draft-name draft(md content)))
|
||||||
|
::
|
||||||
|
%css
|
||||||
|
=/ theme-name (@tas (rear (oust [0 1] (snip path))))
|
||||||
|
=/ theme (~(gut by thm.imp) theme-name [css=''])
|
||||||
|
imp(thm (~(put by thm.imp) theme-name theme(css (@t (@tas content)))))
|
||||||
|
::
|
||||||
|
%html
|
||||||
|
=/ file-name (oust [0 2] (snip path))
|
||||||
|
=/ file (~(gut by pub.imp) file-name [html='' md='' theme=%default])
|
||||||
|
imp(pub (~(put by pub.imp) file-name file(html (@t (@tas content)))))
|
||||||
|
==
|
||||||
|
==
|
||||||
|
=/ thm-map ;; (map path @tas)
|
||||||
|
.^(noun %cx /(scot %p our)/blog/(scot %da now)/import/published/meta/noun)
|
||||||
|
=/ act |=(=vase [%pass /poke %agent [our %blog] %poke %blog-action vase])
|
||||||
|
;< ~ bind:m
|
||||||
|
%- send-raw-cards
|
||||||
|
%- zing
|
||||||
|
:~ %+ turn ~(tap by pub.imp)
|
||||||
|
|= [=path html=@t md=@t theme=@tas]
|
||||||
|
(act !>([%publish path html md (~(gut by thm-map) path %default)]))
|
||||||
|
::
|
||||||
|
%+ turn ~(tap by dra.imp)
|
||||||
|
|= [=path md=@t]
|
||||||
|
(act !>([%save-draft path md]))
|
||||||
|
::
|
||||||
|
%+ turn ~(tap by thm.imp)
|
||||||
|
|= [theme=@tas css=@t]
|
||||||
|
(act !>([%save-theme theme css]))
|
||||||
|
==
|
||||||
|
(pure:m !>(~))
|
Loading…
Reference in New Issue
Block a user