cleanup....

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-11-21 17:05:41 +03:00
parent dc05a7c3c4
commit e0e498543c
2 changed files with 22 additions and 15 deletions

View File

@ -40,7 +40,7 @@ DOC := ./scripts/cls2tex.sh
# NOTE: .sty and .cls are essentially the same in terms of documentation
# generation...
# XXX should these depend on $(DOC) ???
# XXX should these depend on the $(DOC) script ???
%.tex: %.sty %-meta.tex
$(DOC) $< $@

View File

@ -1,18 +1,8 @@
#!/usr/bin/env bash
#----------------------------------------------------------------------
SCRIPT_NAME=$(basename $0)
printusage(){
echo "Usage:"
echo " $SCRIPT_NAME [OPTIONS] INPUT OUTPUT"
}
printerror(){
echo Error: $@
echo
printusage
}
printhelp(){
echo "Generate docs from latex package/class"
echo
@ -48,11 +38,24 @@ printhelp(){
echo " in both the repo and in installed form, so .dtx is not used."
}
printusage(){
echo "Usage:"
echo " $SCRIPT_NAME [OPTIONS] INPUT OUTPUT"
}
printerror(){
echo Error: $@
echo
printusage
}
#----------------------------------------------------------------------
# Args and defaults...
# defaults...
PREFIX=%
# args...
while true ; do
case $1 in
-h|--help)
@ -91,7 +94,10 @@ fi
MODULE=$(basename "$INPUT")
MODULE=${MODULE/.*/}
#----------------------------------------------------------------------
# do the work...
cat "$INPUT" \
| egrep '(^%'$PREFIX'|^\\edef\\'$MODULE'@[A-Z][A-Z]+)' \
| sed 's/^\(\\edef\\\)'$MODULE'@/%'$PREFIX'\1/' \
@ -103,4 +109,5 @@ cat "$INPUT" \
> "$OUTPUT"
#----------------------------------------------------------------------
# vim:set ts=4 sw=4 nowrap :