diff --git a/Makefile b/Makefile index 667b002..ed4d6e4 100644 --- a/Makefile +++ b/Makefile @@ -42,19 +42,19 @@ DOC := ./scripts/cls2tex.sh # generation... # XXX should these depend on the $(DOC) script ??? %.tex: %.sty %-meta.tex - $(DOC) $< $@ + $(DOC) $< > $@ %.tex: %.cls %-meta.tex - $(DOC) $< $@ + $(DOC) $< > $@ # NOTE: this is a bit ugly, but allot less so than trying to push \verb # into a LaTeX macro/env and then getting it out again in one pice... %-meta.tex: %.sty - $(DOC) -p M $< $@ + $(DOC) -p M $< > $@ %-meta.tex: %.cls - $(DOC) -p M $< $@ + $(DOC) -p M $< > $@ diff --git a/scripts/cls2tex.sh b/scripts/cls2tex.sh index fae8024..81c8049 100755 --- a/scripts/cls2tex.sh +++ b/scripts/cls2tex.sh @@ -22,6 +22,8 @@ printhelp(){ echo " - %% >> code -> \\begin{verbatim}code\\end{verbatim}" echo " - write the result to OUTPUT" echo + echo "If no INPUT is given $SCRIPT_NAME will read stdin." + echo echo "PREFIX can replace the second \"%\" in the above patterns to make it" echo "possible to integrate multiple layers of documentation in one file" echo "and to integrate them in various ways, for example, in the photobook" @@ -40,7 +42,7 @@ printhelp(){ printusage(){ echo "Usage:" - echo " $SCRIPT_NAME [OPTIONS] INPUT OUTPUT" + echo " $SCRIPT_NAME [OPTIONS] [INPUT]" } printerror(){ @@ -80,14 +82,13 @@ while true ; do esac done -INPUT=$1 +#INPUT=$1 +INPUT=${1:-/dev/stdin} -OUTPUT=$2 - -if [ -z $INPUT ] || [ -z $OUTPUT ] ; then - printerror "need both INPUT and OUTPUT present." - exit -fi +#if [ -z $INPUT ] ; then +# printerror "need INPUT path." +# exit +#fi # generate the module name... @@ -105,8 +106,7 @@ cat "$INPUT" \ | sed 's/%'$PREFIX'%%% \(.*\)/%'$PREFIX'\\subsection{\1}\\label{subsec:\1}/' \ | sed 's/%'$PREFIX'%% \(.*\)/%'$PREFIX'\\section{\1}\\label{sec:\1}/' \ | sed 's/%'$PREFIX'\s\+>>\s\+\(.*\)/%'$PREFIX'\\begin{verbatim} \1 \\end{verbatim}/' \ - | cut -c 3- - \ - > "$OUTPUT" + | cut -c 3- - #----------------------------------------------------------------------