mirror of
https://github.com/flynx/photobook.git
synced 2025-11-01 20:00:13 +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...
|
# generation...
|
||||||
# XXX should these depend on the $(DOC) script ???
|
# XXX should these depend on the $(DOC) script ???
|
||||||
%.tex: %.sty %-meta.tex
|
%.tex: %.sty %-meta.tex
|
||||||
$(DOC) $< $@
|
$(DOC) $< > $@
|
||||||
|
|
||||||
%.tex: %.cls %-meta.tex
|
%.tex: %.cls %-meta.tex
|
||||||
$(DOC) $< $@
|
$(DOC) $< > $@
|
||||||
|
|
||||||
|
|
||||||
# NOTE: this is a bit ugly, but allot less so than trying to push \verb
|
# 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...
|
# into a LaTeX macro/env and then getting it out again in one pice...
|
||||||
%-meta.tex: %.sty
|
%-meta.tex: %.sty
|
||||||
$(DOC) -p M $< $@
|
$(DOC) -p M $< > $@
|
||||||
|
|
||||||
%-meta.tex: %.cls
|
%-meta.tex: %.cls
|
||||||
$(DOC) -p M $< $@
|
$(DOC) -p M $< > $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,8 @@ printhelp(){
|
|||||||
echo " - %% >> code -> \\begin{verbatim}code\\end{verbatim}"
|
echo " - %% >> code -> \\begin{verbatim}code\\end{verbatim}"
|
||||||
echo " - write the result to OUTPUT"
|
echo " - write the result to OUTPUT"
|
||||||
echo
|
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 "PREFIX can replace the second \"%\" in the above patterns to make it"
|
||||||
echo "possible to integrate multiple layers of documentation in one file"
|
echo "possible to integrate multiple layers of documentation in one file"
|
||||||
echo "and to integrate them in various ways, for example, in the photobook"
|
echo "and to integrate them in various ways, for example, in the photobook"
|
||||||
@ -40,7 +42,7 @@ printhelp(){
|
|||||||
|
|
||||||
printusage(){
|
printusage(){
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo " $SCRIPT_NAME [OPTIONS] INPUT OUTPUT"
|
echo " $SCRIPT_NAME [OPTIONS] [INPUT]"
|
||||||
}
|
}
|
||||||
|
|
||||||
printerror(){
|
printerror(){
|
||||||
@ -80,14 +82,13 @@ while true ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
INPUT=$1
|
#INPUT=$1
|
||||||
|
INPUT=${1:-/dev/stdin}
|
||||||
|
|
||||||
OUTPUT=$2
|
#if [ -z $INPUT ] ; then
|
||||||
|
# printerror "need INPUT path."
|
||||||
if [ -z $INPUT ] || [ -z $OUTPUT ] ; then
|
# exit
|
||||||
printerror "need both INPUT and OUTPUT present."
|
#fi
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# generate the module name...
|
# generate the module name...
|
||||||
@ -105,8 +106,7 @@ cat "$INPUT" \
|
|||||||
| sed 's/%'$PREFIX'%%% \(.*\)/%'$PREFIX'\\subsection{\1}\\label{subsec:\1}/' \
|
| sed 's/%'$PREFIX'%%% \(.*\)/%'$PREFIX'\\subsection{\1}\\label{subsec:\1}/' \
|
||||||
| sed 's/%'$PREFIX'%% \(.*\)/%'$PREFIX'\\section{\1}\\label{sec:\1}/' \
|
| sed 's/%'$PREFIX'%% \(.*\)/%'$PREFIX'\\section{\1}\\label{sec:\1}/' \
|
||||||
| sed 's/%'$PREFIX'\s\+>>\s\+\(.*\)/%'$PREFIX'\\begin{verbatim} \1 \\end{verbatim}/' \
|
| sed 's/%'$PREFIX'\s\+>>\s\+\(.*\)/%'$PREFIX'\\begin{verbatim} \1 \\end{verbatim}/' \
|
||||||
| cut -c 3- - \
|
| cut -c 3- -
|
||||||
> "$OUTPUT"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user