mirror of
https://github.com/flynx/photobook.git
synced 2025-10-28 18:00:10 +00:00
made the cls2doc.sh a bit more UN*Xy...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e0e498543c
commit
c35e73c409
8
Makefile
8
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 $< > $@
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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- -
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user