about summary refs log tree commit diff stats
path: root/build/latex/presentation/scripts
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-04 12:31:16 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-04 12:31:16 +0200
commit1cb8504a4dfcf5977411267c80d4ee62a180c2d6 (patch)
tree69c696740bdc1a8c6b9c205ec0d3c2c47cd2e32b /build/latex/presentation/scripts
parentfix(templates/latex/academia/main.tex): Default to `draft` mode (diff)
downloadflake-templates-1cb8504a4dfcf5977411267c80d4ee62a180c2d6.tar.gz
flake-templates-1cb8504a4dfcf5977411267c80d4ee62a180c2d6.zip
chore(build): Regenerate
Diffstat (limited to 'build/latex/presentation/scripts')
-rwxr-xr-xbuild/latex/presentation/scripts/fix_notes.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/build/latex/presentation/scripts/fix_notes.sh b/build/latex/presentation/scripts/fix_notes.sh
new file mode 100755
index 0000000..c5caf5b
--- /dev/null
+++ b/build/latex/presentation/scripts/fix_notes.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env sh
+
+# Compiling this document with pdflatex, will leave all utf8 chars in the `\note`s
+# mangled. But, `pdfpc` interprets them as markdown, thus replacing all of them with their
+# respective html entities results in them looking correct in during the presentation.
+#
+# This script automatically replaces them in the source files.
+#
+# # Known Bugs
+# It does not account for `\note`s spanning multiple lines. So, for example, this would not
+# be fixed:
+# ```latex
+# \note {
+#   Ästhetik ist hierbei nicht mit den Wundern der Kunst zu verwechseln.
+# }
+# ```
+
+rg '\\note' --files-with-matches | while IFS= read -r file; do
+    [ "$(basename "$file")" = "$(basename "$0")" ] && continue
+
+    echo "Fixing: '$file'"
+    sed --in-place 's/^\(.*\)\\note\(.*\){\(.*\)}/printf "%s\\\\\\note%s{%s}" "\1" "\2" "$( echo "\3" | sed "s@ä@\\\&auml\;@g" | sed "s@ö@\\\&ouml\;@g" | sed "s@ü@\\\&uuml\;@g" | sed "s@Ä@\\\&Auml\;@g" | sed "s@Ö@\\\&Ouml\;@g" | sed "s@Ü@\\\&Uuml\;@g" | sed "s@ß@\\\&szlig\;@g" | sed "s@→@\\\&rarr\;@g" )"/eg' "$file"
+done