summaryrefslogtreecommitdiff
path: root/bin/update_html
diff options
context:
space:
mode:
authorJohn J. Camilleri <john@digitalgrammars.com>2018-12-08 13:57:04 +0100
committerJohn J. Camilleri <john@digitalgrammars.com>2018-12-08 13:57:04 +0100
commit44ac326da0c1ad8a695e26074a30909e18d70371 (patch)
treed1ceb326f27588f11b7c675594c63c433e24f514 /bin/update_html
parenta8b23d52a883b796e3a05aaca8ec74b289408bcd (diff)
Regnerate HTML if template changes
Diffstat (limited to 'bin/update_html')
-rwxr-xr-xbin/update_html13
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/update_html b/bin/update_html
index e6e8877de..84bfa1cdb 100755
--- a/bin/update_html
+++ b/bin/update_html
@@ -21,6 +21,9 @@
# https://stackoverflow.com/a/246128/98600
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+# HTML template
+template="$DIR/template.html"
+
# Render txt2tags into html file
# Arguments:
# 1. txt2tags source file, e.g. download/index.t2t
@@ -64,7 +67,8 @@ function render_t2t_html {
--from=html \
--to=html5 \
--standalone \
- --template="$DIR/template.html" \
+ --template="$template" \
+ --variable="lang:en" \
--variable="rel-root:$relroot" \
--metadata="title:$title" \
--metadata="author:$author" \
@@ -93,7 +97,8 @@ function render_md_html {
--from=markdown \
--to=html5 \
--standalone \
- --template="$DIR/template.html" \
+ --template="$template" \
+ --variable="lang:en" \
--variable="rel-root:$relroot" \
"$md" \
--output="$html"
@@ -123,14 +128,14 @@ else
# Render all files found in cwd and deeper if source is newer
find . -name '*.t2t' | while read file ; do
html="${file%.t2t}.html"
- if [ "$file" -nt "$html" ] ; then
+ if [ "$file" -nt "$html" ] || [ "$template" -nt "$html" ] ; then
render_t2t_html "$file" "$html"
fi
done
find . -name '*.md' | while read file ; do
if [[ "$file" == *"README.md" ]] ; then continue ; fi
html="${file%.md}.html"
- if [ "$file" -nt "$html" ] ; then
+ if [ "$file" -nt "$html" ] || [ "$template" -nt "$html" ] ; then
render_md_html "$file" "$html"
fi
done