Process comments from a file
This commit is contained in:
parent
e03e20aabf
commit
ca068b23f0
5 changed files with 41 additions and 9 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
build/*
|
build/*
|
||||||
|
commentslist.py
|
||||||
feed.xml
|
feed.xml
|
||||||
__pycache__/
|
__pycache__/
|
||||||
secrets.py
|
secrets.py
|
||||||
|
|
18
build.sh
18
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
|
emacs --batch --no-site-file -l pre.el $i -l export.el -f org-html-export-to-html --kill
|
||||||
done
|
done
|
||||||
|
|
||||||
|
python3 comproc.py
|
||||||
|
|
||||||
|
for i in 20*.html; do
|
||||||
|
if test -f comm-$i; then
|
||||||
|
sed -i -e "/<!-- comments go here -->/{r comm-$i" -e "d}" $i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
python3 rssgen.py
|
python3 rssgen.py
|
||||||
|
|
||||||
for i in *.html; do
|
for i in 20*.html; do
|
||||||
thebase="${i%%.*}"
|
thebase="${i%%.*}"
|
||||||
dirname=${thebase//"-"/}
|
dirname=${thebase//"-"/}
|
||||||
mkdir build/$dirname
|
mkdir build/$dirname
|
||||||
mv $i build/$dirname/index.html
|
mv $i build/$dirname/index.html
|
||||||
done
|
done
|
||||||
|
|
||||||
mv readme.org tempfile
|
for i in 20*.org; do
|
||||||
|
|
||||||
for i in *.org; do
|
|
||||||
rm -f $i
|
rm -f $i
|
||||||
done
|
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
|
rclone copy build prazevps:/var/www/tre/public/notes -P
|
||||||
|
|
||||||
|
|
23
comproc.py
Normal file
23
comproc.py
Normal file
|
@ -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("<div class=\"comments\">\n<h2>n° " + str(commno) + "</h2>\n<p class=\"commenttime\"><code>" + datetime.datetime.strftime(comment["date"],"%Y-%m-%d") + "</code></p>\n<p>" + comment["body"] + "</p>\n")
|
||||||
|
try:
|
||||||
|
if len(comment["reply"]) > 0:
|
||||||
|
thefile.write("<div class=\"reply\">\n<p><span class=\"replystring\">reply: </span>" + comment["reply"] + "</p>\n</div>\n")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
thefile.write("</div>\n")
|
||||||
|
commno += 1
|
||||||
|
thefile.close()
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,6 @@
|
||||||
=secrets.py= should contain ~orgpath = "full path to journal root directory"~. With trailing slash it looks like.
|
=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
|
* to do
|
||||||
- inject comments somehow (s’il y en a)
|
- inject comments somehow (s’il y en a)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue