aboutsummaryrefslogtreecommitdiff
path: root/blog
diff options
context:
space:
mode:
Diffstat (limited to 'blog')
-rwxr-xr-xblog/build.sh9
-rwxr-xr-xblog/footers.py27
2 files changed, 32 insertions, 4 deletions
diff --git a/blog/build.sh b/blog/build.sh
index d7bce2b6..845845f7 100755
--- a/blog/build.sh
+++ b/blog/build.sh
@@ -8,12 +8,10 @@ HERE=$(pwd)
rm -rf $TARGET
cp -a content/ $TARGET
+echo Generating notes/interesting-projects
python3 ../interesting-projects/interesting-projects.py >$TARGET/notes/interesting-projects.gmi
-echo Converting gmi to html...
-
cd $TARGET
-find . -name '*.gmi' -print0 | xargs -0 coppewebite-to-html --css $HERE/style.css
echo Generating index...
cat >index.gmi <<EOF
@@ -31,7 +29,10 @@ find . -path './2???/??/*.gmi' -type f -print0 | coppewebite-indexer . >>index.g
echo Generating RSS...
coppewebite-to-rss <index.gmi https://alex.corcoles.net . >index.rss
-echo Converting index to HTML...
+$HERE/footers.py $HERE/content
+
+echo Converting to HTML
+find . -name '*.gmi' -print0 | xargs -0 coppewebite-to-html --css $HERE/style.css
coppewebite-to-html index.gmi --feed-title "El blog es mío" --feed-href index.rss --css $HERE/style.css
echo Done
diff --git a/blog/footers.py b/blog/footers.py
new file mode 100755
index 00000000..268f236d
--- /dev/null
+++ b/blog/footers.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+import pathlib
+import sys
+
+content = pathlib.Path(sys.argv[1])
+
+print("Generating footers...")
+
+CONTACT = {
+ "es": "Envíame email a alex arroba corcoles punto net.",
+ "en": "Send me email at alex at corcoles dot net.",
+}
+
+ENGLISH_PAGES = ('about.gmi', 'gemini.gmi',)
+
+
+for gmi in pathlib.Path.cwd().glob("**/*.gmi"):
+ relative_gmi = str(gmi.relative_to(pathlib.Path.cwd()))
+ if relative_gmi == "index.gmi":
+ # index.gmi is endless, no footer for that one
+ continue
+ language = "en" if relative_gmi in ENGLISH_PAGES or relative_gmi.startswith("notes/") else "es"
+ footer = [CONTACT[language]]
+ gmi_content = gmi.read_text()
+ assert gmi_content.endswith("\n"), f"{gmi} has no trailing new line"
+ assert not gmi_content.endswith("\n\n"), f"{gmi} has extra empty blank line"
+ gmi.write_text(gmi_content + "\n" + "\n".join(footer) + "\n")