fix: address pr comments

This commit is contained in:
morelazers 2023-04-25 15:20:14 +02:00
parent 21abd5c6c3
commit df25fd1be1
4 changed files with 44 additions and 51 deletions

View File

@ -146,10 +146,6 @@
[%pass /info %arvo %c %info %blog %& soba-css]
[%pass /info %arvo %c %info %blog %& soba-meta]
==
::
%import
:_ this
[%pass /result %arvo %k %fard q.byk.bowl %import %import !>(act)]~
::
%save-draft `this(drafts (~(put by drafts) [path md]:act))
%delete-draft `this(drafts (~(del by drafts) path.act))

View File

@ -1,10 +0,0 @@
:- %say
|= *
[%blog-action %import ~]
:: |-
:: :: IF we are done with all the files, return: (pure:m !>(~))
:: :: ELSE, construct the next poke, and poke like this, see below
:: ;< ~ bind:m (poke-our %blog !>([%publish path html md theme]))

View File

@ -3,7 +3,6 @@
$% [%publish =path html=@t md=@t theme=@tas]
[%unpublish =path]
[%export css=?]
[%import ~]
[%save-draft =path md=@t]
[%delete-draft =path]
[%save-theme theme=@tas css=@t]

View File

@ -9,10 +9,9 @@
;< our=@p bind:m get-our
;< now=@da bind:m get-time
=/ files-path=path /(scot %p our)/blog/(scot %da now)/import
=/ files
=/ files=(axal *)
|-
=+ .^(=arch %cy files-path)
:: If there is no directory below this, read the file's contents
?: (test dir.arch ~)
=/ mark
?+ (rear files-path) !!
@ -22,61 +21,70 @@
%noun noun
==
=/ content .^(mark %cx files-path)
:- [~ content] :: mimic fil.arch (unit item)
:- [~ content]
(~(urn by dir.arch) |=([name=@ta ~] ^$(files-path (snoc files-path name))))
:- fil.arch :: ~ or [~ u=item]
:- fil.arch
(~(urn by dir.arch) |=([name=@ta ~] ^$(files-path (snoc files-path name))))
=/ all-files ~(tap of files)
=/ files-import :+
published=*(map path [html=@t md=@t theme=@tas])
drafts=*(map path md=@t)
themes=*(map @tas css=@t)
=. files-import
=/ imp :+
pub=*(map path [html=@t md=@t theme=@tas])
dra=*(map path md=@t)
thm=*(map @tas css=@t)
=. imp
|-
?: (test all-files ~) files-import
?: =(all-files ~) imp
%. (rear all-files)
|= [=path content=*]
%= ^$
all-files (snip all-files)
files-import
?+ (rear path) files-import
%md
=+ content=(of-wain:format ((list cord) content))
?: ?=(%published (snag 0 path))
=/ file-name (oust [0 2] (snip path))
=/ file (~(gut by published.files-import) file-name [html='' md='' theme=%default])
files-import(published (~(put by published.files-import) file-name file(md content)))
=/ draft-name (oust [0 1] (snip path))
=/ draft (~(gut by drafts.files-import) draft-name [md=''])
files-import(drafts (~(put by drafts.files-import) draft-name draft(md content)))
%css
=/ theme-name (@tas (rear (oust [0 1] (snip path))))
=/ theme (~(gut by themes.files-import) theme-name [css=''])
files-import(themes (~(put by themes.files-import) theme-name theme(css (@t (@tas content)))))
%html
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 published.files-import) file-name [html='' md='' theme=%default])
files-import(published (~(put by published.files-import) file-name file(html (@t (@tas content)))))
=/ 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)))))
==
==
=/ cards *(list card:agent:gall)
=/ themes-map ;; (map path @tas) .^(noun %cx /(scot %p our)/blog/(scot %da now)/import/published/meta/noun)
=| cards=(list card:agent:gall)
=/ thm-map ;; (map path @tas)
.^(noun %cx /(scot %p our)/blog/(scot %da now)/import/published/meta/noun)
=/ act
:~ %pass
/poke
%agent
[our %blog]
%poke
%blog-action
==
=. cards
;: welp
cards
%+ turn ~(tap by published.files-import)
%+ turn ~(tap by pub.imp)
|= [=path html=@t md=@t theme=@tas]
[%pass /poke %agent [our %blog] %poke %blog-action !>([%publish path html md (~(gut by themes-map) path %default)])]
(welp act !>([%publish path html md (~(gut by thm-map) path %default)]))
%+ turn ~(tap by drafts.files-import)
%+ turn ~(tap by dra.imp)
|= [=path md=@t]
[%pass /poke %agent [our %blog] %poke %blog-action !>([%save-draft path md])]
(welp act !>([%save-draft path md]))
%+ turn ~(tap by themes.files-import)
%+ turn ~(tap by thm.imp)
|= [theme=@tas css=@t]
[%pass /poke %agent [our %blog] %poke %blog-action !>([%save-theme theme css])]
(welp act !>([%save-theme theme css]))
==
;< ~ bind:m (send-raw-cards cards)