changed the ATOM feed generation to use the git history instead of any files in src/
This commit is contained in:
parent
51e773a40f
commit
25948c7529
17
Makefile
17
Makefile
|
@ -4,24 +4,25 @@ SITEMAP_INDEX_FILES = $(wildcard src/*/index.gmi)
|
|||
|
||||
all: subdirs \
|
||||
$(SOURCES:src/%.gmi=html/%.html) \
|
||||
$(SOURCES:src/%.gmi=gmi/%.gmi) \
|
||||
$(SOURCES:src/%.png=html/%.png) \
|
||||
$(SOURCES:src/%.png=gmi/%.png) \
|
||||
$(SOURCES:src/%.webp=html/%.webp) \
|
||||
$(SOURCES:src/%.gmi=gmi/%.gmi) \
|
||||
$(SOURCES:src/%.png=gmi/%.png) \
|
||||
$(SOURCES:src/%.webp=gmi/%.webp) \
|
||||
gmi/sitemap.gmi \
|
||||
html/sitemap.html \
|
||||
gmi/feed.atom \
|
||||
html/sitemap.html \
|
||||
html/feed.atom \
|
||||
|
||||
upload:
|
||||
scp -r gmi/* techn0path@vern.cc:public_gemini
|
||||
scp -r html/* techn0path@vern.cc:public_html
|
||||
git push -u origin master
|
||||
|
||||
test: testing/input.gmi testing/input.ass
|
||||
test: testing/input.gmi testing/input_feed.txt
|
||||
mawk -f scripts/navbar.awk -f ~/projects/awk_functions/lib.awk -f scripts/html.awk -- testing/input.gmi > testing/output.html
|
||||
mawk -f scripts/navbar.awk -f ~/projects/awk_functions/lib.awk -f scripts/gemini.awk -- testing/input.gmi > testing/output.gmi
|
||||
mawk -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- testing/input.ass > testing/output.atom
|
||||
mawk -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- testing/input_feed.txt > testing/output.atom
|
||||
|
||||
subdirs:
|
||||
find src -mindepth 1 -type d -printf '%P\0' | xargs -0 -I{} mkdir -p gmi/{} html/{}
|
||||
|
@ -50,8 +51,8 @@ gmi/sitemap.gmi: $(SITEMAP_INDEX_FILES) scripts/sitemap_gmi.awk
|
|||
html/sitemap.html: $(SITEMAP_INDEX_FILES) scripts/sitemap_html.awk
|
||||
mawk -f ~/projects/awk_functions/lib.awk -f scripts/sitemap_html.awk -- $(SITEMAP_INDEX_FILES) > $@
|
||||
|
||||
gmi/feed.atom: src/feed.ass scripts/feed.awk
|
||||
mawk -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- $< > $@
|
||||
gmi/feed.atom: scripts/feed.awk
|
||||
git log --diff-filter=A --pretty=format:'%aI "%s"' --name-only src/ | mawk -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- - > $@
|
||||
|
||||
html/feed.atom: src/feed.ass scripts/feed.awk
|
||||
mawk -v 'willConvertLinks=1' -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- $< > $@
|
||||
git log --diff-filter=A --pretty=format:'%aI "%s"' --name-only src/ | mawk -v 'willConvertLinks=1' -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- - > $@
|
||||
|
|
8
feed.tsv
8
feed.tsv
|
@ -1,8 +0,0 @@
|
|||
# comments are not interpreted, so i can talk about stuff :D
|
||||
# possible entries
|
||||
# /hash
|
||||
# /title
|
||||
# /file
|
||||
# /content
|
||||
# > some content
|
||||
# > some moar
|
|
|
@ -1,36 +1,39 @@
|
|||
# variables that can be passed on the command line:
|
||||
# - willConvertLinks - convert local .gmi links to .html
|
||||
|
||||
# this converts the git history into an ATOM feed
|
||||
# the history should be passed in a specific format. for example
|
||||
# 2023-05-18T15:36:40+06:00 "added feed.txt, as well as scripts/new_feed_entry.el. i will soon generate my ATOM feeds using feed.txt instead of src/feed.ass"
|
||||
# feed.txt
|
||||
# scripts/new_feed_entry.el
|
||||
|
||||
BEGIN {
|
||||
FS = " "
|
||||
feedItems[0] = 0
|
||||
nfeedItems = 0
|
||||
FS = "\t"
|
||||
body = ""
|
||||
}
|
||||
|
||||
NF >= 2 && $0 !~ "^#" {
|
||||
/^[^#]/ {
|
||||
date = $1
|
||||
link = $2
|
||||
title = $2
|
||||
|
||||
if (willConvertLinks == 1 && link !~ "^[a-zA-Z0-9_]*:")
|
||||
sub("\\.gmi$", ".html", link)
|
||||
|
||||
$1 = ""
|
||||
$2 = ""
|
||||
|
||||
if (NF > 2) title = $0
|
||||
else title = ""
|
||||
sub("^([ ]*)", "", title)
|
||||
|
||||
|
||||
feedItems[nfeedItems, "title"] = title
|
||||
feedItems[nfeedItems, "date"] = date
|
||||
feedItems[nfeedItems, "link"] = link
|
||||
|
||||
nfeedItems ++
|
||||
getline
|
||||
while ($0 !~ "^[ ]*$") {
|
||||
body = body sprintf("\
|
||||
<entry>\n\
|
||||
<title>%s</title>\n\
|
||||
<link href='%s' />\n\
|
||||
<id>urn:uuid:%s</id>\n\
|
||||
<updated>%s</updated>\n\
|
||||
<summary>%s</summary>\n\
|
||||
</entry>\n", title " (" $0 ")", $0, uuid, date, title)
|
||||
|
||||
if (getline != 1) break
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
sprintf("date -u -r \"%s\" '+%%Y-%%m-%%dT%%TZ'", FILENAME) | getline feedLastUpdated
|
||||
uuid = hashbased_uuidgen("techn0path - " FILENAME, "@x500")
|
||||
sprintf("date -u \"+%%Y-%%m-%%dT%%TZ\"") | getline feedLastUpdated
|
||||
sprintf("uuidgen -s -n @x500 -N \"techn0path\"") | getline documentUuid
|
||||
|
||||
printf "<?xml version='1.0' encoding='UTF-8' ?>\n\
|
||||
<feed xmlns='http://www.w3.org/2005/Atom'>\n\
|
||||
|
@ -40,26 +43,7 @@ END {
|
|||
<name>techn0path</name>\n\
|
||||
</author>\n\
|
||||
<updated>%s</updated>\n\
|
||||
<id>urn:uuid:%s</id>\n", \
|
||||
feedLastUpdated, \
|
||||
uuid
|
||||
|
||||
for (i = 0; i < nfeedItems; i++) {
|
||||
sprintf("date -d \"%s\" '+%%Y-%%m-%%dT%%TZ'", feedItems[i, "date"]) | getline date
|
||||
|
||||
printf "<entry>\n\
|
||||
<title>%s</title>\n\
|
||||
<link href='%s' />\n\
|
||||
<id>urn:uuid:%s</id>\n\
|
||||
<updated>%s</updated>\n\
|
||||
<summary>%s</summary>\n\
|
||||
</entry>\n", \
|
||||
feedItems[i, "title"], \
|
||||
feedItems[i, "link"], \
|
||||
hashbased_uuidgen(feedItems[i, "title"] " - " feedItems[i, "date"], "@url"), \
|
||||
date, \
|
||||
feedItems[i, "title"]
|
||||
}
|
||||
|
||||
printf "</feed>"
|
||||
%s\n\
|
||||
</feed>\n", feedLastUpdated, documentUuid, body
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/execlineb
|
||||
elgetopt f:t:d:
|
||||
elgetpositionals
|
||||
foreground {
|
||||
echo $#
|
||||
}
|
||||
ifelse { test $# -lt 2 } {
|
||||
printf "usage: new_feed_entry [-f <file>] [-t <title>] [-d <description>]\n"
|
||||
} foreground {
|
||||
forx OPTION { ${@} } multisubstitute {
|
||||
importas -i OPTION OPTION
|
||||
elgetpositionals
|
||||
}
|
||||
case -s -- ${OPTION} {
|
||||
"-f" { echo $1 }
|
||||
"-t" { echo $1 }
|
||||
"-d" { echo $1 }
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
# comments
|
||||
# so yeah
|
||||
2030-01-01 this-is-the-future.gmi
|
||||
2030-01-01 not-the-past.gmi this is the future,not the past
|
|
@ -5,20 +5,84 @@
|
|||
<author>
|
||||
<name>techn0path</name>
|
||||
</author>
|
||||
<updated>2023-05-13T14:48:24Z</updated>
|
||||
<id>urn:uuid:bbf734b2-3682-5c45-b5eb-49d491d1f0d7</id>
|
||||
<updated>2023-05-24T11:11:26Z</updated>
|
||||
<id>urn:uuid:dad753cc-9f1a-55c9-afa5-0f6e50594ed5</id>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='this-is-the-future.gmi' />
|
||||
<id>urn:uuid:258db63b-a96f-5986-8154-586f2a6aae3a</id>
|
||||
<updated>2030-01-01T00:00:00Z</updated>
|
||||
<link href='hooks/post-commit' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-20T21:12:38+06:00 "renamed feed.txt to feed.tsv. added hooks. made all of the scripts in scripts/ executable"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>this is the future,not the past</title>
|
||||
<link href='not-the-past.gmi' />
|
||||
<id>urn:uuid:0abee9b4-5c42-534d-b1f0-0528757ee459</id>
|
||||
<updated>2030-01-01T00:00:00Z</updated>
|
||||
<summary>this is the future,not the past</summary>
|
||||
<title></title>
|
||||
<link href='feed.txt' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-18T15:36:40+06:00 "added feed.txt, as well as scripts/new_feed_entry.el. i will soon generate my ATOM feeds using feed.txt instead of src/feed.ass"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
</feed>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='scripts/new_feed_entry.el' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-18T15:36:40+06:00 "added feed.txt, as well as scripts/new_feed_entry.el. i will soon generate my ATOM feeds using feed.txt instead of src/feed.ass"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='testing/input.gmi' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-17T19:40:57+06:00 "renamed testing/example.ass and testing/example.gmi to testing/input.ass and testing/input.gmi. also added more content to testing/input.gmi for further testing"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='scripts/navbar.awk' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-17T19:07:04+06:00 "consolidated navigation bar generation logic into scripts/navbar.awk. also recorded new output testing/output.html as correct."</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='src/glossary.gmi' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-14T15:33:50+06:00 "added a glossary"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='testing/example.ass' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-14T15:30:49+06:00 "minor changes to scripts/html.awk. i dunno, stuff to do with the navigation bar i guess. also added snapshot testing via git-diff"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='testing/example.gmi' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-14T15:30:49+06:00 "minor changes to scripts/html.awk. i dunno, stuff to do with the navigation bar i guess. also added snapshot testing via git-diff"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='testing/output.atom' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-14T15:30:49+06:00 "minor changes to scripts/html.awk. i dunno, stuff to do with the navigation bar i guess. also added snapshot testing via git-diff"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='testing/output.gmi' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-14T15:30:49+06:00 "minor changes to scripts/html.awk. i dunno, stuff to do with the navigation bar i guess. also added snapshot testing via git-diff"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title></title>
|
||||
<link href='testing/output.html' />
|
||||
<id>urn:uuid:</id>
|
||||
<updated>2023-05-14T15:30:49+06:00 "minor changes to scripts/html.awk. i dunno, stuff to do with the navigation bar i guess. also added snapshot testing via git-diff"</updated>
|
||||
<summary></summary>
|
||||
</entry>
|
||||
|
||||
</feed>
|
||||
|
|
Loading…
Reference in New Issue