diff options
author | EuAndreh <eu@euandre.org> | 2025-04-11 14:31:41 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-04-11 14:31:41 -0300 |
commit | b346c1834e5e3366327a9a1b1d65bcbb1995e2a3 (patch) | |
tree | 0d7c95294c7623be256ff2dee7a788160341c291 | |
parent | Makefile: Add check-unit-updatedat (diff) | |
download | papo.im-b346c1834e5e3366327a9a1b1d65bcbb1995e2a3.tar.gz papo.im-b346c1834e5e3366327a9a1b1d65bcbb1995e2a3.tar.xz |
Makefile: Generate independent Atom feed per category
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | Makefile | 92 | ||||
-rw-r--r-- | deps.mk | 35 | ||||
-rwxr-xr-x | mkdeps.sh | 37 | ||||
-rw-r--r-- | src/content/blog/1970/01/01/launch.adoc | 1 | ||||
-rw-r--r-- | src/content/incidents/2000/01/01/service-start.adoc | 1 |
6 files changed, 111 insertions, 61 deletions
@@ -9,15 +9,19 @@ *.indexentry *.feedentry *.sortdata +*.categorydata sortdata.txt +categories.txt +categories.xml index.htmlheader index.htmlfooter index.htmllisting feed.xml +feed.*.xml *.gz /src/sources.txt /src/all-contents.txt -/src/all-snippets-list.txt +/src/all-filelists.txt /src/install.txt /src/sort-expected.txt /src/sort-given.txt @@ -24,42 +24,45 @@ PUBURL = public.asc .SUFFIXES: -.SUFFIXES: .adoc .conf .snippets .indexentry .feedentry .sortdata .xml +.SUFFIXES: .adoc .conf .snippets .indexentry .feedentry .sortdata .xml .txt .SUFFIXES: .htmlbody .htmlheader .htmlfooter .htmllisting .html .links .caslinks -.SUFFIXES: .gz +.SUFFIXES: .categorydata .gz .adoc.conf: mkwb conf src/global.conf $< > $@ .adoc.htmlbody: - mkwb htmlbody $< > $@ + mkwb htmlbody $< > $@ .htmlbody.html: - mkwb html $< > $@ + mkwb html $< > $@ .conf.htmlheader: - mkwb html -H $< > $@ + mkwb html -H $< > $@ .conf.htmlfooter: - mkwb html -F $< > $@ + mkwb html -F $< > $@ .conf.htmllisting: - mkwb indexbody $< > $@ + mkwb indexbody $< > $@ .adoc.snippets: - mkwb snippets $< > $@ + mkwb snippets $< > $@ .conf.indexentry: - mkwb indexentry $< > $@ + mkwb indexentry $< > $@ .htmlbody.feedentry: - mkwb feedentry $< > $@ + mkwb feedentry $< > $@ .conf.sortdata: - mkwb sortdata $< > $@ + mkwb sortdata $< > $@ + +.conf.categorydata: + mkwb categorydata $< > $@ .adoc.links: - mkwb links $< > $@ + mkwb links $< > $@ .links.caslinks: grep -v '^link:' $< | xargs -I_ sh -c '\ @@ -72,21 +75,24 @@ all: include deps.mk -sources.adoc = $(articles.adoc) $(listings.adoc) $(pages.adoc) -sources.htmlbody = $(sources.adoc:.adoc=.htmlbody) -sources.html = $(sources.adoc:.adoc=.html) -sources.snippets = $(sources.adoc:.adoc=.snippets) -sources.snippets.gz = $(sources.adoc:.adoc=.snippets.gz) -sources.conf = $(sources.adoc:.adoc=.conf) -sources.links = $(sources.adoc:.adoc=.links) -sources.caslinks = $(sources.adoc:.adoc=.caslinks) -articles.indexentry = $(articles.adoc:.adoc=.indexentry) -articles.feedentry = $(articles.adoc:.adoc=.feedentry) -articles.sortdata = $(articles.adoc:.adoc=.sortdata) -listings.htmlheader = $(listings.adoc:.adoc=.htmlheader) -listings.htmlfooter = $(listings.adoc:.adoc=.htmlfooter) -listings.htmllisting = $(listings.adoc:.adoc=.htmllisting) -listings.html = $(listings.adoc:.adoc=.html) +sources.adoc = $(articles.adoc) $(listings.adoc) $(pages.adoc) +sources.htmlbody = $(sources.adoc:.adoc=.htmlbody) +sources.html = $(sources.adoc:.adoc=.html) +sources.snippets = $(sources.adoc:.adoc=.snippets) +sources.snippets.gz = $(sources.adoc:.adoc=.snippets.gz) +sources.conf = $(sources.adoc:.adoc=.conf) +sources.links = $(sources.adoc:.adoc=.links) +sources.caslinks = $(sources.adoc:.adoc=.caslinks) +articles.indexentry = $(articles.adoc:.adoc=.indexentry) +articles.feedentry = $(articles.adoc:.adoc=.feedentry) +articles.sortdata = $(articles.adoc:.adoc=.sortdata) +articles.categorydata = $(articles.adoc:.adoc=.categorydata) +listings.htmlheader = $(listings.adoc:.adoc=.htmlheader) +listings.htmlfooter = $(listings.adoc:.adoc=.htmlfooter) +listings.htmllisting = $(listings.adoc:.adoc=.htmllisting) +listings.html = $(listings.adoc:.adoc=.html) +categories.xml = $(categories.txt:.txt=.xml) +categories.xml.gz = $(categories.txt:.txt=.xml.gz) sources = \ $(sources.adoc) \ @@ -127,9 +133,11 @@ contents = \ src/content/security.txt \ src/content/security.txt.gz \ -all-snippets = \ +all-filelists = \ $(sources.snippets) \ $(sources.snippets.gz) \ + $(categories.xml) \ + $(categories.xml.gz) \ all-contents = \ $(contents) \ @@ -154,6 +162,10 @@ derived-assets = \ $(articles.indexentry) \ $(articles.feedentry) \ $(articles.sortdata) \ + $(articles.categorydata) \ + $(categories.txt) \ + $(categories.xml) \ + $(categories.xml.gz) \ email.txt \ baseurl.txt \ fingerprint.txt \ @@ -162,7 +174,7 @@ derived-assets = \ src/content/security.txt.gz \ src/content/.well-known/security.txt \ src/all-contents.txt \ - src/all-snippets-list.txt \ + src/all-filelists.txt \ src/install.txt \ src/sort-expected.txt \ src/sort-given.txt \ @@ -175,6 +187,8 @@ side-assets = \ src/collections/*/*/*/*/*.html.*.txt.gz \ src/collections/*/index.html.*.txt \ src/collections/*/sortdata.txt \ + src/collections/*/feed.*.xml \ + src/collections/*/feed.*.xml.gz \ src/collections/*/*.sortdata \ src/pages/*/*.html.*.txt \ src/content/.well-known/ \ @@ -207,6 +221,16 @@ src/global.conf: src/base.conf $(listings.html): cat $*.htmlheader $*.htmllisting $*.htmlbody $*.htmlfooter > $@ +$(categories.txt): + mkwb categories $(@D) > $@ + +$(categories.xml): + for f in `cat $*.txt`; do \ + c="`printf '%s\n' "$$f" | cut -d. -f2`"; \ + mkwb feed src/global.conf "$$f" > $(@D)/feed."$$c".xml; \ + printf '%s\n' $(@D)/feed."$$c".xml; \ + done > $@ + $(feeds.xml): mkwb feed src/global.conf $(@D)/sortdata.txt > $@ @@ -214,7 +238,7 @@ $(contents.gz): gzip -9fk $* touch $@ -$(sources.snippets.gz): +$(sources.snippets.gz) $(categories.xml.gz): if [ -s $* ]; then gzip -9fk `cat $*`; fi sed 's/$$/.gz/' $* > $@ @@ -262,11 +286,11 @@ src/sources.txt: src/all-contents.txt: printf '%s\n' $(all-contents) > $@ -src/all-snippets-list.txt: - printf '%s\n' $(all-snippets) > $@ +src/all-filelists.txt: + printf '%s\n' $(all-filelists) > $@ -src/install.txt: src/all-contents.txt src/all-snippets-list.txt $(all-snippets) - cat src/all-contents.txt `cat src/all-snippets-list.txt` > $@ +src/install.txt: src/all-contents.txt src/all-filelists.txt $(all-filelists) + cat src/all-contents.txt `cat src/all-filelists.txt` > $@ sources.txt: src/sources.txt install.txt: src/install.txt @@ -14,6 +14,10 @@ listings.adoc = \ src/content/blog/index.adoc \ src/content/incidents/index.adoc \ +categories.txt = \ + src/content/blog/categories.txt \ + src/content/incidents/categories.txt \ + feeds.xml = \ src/content/blog/feed.xml \ src/content/incidents/feed.xml \ @@ -78,6 +82,8 @@ src/content/blog/2000/01/01/feature-ann.snippets.gz: src/content/blog/2000/01/01 src/content/incidents/2000/01/01/service-start.snippets.gz: src/content/incidents/2000/01/01/service-start.snippets src/content/blog/index.snippets.gz: src/content/blog/index.snippets src/content/incidents/index.snippets.gz: src/content/incidents/index.snippets +src/content/blog/categories.xml.gz: src/content/blog/categories.xml +src/content/incidents/categories.xml.gz: src/content/incidents/categories.xml src/content/blog/feed.xml.gz: src/content/blog/feed.xml src/content/incidents/feed.xml.gz: src/content/incidents/feed.xml @@ -118,6 +124,9 @@ src/content/incidents/2000/01/01/service-start.feedentry: src/content/incidents/ src/content/blog/1970/01/01/launch.sortdata: src/content/blog/1970/01/01/launch.conf src/content/blog/2000/01/01/feature-ann.sortdata: src/content/blog/2000/01/01/feature-ann.conf src/content/incidents/2000/01/01/service-start.sortdata: src/content/incidents/2000/01/01/service-start.conf +src/content/blog/1970/01/01/launch.categorydata: src/content/blog/1970/01/01/launch.conf +src/content/blog/2000/01/01/feature-ann.categorydata: src/content/blog/2000/01/01/feature-ann.conf +src/content/incidents/2000/01/01/service-start.categorydata: src/content/incidents/2000/01/01/service-start.conf src/content/blog/index.htmlheader src/content/blog/index.htmlfooter: src/content/blog/index.conf src/content/incidents/index.htmlheader src/content/incidents/index.htmlfooter: src/content/incidents/index.conf @@ -131,26 +140,32 @@ articles.blog.adoc = \ src/content/blog/1970/01/01/launch.adoc \ src/content/blog/2000/01/01/feature-ann.adoc \ -articles.blog.sortdata = $(articles.blog.adoc:.adoc=.sortdata) -articles.blog.indexentry = $(articles.blog.adoc:.adoc=.indexentry) -articles.blog.feedentry = $(articles.blog.adoc:.adoc=.feedentry) +articles.blog.sortdata = $(articles.blog.adoc:.adoc=.sortdata) +articles.blog.indexentry = $(articles.blog.adoc:.adoc=.indexentry) +articles.blog.feedentry = $(articles.blog.adoc:.adoc=.feedentry) +articles.blog.categorydata = $(articles.blog.adoc:.adoc=.categorydata) src/content/blog/sortdata.txt: deps.mk printf '%s\n' $(articles.blog.sortdata) > $@ -src/content/blog/feed.xml src/content/blog/index.htmllisting: src/content/blog/sortdata.txt $(articles.blog.sortdata) +src/content/blog/categories.txt src/content/blog/feed.xml src/content/blog/index.htmllisting: src/content/blog/sortdata.txt $(articles.blog.sortdata) src/content/blog/index.htmllisting: $(articles.blog.indexentry) -src/content/blog/feed.xml: $(articles.blog.feedentry) +src/content/blog/categories.txt: $(articles.blog.categorydata) +src/content/blog/categories.xml: src/content/blog/categories.txt +src/content/blog/categories.txt src/content/blog/feed.xml: $(articles.blog.feedentry) articles.incidents.adoc = \ src/content/incidents/2000/01/01/service-start.adoc \ -articles.incidents.sortdata = $(articles.incidents.adoc:.adoc=.sortdata) -articles.incidents.indexentry = $(articles.incidents.adoc:.adoc=.indexentry) -articles.incidents.feedentry = $(articles.incidents.adoc:.adoc=.feedentry) +articles.incidents.sortdata = $(articles.incidents.adoc:.adoc=.sortdata) +articles.incidents.indexentry = $(articles.incidents.adoc:.adoc=.indexentry) +articles.incidents.feedentry = $(articles.incidents.adoc:.adoc=.feedentry) +articles.incidents.categorydata = $(articles.incidents.adoc:.adoc=.categorydata) src/content/incidents/sortdata.txt: deps.mk printf '%s\n' $(articles.incidents.sortdata) > $@ -src/content/incidents/feed.xml src/content/incidents/index.htmllisting: src/content/incidents/sortdata.txt $(articles.incidents.sortdata) +src/content/incidents/categories.txt src/content/incidents/feed.xml src/content/incidents/index.htmllisting: src/content/incidents/sortdata.txt $(articles.incidents.sortdata) src/content/incidents/index.htmllisting: $(articles.incidents.indexentry) -src/content/incidents/feed.xml: $(articles.incidents.feedentry) +src/content/incidents/categories.txt: $(articles.incidents.categorydata) +src/content/incidents/categories.xml: src/content/incidents/categories.txt +src/content/incidents/categories.txt src/content/incidents/feed.xml: $(articles.incidents.feedentry) @@ -36,12 +36,13 @@ files() { } -pages | varlist 'pages.adoc' -articles | varlist 'articles.adoc' -listings | varlist 'listings.adoc' -listings | sed 's|/index\.adoc$|/feed.xml|' | varlist 'feeds.xml' -find src/content/img/ -name '*.svg' | varlist 'images.svg' -extras | varlist 'sources.extras' +pages | varlist 'pages.adoc' +articles | varlist 'articles.adoc' +listings | varlist 'listings.adoc' +listings | sed 's|/index\.adoc$|/categories.txt|' | varlist 'categories.txt' +listings | sed 's|/index\.adoc$|/feed.xml|' | varlist 'feeds.xml' +find src/content/img/ -name '*.svg' | varlist 'images.svg' +extras | varlist 'sources.extras' files | sed 's/^\(.*\)\.adoc$/\1.htmlbody\t\1.snippets\t\1.conf:\t\1.adoc/' @@ -50,6 +51,7 @@ printf '\n' files | sed 's/^\(.*\)\.adoc$/\1.html.gz:\t\1.html/' files | sed 's/^\(.*\)\.adoc$/\1.snippets.gz:\t\1.snippets/' +listings | sed 's|^\(.*\)/index\.adoc$|\1/categories.xml.gz:\t\1/categories.xml|' listings | sed 's|^\(.*\)/index\.adoc$|\1/feed.xml.gz:\t\1/feed.xml|' printf '\n' @@ -60,6 +62,7 @@ printf '\n' articles | sed 's/^\(.*\)\.adoc$/\1.feedentry:\t\1.conf\t\1.htmlbody/' articles | sed 's/^\(.*\)\.adoc$/\1.sortdata:\t\1.conf/' +articles | sed 's/^\(.*\)\.adoc$/\1.categorydata:\t\1.conf/' printf '\n' listings | sed 's/^\(.*\)\.adoc$/\1.htmlheader\t\1.htmlfooter:\t\1.conf/' @@ -72,21 +75,23 @@ for colllink in src/collections/*; do printf '\n\n' name="$(basename "$c")" find "$c"/*/ -type f -name '*.adoc' | varlist "articles.$name.adoc" - printf 'articles.%s.%s = $(articles.%s.adoc:.adoc=.%s)\n' \ - "$name" 'sortdata ' "$name" 'sortdata' - printf 'articles.%s.%s = $(articles.%s.adoc:.adoc=.%s)\n' \ - "$name" 'indexentry' "$name" 'indexentry' - printf 'articles.%s.%s = $(articles.%s.adoc:.adoc=.%s)\n' \ - "$name" 'feedentry ' "$name" 'feedentry' + art=articles # so things fit in 80 columns + echo "$art.$name.sortdata = \$($art.$name.adoc:.adoc=.sortdata)" + echo "$art.$name.indexentry = \$($art.$name.adoc:.adoc=.indexentry)" + echo "$art.$name.feedentry = \$($art.$name.adoc:.adoc=.feedentry)" + echo "$art.$name.categorydata = \$($art.$name.adoc:.adoc=.categorydata)" printf '%s/sortdata.txt:\tdeps.mk\n' "$c" - printf '\tprintf %s $(articles.%s.sortdata) > $@\n\n' \ - "'%s\n'" "$name" + printf '\tprintf %s $(articles.%s.sortdata) > $@\n\n' "'%s\n'" "$name" - printf '%s/feed.xml\t%s/index.htmllisting:' "$c" "$c" + printf '%s/categories.txt\t%s/feed.xml\t%s/index.htmllisting:' \ + "$c" "$c" "$c" printf '\t%s/sortdata.txt\t$(articles.%s.sortdata)\n' "$c" "$name" printf '%s/index.htmllisting:\t$(articles.%s.indexentry)\n' "$c" "$name" - printf '%s/feed.xml:\t$(articles.%s.feedentry)\n' "$c" "$name" + printf '%s/categories.txt:\t$(articles.%s.categorydata)\n' "$c" "$name" + printf '%s/categories.xml:\t%s/categories.txt\n' "$c" "$c" + printf '%s/categories.txt\t%s/feed.xml:\t$(articles.%s.feedentry)\n' \ + "$c" "$c" "$name" done diff --git a/src/content/blog/1970/01/01/launch.adoc b/src/content/blog/1970/01/01/launch.adoc index c9e9c84..f82187d 100644 --- a/src/content/blog/1970/01/01/launch.adoc +++ b/src/content/blog/1970/01/01/launch.adoc @@ -1,5 +1,6 @@ = Service launch! That's it "$quote" && more :updatedat: 1971-02-03 +:categories: launch //// diff --git a/src/content/incidents/2000/01/01/service-start.adoc b/src/content/incidents/2000/01/01/service-start.adoc index e04d34f..9488ef9 100644 --- a/src/content/incidents/2000/01/01/service-start.adoc +++ b/src/content/incidents/2000/01/01/service-start.adoc @@ -1,4 +1,5 @@ = Service start! +:categories: launch link:https://papo.im[papo.im] is now available! See the link:https://papo.im/blog/1970/01/01/launch.html[annoucement article]. |