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("
\n

n° " + str(commno) + "

\n

" + datetime.datetime.strftime(comment["date"],"%Y-%m-%d") + "

\n

" + comment["body"] + "

\n") + try: + if len(comment["reply"]) > 0: + thefile.write("
\n

reply: " + comment["reply"] + "

\n
\n") + except: + pass + thefile.write("
\n") + commno += 1 + thefile.close() diff --git a/export.el b/export.el index 8f8799b..8102959 100644 --- a/export.el +++ b/export.el @@ -104,10 +104,8 @@ holding export options." (when bridged (concat "

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.

")) (if havecomments - "
\n

Comments

\n\n

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.

\n

My replies to archived comments have not been archived.

\n
\n
\nOld emoticons I stole from the wayback machine\n
\n
:animesweat:
\n
:aww:
\n
:biggrin:
\n
:blankstare:
\n
:bleh:
\n
:boogie:
\n
:bounce:
\n
:bow:
\n
:bump:
\n
:cd:
\n
:clap:
\n
:confused:
\n
:cool:
\n
:dance:
\n
:dead:
\n
:eager:
\n
:eek:
\n
:giggle:
\n
:headbang:
\n
:la:
\n
:lmao:
\n
:meow:
\n
:ninja:
\n
:nod:
\n
:ohnoes:
\n
:razz:
\n
:rofl:
\n
:sad:
\n
:shrug:
\n
:smile:
\n
:tombstone:
\n
:tongue:
\n
:typing:
\n
:wave:
\n
:wink:
\n
:winkrazz:
\n
:woot:
\n
:worry:
\n
:worship:
\n
:xd:
\n
\n
\n\n\n
\n\n
\n
\n\n
\n\n
\n
\n") - "\n" - "\n" - "\n" + "
\n

Comments

\n\n

You 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
\nOld emoticons I stole from the wayback machine\n
\n
:animesweat:
\n
:aww:
\n
:biggrin:
\n
:blankstare:
\n
:bleh:
\n
:boogie:
\n
:bounce:
\n
:bow:
\n
:bump:
\n
:cd:
\n
:clap:
\n
:confused:
\n
:cool:
\n
:dance:
\n
:dead:
\n
:eager:
\n
:eek:
\n
:giggle:
\n
:headbang:
\n
:la:
\n
:lmao:
\n
:meow:
\n
:ninja:
\n
:nod:
\n
:ohnoes:
\n
:razz:
\n
:rofl:
\n
:sad:
\n
:shrug:
\n
:smile:
\n
:tombstone:
\n
:tongue:
\n
:typing:
\n
:wave:
\n
:wink:
\n
:winkrazz:
\n
:woot:
\n
:worry:
\n
:worship:
\n
:xd:
\n
\n
\n\n\n
\n\n
\n
\n\n
\n\n
\n
\n") + "\n\n\n" (format "\n" (nth 1 (assq 'content (plist-get info :html-divs)))) ;; Postamble. (org-html--build-pre/postamble 'postamble info) diff --git a/readme.org b/readme.org index 7b175bc..bed6170 100644 --- a/readme.org +++ b/readme.org @@ -1,4 +1,6 @@ =secrets.py= should contain ~orgpath = "full path to journal root directory"~. With trailing slash it looks like. +=commentslist.py= should be symlinked into this folder. + * to do - inject comments somehow (s’il y en a)