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-css]
[%pass /info %arvo %c %info %blog %& soba-meta] [%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)) %save-draft `this(drafts (~(put by drafts) [path md]:act))
%delete-draft `this(drafts (~(del by drafts) path.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] $% [%publish =path html=@t md=@t theme=@tas]
[%unpublish =path] [%unpublish =path]
[%export css=?] [%export css=?]
[%import ~]
[%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]

View File

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