mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 17:42:51 -06:00
Regnerate HTML if template changes
This commit is contained in:
@@ -21,6 +21,9 @@
|
|||||||
# https://stackoverflow.com/a/246128/98600
|
# https://stackoverflow.com/a/246128/98600
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
|
|
||||||
|
# HTML template
|
||||||
|
template="$DIR/template.html"
|
||||||
|
|
||||||
# Render txt2tags into html file
|
# Render txt2tags into html file
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1. txt2tags source file, e.g. download/index.t2t
|
# 1. txt2tags source file, e.g. download/index.t2t
|
||||||
@@ -64,7 +67,8 @@ function render_t2t_html {
|
|||||||
--from=html \
|
--from=html \
|
||||||
--to=html5 \
|
--to=html5 \
|
||||||
--standalone \
|
--standalone \
|
||||||
--template="$DIR/template.html" \
|
--template="$template" \
|
||||||
|
--variable="lang:en" \
|
||||||
--variable="rel-root:$relroot" \
|
--variable="rel-root:$relroot" \
|
||||||
--metadata="title:$title" \
|
--metadata="title:$title" \
|
||||||
--metadata="author:$author" \
|
--metadata="author:$author" \
|
||||||
@@ -93,7 +97,8 @@ function render_md_html {
|
|||||||
--from=markdown \
|
--from=markdown \
|
||||||
--to=html5 \
|
--to=html5 \
|
||||||
--standalone \
|
--standalone \
|
||||||
--template="$DIR/template.html" \
|
--template="$template" \
|
||||||
|
--variable="lang:en" \
|
||||||
--variable="rel-root:$relroot" \
|
--variable="rel-root:$relroot" \
|
||||||
"$md" \
|
"$md" \
|
||||||
--output="$html"
|
--output="$html"
|
||||||
@@ -123,14 +128,14 @@ else
|
|||||||
# Render all files found in cwd and deeper if source is newer
|
# Render all files found in cwd and deeper if source is newer
|
||||||
find . -name '*.t2t' | while read file ; do
|
find . -name '*.t2t' | while read file ; do
|
||||||
html="${file%.t2t}.html"
|
html="${file%.t2t}.html"
|
||||||
if [ "$file" -nt "$html" ] ; then
|
if [ "$file" -nt "$html" ] || [ "$template" -nt "$html" ] ; then
|
||||||
render_t2t_html "$file" "$html"
|
render_t2t_html "$file" "$html"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
find . -name '*.md' | while read file ; do
|
find . -name '*.md' | while read file ; do
|
||||||
if [[ "$file" == *"README.md" ]] ; then continue ; fi
|
if [[ "$file" == *"README.md" ]] ; then continue ; fi
|
||||||
html="${file%.md}.html"
|
html="${file%.md}.html"
|
||||||
if [ "$file" -nt "$html" ] ; then
|
if [ "$file" -nt "$html" ] || [ "$template" -nt "$html" ] ; then
|
||||||
render_md_html "$file" "$html"
|
render_md_html "$file" "$html"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user