@@ -23,14 +23,21 @@ for p in pandoc tidy; do
2323done
2424
2525ALL="$*"
26−ARGS=${ALL%%-- *}
27−REST=${ALL#$ARGS}
26+ARGS=${ALL%% -- *} # only the part before ' -- ' delimiters is relevant
27+set -- $ARGS
2828
29−REST=${REST#--}
29+REST=${ALL#$ARGS}; REST=${REST#--}
3030PANDOC_OPTS=${REST:-$PANDOC_OPTS}
3131
32−if [ -z "$1" ] || [ -f $1 ]; then
33− tidy -utf8 $1 2>/dev/null | \
32+infile=$1
33+shift
34+
35+if [ -n "$@" ]; then
36+ echo >&2 "Warning: extra arguments '$@' will be ignored!"
37+fi
38+
39+if [ -z "$infile" ] || [ -f $infile ]; then
40+ tidy -utf8 $infile 2>/dev/null | \
3441 pandoc $PANDOC_OPTS -r html -w markdown -s | \
3542 iconv -f utf-8
3643else
@@ -55,7 +62,7 @@ else
5562 exit 1 ;;
5663 esac
5764 # Fetch and feed to pandoc.
58− $DUMPER $OPT $1 2>/dev/null | \
65+ $DUMPER $OPT $infile 2>/dev/null | \
5966 tidy -utf8 2>/dev/null | \
6067 pandoc $PANDOC_OPTS -r html -w markdown -s | \
6168 iconv -f utf-8