#!/bin/sh

if [ -e ./config.sh ]; then
    . ./config.sh
fi

[ -z "$baseURL" ] &&
    export baseURL="$PWD" 

echo baseURL="$baseURL"

find . -name '*.gmi' |
    while read file; do
        htmlfile=$(dirname "$file")/$(basename "$file" .gmi).html
        if [ ! -e "$htmlfile" ] || [ "$file" -nt "$htmlfile" ]; then
            echo "Creando $htmlfile"
            ./gmi2html "$file" > "$htmlfile"
        fi
    done