switch to atom feed

This commit is contained in:
Never Gude 2026-03-09 12:16:56 +01:00
parent 6ab972d65e
commit ff76559ab7
28 changed files with 906 additions and 1751 deletions

View file

@ -20,6 +20,7 @@ syntax_style := $(PANDOCDIR)/solarized.theme
template_html := $(PANDOCDIR)/html-template.html
template_ansi := $(PANDOCDIR)/ansi-template
template_rss := $(PANDOCDIR)/rss-template.xml
template_atom := $(PANDOCDIR)/atom-template.xml
# Template for extracting metadata of .md files in json format
list_template := $(PANDOCDIR)/metadata-template.json
@ -35,10 +36,10 @@ articles_md := $(wildcard $(SRCDIR)/$(ARTICLEDIR)/*.md)
articles_html := $(patsubst $(SRCDIR)/%.md, $(BUILDDIR)/%.html, $(articles_md))
articles_ansi := $(patsubst $(SRCDIR)/%.md, $(BUILDDIR)/%, $(articles_md))
all: $(BUILDDIR)/index.html $(BUILDDIR)/index $(BUILDDIR)/rss.xml
all: $(BUILDDIR)/index.html $(BUILDDIR)/index $(BUILDDIR)/atom.xml
install:
cp -r $(BUILDDIR)/index.html $(BUILDDIR)/rss.xml $(articles_html) $(STYLEDIR) $(SCRIPTDIR) $(IMAGEDIR) $(INSTALLDIR_HTML); \
cp -r $(BUILDDIR)/index.html $(BUILDDIR)/atom.xml $(articles_html) $(STYLEDIR) $(SCRIPTDIR) $(IMAGEDIR) $(INSTALLDIR_HTML); \
cp -r $(BUILDDIR)/index $(articles_ansi) $(INSTALLDIR_ANSI);
clean:
@ -55,7 +56,7 @@ $(BUILDDIR)/$(ARTICLEDIR)/%.html: $(SRCDIR)/$(ARTICLEDIR)/%.md | $(BUILDDIR)
pandoc $< --template $(template_html) --css $(style) --highlight-style $(syntax_style) --mathml --toc --output $@; \
# Extract metadata from .md file, append filename field to the article object.
# This is used to link to the article from index.html. Append article object to the article list.
jq '.articles += [$(shell pandoc $< --template $(list_template) | jq '. += {"filename": "$(patsubst %.html,%,$(notdir $@))", "pubdate": "$(shell date -d $(shell pandoc $< --template $(list_template) | jq '.date') --rfc-2822)"}')]' $(article_list) > articles.json.tmp; \
jq '.articles += [$(shell pandoc $< --template $(list_template) | jq '. += {"filename": "$(patsubst %.html,%,$(notdir $@))"}')]' $(article_list) > articles.json.tmp; \
mv articles.json.tmp $(article_list);
@ -72,5 +73,5 @@ $(BUILDDIR)/index.html: $(SRCDIR)/index.md $(articles_html) | $(BUILDDIR)
$(BUILDDIR)/index: $(SRCDIR)/index.md $(articles_ansi) | $(BUILDDIR)
pandoc $< --template $(template_ansi) --metadata-file $(article_list) --to ansi --output $@
$(BUILDDIR)/rss.xml: $(SRCDIR)/rss.md $(articles_html) | $(BUILDDIR)
pandoc $< --template $(template_rss) --metadata-file $(article_list) --metadata=pubdate:"$(shell jq -r '.articles[0] | .pubdate' $(article_list))" --metadata=builddate:"$(shell date --rfc-2822)" --to html --output $@
$(BUILDDIR)/atom.xml: $(SRCDIR)/feed.md $(articles_html) | $(BUILDDIR)
pandoc $< --template $(template_atom) --metadata-file $(article_list) --to html --output $@