mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-09 03:02:50 -06:00
update_html also takes individual arguments
This commit is contained in:
@@ -7,10 +7,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 )"
|
||||||
|
|
||||||
find . -name '*.t2t' | while read t2t ; do
|
function render_html {
|
||||||
html="${t2t%.t2t}.html"
|
t2t=$1
|
||||||
if [ "$t2t" -nt "$html" ] ; then
|
html=$2
|
||||||
echo "$t2t"
|
|
||||||
relroot="$( dirname $t2t | sed -E 's/^.\///' | sed -E 's/[^/]+/../g' )"
|
relroot="$( dirname $t2t | sed -E 's/^.\///' | sed -E 's/[^/]+/../g' )"
|
||||||
pandoc \
|
pandoc \
|
||||||
--from=t2t \
|
--from=t2t \
|
||||||
@@ -24,8 +23,24 @@ find . -name '*.t2t' | while read t2t ; do
|
|||||||
if [ -f "$html" ] ; then
|
if [ -f "$html" ] ; then
|
||||||
sed -i.bak "s/<table>/<table class=\"table\">/" "$html" && rm "$html.bak"
|
sed -i.bak "s/<table>/<table class=\"table\">/" "$html" && rm "$html.bak"
|
||||||
sed -i.bak -E "s/\`\`(.+)\`\`/<code>\1<\/code>/g" "$html" && rm "$html.bak"
|
sed -i.bak -E "s/\`\`(.+)\`\`/<code>\1<\/code>/g" "$html" && rm "$html.bak"
|
||||||
|
echo "$html"
|
||||||
else
|
else
|
||||||
echo "Error creating $html"
|
echo "Error creating $html"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -gt 0 ] ; then
|
||||||
|
# Render spcific file(s) from args, ignoring dates
|
||||||
|
for t2t in "$@" ; do
|
||||||
|
html="${t2t%.t2t}.html"
|
||||||
|
render_html "$t2t" "$html"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
# Render all files found from cwd, if source is newer
|
||||||
|
find . -name '*.t2t' | while read t2t ; do
|
||||||
|
html="${t2t%.t2t}.html"
|
||||||
|
if [ "$t2t" -nt "$html" ] ; then
|
||||||
|
render_html "$t2t" "$html"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user