made the cls2doc.sh even more UN*Xy (and returning the old signature that did not have to go ;) )...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-11-23 01:16:37 +03:00
parent c35e73c409
commit 5209e221d1

View File

@ -22,7 +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 "If no OUTPUT is given $SCRIPT_NAME will read stdout. If no INPUT"
echo "is given $SCRIPT_NAME will read stdin."
echo 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"
@ -42,7 +43,7 @@ printhelp(){
printusage(){ printusage(){
echo "Usage:" echo "Usage:"
echo " $SCRIPT_NAME [OPTIONS] [INPUT]" echo " $SCRIPT_NAME [OPTIONS] [[INPUT] OUTPUT]"
} }
printerror(){ printerror(){
@ -82,13 +83,9 @@ while true ; do
esac esac
done done
#INPUT=$1
INPUT=${1:-/dev/stdin} INPUT=${1:-/dev/stdin}
#if [ -z $INPUT ] ; then OUTPUT=${2:-/dev/stdout}
# printerror "need INPUT path."
# exit
#fi
# generate the module name... # generate the module name...
@ -106,7 +103,8 @@ 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"
#---------------------------------------------------------------------- #----------------------------------------------------------------------