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 # NOTE: .sty and .cls are essentially the same in terms of documentation
# generation... # generation...
# XXX should these depend on $(DOC) ??? # XXX should these depend on the $(DOC) script ???
%.tex: %.sty %-meta.tex %.tex: %.sty %-meta.tex
$(DOC) $< $@ $(DOC) $< $@

View File

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