fusch.online

git / lists / casts

git.fusch.online/planner

Generate static pages from a list of links
git clone git://git.fusch.online/planner
Log / Files / Readme / Issues

commit e104472557f1e37fe3f1d4f8ebc87b3b6867103a
parent 3a3fbcb3ab304a68963e904977d3d2e7f2a88421
Author: hbkk <tschugg@posteo.de>
Date:   Sun,  7 Apr 2019 01:05:50 +0200

use atom for rss

Diffstat:
A.gitignore | 3+++
Mfooter.html | 2+-
Mplanner | 69++++++++++++++++++++++++++++++++++-----------------------------------
Mstyle.css | 6+++++-
4 files changed, 43 insertions(+), 37 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,3 @@ +.tags +db.tsv +planner_html/ diff --git a/footer.html b/footer.html @@ -1,4 +1,4 @@ <div class="footer"> - <a class="read new" href="./rss">rss</a> + <a class="read new" href="{{{ rss }}}">rss</a> <a class="read new" href="./tags.html">tags</a> </div> diff --git a/planner b/planner @@ -4,7 +4,7 @@ tmp=$(mktemp) site=planner_html offline=false -dateformat="+%a, %d %b %Y %H:%M:%S %z" +dateformat="--rfc-3339=seconds" builddate=$(date "$dateformat") baseurl=${BASEURL:-example.com} sitetitle="planner" @@ -27,7 +27,8 @@ EOF } print_html_tail() { - cat ./footer.html + sed -e "s/{{{ rss }}}/.\/atom.xml/" -e "s/{{{ tags }}}/.\/tags.html/" \ + ./footer.html cat << EOF </body> @@ -38,7 +39,7 @@ EOF print_html_link_head() { cat << EOF <div class="entry"> - <h2><a class="$3" href="$2">$1</a></h2> + <a class="$3" href="$2">$1</a><br> <a class="link" href="$2">$2</a> EOF } @@ -51,50 +52,48 @@ print_html_link_tag() { printf " <a class=\"tag\" href=\"%s\">%s</a>\n" "./$1.html" "$1" } -print_rss_head() { +print_atom_head() { cat << EOF <?xml version="1.0" encoding="UTF-8" ?> -<rss version="2.0" - xmlns:atom="http://www.w3.org/2005/Atom" - xmlns:dc="http://purl.org/dc/elements/1.1/"> - -<channel> - <title>$sitetitle</title> - <link>$PLANNER_URL</link> - <description>$sitetitle auf der wippe</description> - <language>en</language> - <lastBuildDate>$builddate</lastBuildDate> - <pubDate>$builddate</pubDate> - <atom:link href="$PLANNER_URL/rss" rel="self" type="application/rss+xml" /> +<feed xmlns="http://www.w3.org/2005/Atom"> +<link rel="self" href="https://$sitetitle.$baseurl/atom.xml"></link> +<title>$sitetitle</title> +<id>https://$sitetitle.$baseurl</id> +<updated>$builddate</updated> EOF } -print_rss_tail() { +print_aotom_tail() { cat << EOF - </channel> - </rss> + </feed> EOF } - -print_rss_link() { +print_atom_link() { cat << EOF - <item> - <title>$1</title> - <description>![CDATA[$2]]</description> - <link>$2</link> - <guid>$2</guid> - <dc:creator>tutti</dc:creator> - <pubDate>$3</pubDate> - </item> +<entry> + <title type="text">$1</title> + <link href="$2"></link> + <id>$2</id> + <author> + <name>tutti</name> + <email>tschugg@posteo.de</email> + </author> + <published>$3</published> + <updated>$3</updated> +</entry> EOF } +print_atom_tail() { + printf "</feed>\n" +} + # main mkdir -p $site touch ./db.tsv -rm $site/*.html $site/rss +rm $site/*.html $site/atom.xml [[ $1 == -n ]] && { offline=true @@ -102,13 +101,13 @@ rm $site/*.html $site/rss } print_html_head "" > $site/index.html -print_rss_head > $site/rss +print_atom_head > $site/atom.xml while read -r line; do link=$(cut -f2 <<< "$line") tags=$(cut -s -f3 <<< "$line") title=$(cut -s -f4- <<< "$line") - class="read" + class="linktitle read" date=$(grep "$link" ./db.tsv | cut -f1) [[ -z $date ]] && date=$builddate @@ -138,7 +137,7 @@ while read -r line; do grep -q "read" <<< "$tags" && { title="⛟ $title" - class="unread" + class="linktitle unread" } grep -q "$link" ./db.tsv || { @@ -165,13 +164,13 @@ while read -r line; do cat $site/link.html >> $site/index.html - print_rss_link "$title" "$link" "$date" >> $site/rss + print_atom_link "$title" "$link" "$date" >> $site/atom.xml done < "${1:-/dev/stdin}" rm $site/link.html print_html_tail >> $site/index.html -print_rss_tail >> $site/rss +print_atom_tail >> $site/atom.xml print_html_head "tags" > $site/tags.html diff --git a/style.css b/style.css @@ -1,7 +1,7 @@ body { width: 50em; margin: 0 auto; - line-height: 1em; + line-height: 1.4em; margin-top: 8em; margin-bottom: 4em; font-family: Tahoma, Verdana, Arial, sans-serif; @@ -77,6 +77,10 @@ a.link { color: black; } +a.linktitle { + font-weight: bold; +} + a.link:hover { text-decoration: underline; }