🛠 ed heredocs
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!main
parent
53825991ba
commit
bed8dcd8c5
|
@ -1,13 +0,0 @@
|
||||||
.
|
|
||||||
g/BEGIN/ka
|
|
||||||
g/END/kb
|
|
||||||
1,'ad
|
|
||||||
'b,$d
|
|
||||||
%s/^- //
|
|
||||||
%s,<time>\(.*\)</time>,time: \1|,
|
|
||||||
%s, - \[\(.*\)\],title: \1|,
|
|
||||||
%s,(\(.*\))$,source: \1|link: \1|,
|
|
||||||
%s/html/md/
|
|
||||||
%s/|/\
|
|
||||||
/g
|
|
||||||
1,$w /dev/stdout
|
|
|
@ -1,13 +0,0 @@
|
||||||
.
|
|
||||||
g/BEGIN/ka
|
|
||||||
g/END/kb
|
|
||||||
1,'ad
|
|
||||||
'b,$d
|
|
||||||
g/^##/+s/^/note: /
|
|
||||||
v/^note/s/^/+ /
|
|
||||||
%s/+ ##/##/
|
|
||||||
%s_^## <time>\(.*\)</time> - \(.*\)_\
|
|
||||||
time: \1\
|
|
||||||
title: \2_
|
|
||||||
1,$w /dev/stdout
|
|
||||||
q
|
|
56
justfile
56
justfile
|
@ -21,27 +21,47 @@ up: html rss
|
||||||
|
|
||||||
# make episodes rss
|
# make episodes rss
|
||||||
episoderss:
|
episoderss:
|
||||||
echo "<rss version=\"2.0\"><channel><title>cleric + thief</title>" > www/episodes.xml \
|
#!/usr/bin/env zsh
|
||||||
&& echo "<link>http://tilde.town/~dozens/clericthief/index.html</link><description>adventures of iofi and maddox</description><atom:link rel=\"self\" type=\"application/rss+xml\" href=\"http://tilde.town/~dozens/clericthief/episodes.xml\"/>" >> www/episodes.xml \
|
echo "<rss version=\"2.0\"><channel><title>cleric + thief</title>" > www/episodes.xml
|
||||||
&& echo i \
|
echo "<link>http://tilde.town/~dozens/clericthief/index.html</link><description>adventures of iofi and maddox</description><atom:link rel=\"self\" type=\"application/rss+xml\" href=\"http://tilde.town/~dozens/clericthief/episodes.xml\"/>" >> www/episodes.xml
|
||||||
| cat - src/index.md ed/blogitem.ed \
|
ed -s << HEREDOC src/index.md | recfmt -f templates/blogitem.rec.template | m4 >> www/episodes.xml
|
||||||
| ed -s \
|
/BEGIN/ka
|
||||||
| recfmt -f templates/blogitem.rec.template \
|
/END/kb
|
||||||
| m4 \
|
1,'ad
|
||||||
>> www/episodes.xml \
|
'b,d
|
||||||
&& echo '</channel></rss>' >> www/episodes.xml
|
%s/^- //
|
||||||
|
%s,<time>\(.*\)</time>,time: \1|,
|
||||||
|
%s, - \[\(.*\)\],title: \1|,
|
||||||
|
%s,(\(.*\))$,source: \1|link: \1|,
|
||||||
|
%s/html/md/
|
||||||
|
%s/|/\\
|
||||||
|
/g
|
||||||
|
,w /dev/stdout
|
||||||
|
Q
|
||||||
|
HEREDOC
|
||||||
|
echo '</channel></rss>' >> www/episodes.xml
|
||||||
|
|
||||||
# make journal rss
|
# make journal rss
|
||||||
journalrss:
|
journalrss:
|
||||||
echo "<rss version=\"2.0\"><channel><title>cleric + thief</title>" > www/journal.xml \
|
#!/usr/bin/env zsh
|
||||||
&& echo "<link>http://tilde.town/~dozens/clericthief/index.html</link><description>behind the scenes of cleric + thief</description><atom:link rel=\"self\" type=\"application/rss+xml\" href=\"http://tilde.town/~dozens/clericthief/journal.xml\"/>" >> www/journal.xml \
|
echo "<rss version=\"2.0\"><channel><title>cleric + thief</title>" > www/journal.xml
|
||||||
&& echo i \
|
echo "<link>http://tilde.town/~dozens/clericthief/index.html</link><description>behind the scenes of cleric + thief</description><atom:link rel=\"self\" type=\"application/rss+xml\" href=\"http://tilde.town/~dozens/clericthief/journal.xml\"/>" >> www/journal.xml
|
||||||
| cat - src/journal.md ed/journalitem.ed \
|
ed -s !'markdown src/journal.md' << HEREDOC | recfmt -f templates/journalitem.rec.template | m4 >> www/journal.xml
|
||||||
| ed -s \
|
/BEGIN/ka
|
||||||
| recfmt -f templates/journalitem.rec.template \
|
/END/kb
|
||||||
| m4 \
|
1,'ad
|
||||||
>> www/journal.xml \
|
'b,d
|
||||||
&& echo '</channel></rss>' >> www/journal.xml
|
g/^<h2>/+s/^/note: /
|
||||||
|
v/^note/s/^/+ /
|
||||||
|
%s/+ <h2>/<h2>/
|
||||||
|
%s_^<h2><time>\(.*\)</time> - \(.*\)</h2>_\\
|
||||||
|
time: \1\\
|
||||||
|
title: \2_
|
||||||
|
g/^+ $/d
|
||||||
|
,w /dev/stdout
|
||||||
|
Q
|
||||||
|
HEREDOC
|
||||||
|
echo '</channel></rss>' >> www/journal.xml
|
||||||
|
|
||||||
# build all rss
|
# build all rss
|
||||||
rss: episoderss journalrss
|
rss: episoderss journalrss
|
||||||
|
|
|
@ -5,11 +5,9 @@
|
||||||
<pubDate>syscmd(`gdate -d {{time}}')</pubDate>
|
<pubDate>syscmd(`gdate -d {{time}}')</pubDate>
|
||||||
<description>
|
<description>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<pre>
|
|
||||||
changequote(<!,!>)dnl Or else `code blocks` confuse m4
|
changequote(<!,!>)dnl Or else `code blocks` confuse m4
|
||||||
{{note}}
|
{{note}}
|
||||||
changequote`'dnl change quotes `back to default'
|
changequote`'dnl change quotes `back to default'
|
||||||
</pre>
|
|
||||||
]]>
|
]]>
|
||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue