diff options
| author | John J. Camilleri <john@digitalgrammars.com> | 2018-11-04 19:29:56 +0100 |
|---|---|---|
| committer | John J. Camilleri <john@digitalgrammars.com> | 2018-11-04 19:29:56 +0100 |
| commit | 914d54255fe81301773adfab1a2d8c0319afcd9a (patch) | |
| tree | ab45719f4830ab3066f404775e98c70314c18fc0 /bin/update_html | |
| parent | aea8548930fd58d5302aa6381376adbb8a2be2d4 (diff) | |
Comments in update_html script
Diffstat (limited to 'bin/update_html')
| -rwxr-xr-x | bin/update_html | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/update_html b/bin/update_html index 126072e44..a5194bbdd 100755 --- a/bin/update_html +++ b/bin/update_html @@ -1,12 +1,13 @@ #!/bin/bash -### This script finds all .t2t (txt2tags) files and updates the corresponding -### .html file, if it is out-of-date. - -# Path to this directory (not CWD) +# Path to directory where this script is # https://stackoverflow.com/a/246128/98600 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +# Render txt2tags into html file +# Arguments: +# 1. txt2tags source file, e.g. download/index.t2t +# 2. html target filen, e.g. download/index.html function render_html { t2t=$1 html=$2 @@ -30,13 +31,13 @@ function render_html { } if [ $# -gt 0 ] ; then - # Render spcific file(s) from args, ignoring dates + # Render specific 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 + # Render all files found in cwd, and below, if source is newer find . -name '*.t2t' | while read t2t ; do html="${t2t%.t2t}.html" if [ "$t2t" -nt "$html" ] ; then |
