126 lines
3.1 KiB
Bash
126 lines
3.1 KiB
Bash
|
#!/bin/zsh
|
||
|
|
||
|
HEAD=$(
|
||
|
cat<<'EOF'
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>The Most Interesting Thing That Happened To Me Today</title>
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
<link rel="alternate" type="application/rss+xml" href="rss.xml" title="dozens interesting microblog">
|
||
|
<style>
|
||
|
body {
|
||
|
max-width: 80ch;
|
||
|
margin: 0 auto;
|
||
|
padding: 1rem;
|
||
|
font-size: 18pt;
|
||
|
}
|
||
|
dd {
|
||
|
margin-bottom: 1rem;
|
||
|
text-align: justify;
|
||
|
}
|
||
|
@media (prefers-color-scheme: dark) {
|
||
|
body {
|
||
|
background: #15191d;
|
||
|
color: #ddd;
|
||
|
}
|
||
|
body a {
|
||
|
color: #809fff;
|
||
|
}
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div style="text-align: right;">
|
||
|
<p>
|
||
|
subscribe:
|
||
|
<a href="interesting.txt">twtxt</a>
|
||
|
<a href="feed.xml">rss</a>
|
||
|
</p>
|
||
|
<p>
|
||
|
dozensweb:
|
||
|
<a href="https://tilde.town/~dozens/webring/dozens/index.html?name=interesting&dir=prev">prev</a>
|
||
|
<a href="https://tilde.town/~dozens/webring/dozens/index.html">all</a>
|
||
|
<a href="https://tilde.town/~dozens/webring/dozens/index.html?name=interesting&dir=next">next</a>
|
||
|
</p>
|
||
|
</div>
|
||
|
<h1>Story Journal Microblog</h1>
|
||
|
<p>by dozens</p>
|
||
|
<details>
|
||
|
<summary>About</summary>
|
||
|
<p>
|
||
|
There's this guy. I don't remember his name. But he is a storytelling competition winner many times over.
|
||
|
And somebody interviewed him and asked how he comes up with such great stories.
|
||
|
And his answer was, everyday you write down the most story-worthy thing that happened to you that day.
|
||
|
The most interesting thing that happened to you.
|
||
|
</p>
|
||
|
</details>
|
||
|
<h2>The most interesting / story-worthy thing that happened to me today was ...</h2>
|
||
|
<dl>
|
||
|
EOF
|
||
|
)
|
||
|
|
||
|
BUTT=$(
|
||
|
cat<<'EOF'
|
||
|
</dl>
|
||
|
</body>
|
||
|
</html>
|
||
|
EOF
|
||
|
)
|
||
|
|
||
|
exec > dist/index.html
|
||
|
echo "$HEAD"
|
||
|
IFS=$'\t'
|
||
|
cat src/interesting.txt | sed '/^#/d' | tac |\
|
||
|
while read STAMP BODY; do
|
||
|
d=`gdate --date "$STAMP" +'%Y-%m-%d'`
|
||
|
echo "<dt id="$STAMP">$d <a href="#$STAMP">¶</a></dt><dd>$BODY</dd>"
|
||
|
done
|
||
|
echo "$BUTT"
|
||
|
|
||
|
|
||
|
##########
|
||
|
# rss time
|
||
|
##########
|
||
|
|
||
|
|
||
|
TOP=$(
|
||
|
cat<<'END-OF-TOP'
|
||
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||
|
<channel>
|
||
|
<title>dozens interesting microblog</title>
|
||
|
<link>http://tilde.town/~dozens/interesting/</link>
|
||
|
<description>dozens interesting microblog</description>
|
||
|
<atom:link rel="self" type="application/rss+xml" href="http://tilde.town/~dozens/interesting/feed.xml"/>
|
||
|
<generator>/bin/sh</generator>
|
||
|
END-OF-TOP
|
||
|
)
|
||
|
|
||
|
MIDDLE()(
|
||
|
TIME="$1"
|
||
|
CONTENT="$2"
|
||
|
PUBDATE=`gdate --date "$STAMP" -R`
|
||
|
cat<<END-OF-MIDDLE
|
||
|
<item>
|
||
|
<title>${CONTENT:0:40}...</title>
|
||
|
<link>http://tilde.town/~dozens/interesting/#$TIME</link>
|
||
|
<guid>http://tilde.town/~dozens/interesting/#$TIME</guid>
|
||
|
<pubDate>$PUBDATE</pubDate>
|
||
|
<description>
|
||
|
<![CDATA["
|
||
|
$CONTENT
|
||
|
"]]>
|
||
|
</description>
|
||
|
</item>
|
||
|
END-OF-MIDDLE
|
||
|
)
|
||
|
|
||
|
|
||
|
exec > dist/feed.xml
|
||
|
echo "$TOP"
|
||
|
IFS=$'\t'
|
||
|
cat src/interesting.txt | sed '/^#/d' | tac |\
|
||
|
while read STAMP BODY; do
|
||
|
MIDDLE "$STAMP" "$BODY"
|
||
|
done
|
||
|
echo "</channel></rss>"
|