diff --git a/GNUmakefile b/GNUmakefile index 2c7d97d..00b1379 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,12 +3,12 @@ DEPLOY_BLOBS = andrea0s-plain-noextfonts.svg \ blob/ebrimabd.ttf \ blob/window-capture \ blob/vcf-2024-pile.jpg -AWESOME_BLOGS := -s https://lwn.net/headlines/rss \ - -s https://lobste.rs/rss \ - -s https://blog.haskell.org/atom.xml \ - -s https://www.phoronix.com/rss.php \ - -s https://static.fsf.org/fsforg/rss/news.xml \ - -s https://emersion.fr/blog/rss.xml +# AWESOME_BLOGS := -s https://lwn.net/headlines/rss \ +# -s https://lobste.rs/rss \ +# -s https://blog.haskell.org/atom.xml \ +# -s https://www.phoronix.com/rss.php \ +# -s https://static.fsf.org/fsforg/rss/news.xml \ +# -s https://emersion.fr/blog/rss.xml UNAME = $(shell uname) ifeq ($(UNAME),Linux) @@ -29,13 +29,11 @@ blog/%.indicator.html: indicators blog/%.html: %.head.html nav.head.html %.indicator.html nav.tail.html window.head.html %.inner.html window.tail.html cat $^ > $@ -vcf%.html: vcf%.head.html nav.head.html blog/vcf%.indicator.html nav.tail.html window.head.html blog/vcf%.inner.html window.tail.html - cat $^ > $@ - -blog.inner.html: $(BLOG_SRC) - scripts/blogposts.bash \ - | modules/openring/openring -n 12 -p 3 \ - $(AWESOME_BLOGS) > $@ +blog/feed.xml blog.inner.html: $(BLOG_SRC) scripts/blogposts.bash #modules/openring/openring + scripts/blogposts.bash > $@ + # scripts/blogposts.bash \ + # | modules/openring/openring -n 12 -p 3 \ + # $(AWESOME_BLOGS) > $@ modules/openring/openring.go: .gitmodules git submodule update --init --recursive -- modules/openring @@ -66,8 +64,11 @@ index.html: indexhead.html nav.head.html index.indicator.html nav.tail.html inde %.html: %.head.html nav.head.html %.indicator.html nav.tail.html window.head.html %.inner.html window.tail.html cat $^ > $@ -test: index.html - $(OPEN) $< +test: deploy + $(OPEN) $@.html + cd $(DEPLOY_HTTPROOT) \ + && ln -s . '~targetdisk' \ + && python -m http.server $(DEPLOY_HTTPROOT)/blob: mkdir -p $(@) @@ -77,6 +78,6 @@ deploy: all $(DEPLOY_HTTPROOT)/blob cp -rv *.css *.html blog media \ $(DEPLOY_HTTPROOT) -all: blog-posts index.html blog.html resume.html vcfmw-2024.html +all: blog-posts index.html blog.html resume.html .PHONY: all blog-posts indicators deploy diff --git a/scripts/blogposts.bash b/scripts/blogposts.bash index 1c2b641..101c201 100755 --- a/scripts/blogposts.bash +++ b/scripts/blogposts.bash @@ -1,55 +1,92 @@ #!/usr/bin/env bash +HEADING='Posts' +TITLE="Andrea's blog" +BASENAME=${BASENAME-blog} +BASE_URL=${BASE_URL-https://sqt.wtf} +DESCRIPTION="Andrea's personal blog." +N_DESC_CHARS=500 + +articles=( $BASENAME/*.md ) + cat < -

Posts

+

$HEADING

HDR -for blog_post_md in blog/*.md; do - date=$(grep -o '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}' <<<"$blog_post_md") - title=$(grep -m 1 '^#\s\+' "$blog_post_md" | sed 's/^#\s\+//') - html=$(sed 's/\.md$/.html/' <<<"$blog_post_md") +cat > blog/feed.xml < + + $TITLE + $BASE_URL/$BASENAME.html + $DESCRIPTION +RSSHDR + +for ((i=${#articles[@]}-1; i>=0; i--)); do + post_md=${articles[$i]} + date=$(grep -o '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}' <<<"$post_md") + title=$(grep -m 1 '^#\s\+' "$post_md" | sed 's/^#\s\+//') + html=$(sed 's/\.md$/.html/' <<<"$post_md") + rss_desc=$(grep -v '^\s*$' "$post_md" | grep -v '^\s*\*by' | grep -v '^#' | grep -v '^\s*!\[' | grep -v '<.\+>'| head -c $N_DESC_CHARS)'...' cat <$date
$title
INNIE + + cat >> $BASENAME/feed.xml < + $title + $BASE_URL/~targetdisk/$html + $rss_desc + $(date -d "$date" '+%a, %d %b %Y %H:%M:%S %Z') + +RSSINNIE done cat < - -

Other People's Posts

- {{range .Articles}} -
-

- {{.Title}} -

-

{{.Summary}}

- - via {{.SourceTitle}} - - {{.Date | datef "January 2, 2006"}} -
- {{end}} - -

- -

- Generated by - openring -

-
+

RSS

- - FTR + +# +#

Other People's Posts

+# {{range .Articles}} +#
+#

+# {{.Title}} +#

+#

{{.Summary}}

+# +# via {{.SourceTitle}} +# +# {{.Date | datef "January 2, 2006"}} +#
+# {{end}} +# +#

+# +#

+# Generated by +# openring +#

+#
+# +# +# +#FTR + +cat >> $BASENAME/feed.xml < + +RSSFTR