diff --git a/.gitignore b/.gitignore index e345553..346da43 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/* +commentslist.py feed.xml __pycache__/ secrets.py diff --git a/build.sh b/build.sh index 2b8ff3c..68d3357 100755 --- a/build.sh +++ b/build.sh @@ -13,22 +13,30 @@ for i in 20*.org; do emacs --batch --no-site-file -l pre.el $i -l export.el -f org-html-export-to-html --kill done +python3 comproc.py + +for i in 20*.html; do + if test -f comm-$i; then + sed -i -e "//{r comm-$i" -e "d}" $i + fi +done + python3 rssgen.py -for i in *.html; do +for i in 20*.html; do thebase="${i%%.*}" dirname=${thebase//"-"/} mkdir build/$dirname mv $i build/$dirname/index.html done -mv readme.org tempfile - -for i in *.org; do +for i in 20*.org; do rm -f $i done -mv tempfile readme.org +for i in comm*.html; do + rm -f $i +done rclone copy build prazevps:/var/www/tre/public/notes -P diff --git a/comproc.py b/comproc.py new file mode 100644 index 0000000..153d468 --- /dev/null +++ b/comproc.py @@ -0,0 +1,23 @@ +import datetime +import commentslist + +commented = [] +for comment in commentslist.comments: + commented.append(comment["slug"]) + +commented = sorted(list(dict.fromkeys(commented))) + +for slug in commented: + thefile = open("comm-" + str(slug)[0:4] + "-" + str(slug)[4:6] + "-" + str(slug)[6:8] + ".html","w") + commno = 1 + for comment in commentslist.comments: + if comment["slug"] == slug: + thefile.write("
You can find this post on the fediverse by searching for https://fed.brid.gy/r/https://tre.praze.net/notes/" thedate "/
in your fediverse client.
You can comment on this post/this fic if you like. Comments will be posted below after moderation. All comments are anonymous and email addresses, if provided, will not be published.
\nMy replies to archived comments have not been archived.
\n\nYou can comment on this post if you like. Comments will be posted below after moderation. All comments are anonymous and email addresses, if provided, will not be published.
\n\n
n° " + str(commno) + "
\n
\n" + datetime.datetime.strftime(comment["date"],"%Y-%m-%d") + "
" + comment["body"] + "
\n") + try: + if len(comment["reply"]) > 0: + thefile.write("reply: " + comment["reply"] + "
\n