Last active
March 24, 2020 21:56
-
-
Save ixv/d41e15c6a2e1cb185e55f6307e21a376 to your computer and use it in GitHub Desktop.
script I used for converting old fora posts to the new publish format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/- spider, publish | |
/+ strandio | |
=, strand=strand:spider | |
^- thread:spider | |
|= arg=vase | |
=/ m (strand ,vase) | |
^- form:m | |
=+ !<([pax=path ~] arg) | |
;< bol=bowl:spider bind:m get-bowl:strandio | |
=/ prefix /==/(scot %da now.bol) | |
=/ files=(list path) .^((list path) %ct (weld prefix pax)) | |
=/ sob=soba:clay | |
%+ roll files | |
|= [pax=path sob=soba:clay] | |
^- soba:clay | |
?+ pax | |
sob | |
:: | |
[%fora @ %posts @ %md ~] | |
=/ fil=wain .^(wain %cx (welp prefix pax)) | |
=/ date=@t (rsh 3 6 (snag 2 fil)) | |
=/ title=@t (rsh 3 7 (snag 3 fil)) | |
=/ author=@t (rsh 3 8 (snag 4 fil)) | |
=/ author-test (slaw %p author) | |
=/ author-final=@t | |
?~ author-test | |
(scot %p (sham author)) | |
(scot %p u.author-test) | |
:: | |
=/ post=@t | |
%- of-wain:format | |
%+ weld | |
:~ ':- :~' | |
(crip " [%author {<author-final>}]") | |
(crip " [%last-modified {<date>}]") | |
(crip " [%date-created {<date>}]") | |
(crip " [%title {<title>}]") | |
' ==' | |
';>' | |
== | |
(slag 9 fil) | |
:: | |
=/ note-name i.t.t.t.pax | |
=/ new-pax=path | |
/app/publish/notebooks/fora/[note-name]/udon | |
=/ cay=cage [%udon !>(post)] | |
[[new-pax %ins cay] sob] | |
:: | |
[%fora @ %posts @ %comments @ %md ~] | |
=/ fil=wain .^(wain %cx (welp prefix pax)) | |
=/ a (snag 0 fil) | |
=/ note-name i.t.t.t.pax | |
=/ date=@da (slav %da i.t.t.t.t.t.pax) | |
=/ author=@t (rsh 3 4 (end 3 (dec (met 3 a)) a)) | |
=/ author-test (slaw %p author) | |
=/ author-final=@p | |
?~ author-test | |
`@p`(sham author) | |
u.author-test | |
:: | |
=/ comment=comment:publish | |
[author-final date (of-wain:format (slag 1 fil))] | |
:: | |
=/ new-pax=path | |
/app/publish/notebooks/fora/[note-name]/(scot %da date)/publish-comment | |
=/ cay=cage [%publish-comment !>(comment)] | |
[[new-pax %ins cay] sob] | |
== | |
=/ cad=card:agent:gall [%pass / %arvo %c %info q.byk.bol %& sob] | |
;< ~ bind:m (send-raw-card:strandio cad) | |
(pure:m !>("finished")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment