diff options
Diffstat (limited to 'gmi2htmldir.sh')
-rwxr-xr-x | gmi2htmldir.sh | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/gmi2htmldir.sh b/gmi2htmldir.sh index bdd0234..42babfb 100755 --- a/gmi2htmldir.sh +++ b/gmi2htmldir.sh @@ -1,3 +1,4 @@ +#!/bin/sh # # gmi2htmldir.sh -- POSIX shell script to convert a folder of Gemini files to HTML files # @@ -17,19 +18,25 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # usage: -# $ sh gmi2htmldir.sh <folder> <params> +# $ ./gmi2htmldir.sh <in> <out> title=<title> css=<css> url=<url> # # parameters: -# <folder>: the folder of Gemini files to be converted; the HTML files are outputted -# to the same directory, unless the directory contains the string 'gemini' - -# in that case, the string 'gemini' is replaced with 'html' in the output -# path (this is the recommended approach for separating input and output files) -# <params>: parameters to pass to gmi2html.awk; see gmi2html.awk for more details +# <in>: the folder of Gemini files to be converted +# <out>: the folder in which to put the generated HTML files +# <title>, <css>, <url>: parameters passed to gmi2html.awk; see gmi2html.awk for more details +# + +in=$1 +out=$2 +title=$3 +css=$4 +url=$5 -folder=$1 -params=$2 +gmi2html=${PWD}/$(dirname $0)/gmi2html.awk -for f in $(find $folder -name "*.gmi"); do - HTML_FILENAME=$(echo $f | sed s/gmi/html/g | sed s/gemini/html/g) - awk -f gmi2html -- $params < $f > $HTML_FILENAME +cd $in +for f in *.gmi **/*.gmi; do + HTML_FILENAME=$out/${f%.gmi}.html + echo "processing: ${f} -> ${HTML_FILENAME}" + awk -f $gmi2html -v $title -v $css -v $url < $f > $HTML_FILENAME done |