From bed8dcd8c5313a6427cc6424c15e9729809da18c Mon Sep 17 00:00:00 2001 From: dozens Date: Fri, 23 Sep 2022 16:08:05 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20ed=20heredocs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hey guess what i figured out some unix 101 stuff about how to redirect input and output, and used HEREDOC with ed to inline my edits and transformations to index.md to create the rss feeds for episodes and journal entries! --- ed/blogitem.ed | 13 ------- ed/journalitem.ed | 13 ------- justfile | 56 ++++++++++++++++++++---------- templates/journalitem.rec.template | 2 -- 4 files changed, 38 insertions(+), 46 deletions(-) delete mode 100644 ed/blogitem.ed delete mode 100644 ed/journalitem.ed diff --git a/ed/blogitem.ed b/ed/blogitem.ed deleted file mode 100644 index 39d8d7f..0000000 --- a/ed/blogitem.ed +++ /dev/null @@ -1,13 +0,0 @@ -. -g/BEGIN/ka -g/END/kb -1,'ad -'b,$d -%s/^- // -%s,,time: \1|, -%s, - \[\(.*\)\],title: \1|, -%s,(\(.*\))$,source: \1|link: \1|, -%s/html/md/ -%s/|/\ -/g -1,$w /dev/stdout diff --git a/ed/journalitem.ed b/ed/journalitem.ed deleted file mode 100644 index 1c1004e..0000000 --- a/ed/journalitem.ed +++ /dev/null @@ -1,13 +0,0 @@ -. -g/BEGIN/ka -g/END/kb -1,'ad -'b,$d -g/^##/+s/^/note: / -v/^note/s/^/+ / -%s/+ ##/##/ -%s_^## - \(.*\)_\ -time: \1\ -title: \2_ -1,$w /dev/stdout -q diff --git a/justfile b/justfile index cb33b7d..f6133f0 100644 --- a/justfile +++ b/justfile @@ -21,27 +21,47 @@ up: html rss # make episodes rss episoderss: - echo "cleric + thief" > www/episodes.xml \ - && echo "http://tilde.town/~dozens/clericthief/index.htmladventures of iofi and maddox" >> www/episodes.xml \ - && echo i \ - | cat - src/index.md ed/blogitem.ed \ - | ed -s \ - | recfmt -f templates/blogitem.rec.template \ - | m4 \ - >> www/episodes.xml \ - && echo '' >> www/episodes.xml + #!/usr/bin/env zsh + echo "cleric + thief" > www/episodes.xml + echo "http://tilde.town/~dozens/clericthief/index.htmladventures of iofi and maddox" >> www/episodes.xml + ed -s << HEREDOC src/index.md | recfmt -f templates/blogitem.rec.template | m4 >> www/episodes.xml + /BEGIN/ka + /END/kb + 1,'ad + 'b,d + %s/^- // + %s,,time: \1|, + %s, - \[\(.*\)\],title: \1|, + %s,(\(.*\))$,source: \1|link: \1|, + %s/html/md/ + %s/|/\\ + /g + ,w /dev/stdout + Q + HEREDOC + echo '' >> www/episodes.xml # make journal rss journalrss: - echo "cleric + thief" > www/journal.xml \ - && echo "http://tilde.town/~dozens/clericthief/index.htmlbehind the scenes of cleric + thief" >> www/journal.xml \ - && echo i \ - | cat - src/journal.md ed/journalitem.ed \ - | ed -s \ - | recfmt -f templates/journalitem.rec.template \ - | m4 \ - >> www/journal.xml \ - && echo '' >> www/journal.xml + #!/usr/bin/env zsh + echo "cleric + thief" > www/journal.xml + echo "http://tilde.town/~dozens/clericthief/index.htmlbehind the scenes of cleric + thief" >> www/journal.xml + ed -s !'markdown src/journal.md' << HEREDOC | recfmt -f templates/journalitem.rec.template | m4 >> www/journal.xml + /BEGIN/ka + /END/kb + 1,'ad + 'b,d + g/^

/+s/^/note: / + v/^note/s/^/+ / + %s/+

/

/ + %s_^

- \(.*\)

_\\ + time: \1\\ + title: \2_ + g/^+ $/d + ,w /dev/stdout + Q + HEREDOC + echo '
' >> www/journal.xml # build all rss rss: episoderss journalrss diff --git a/templates/journalitem.rec.template b/templates/journalitem.rec.template index c6299ac..e7e73b5 100644 --- a/templates/journalitem.rec.template +++ b/templates/journalitem.rec.template @@ -5,11 +5,9 @@ syscmd(`gdate -d {{time}}') changequote()dnl Or else `code blocks` confuse m4 {{note}} changequote`'dnl change quotes `back to default' - ]]>