diff --git a/photobook.cls b/photobook.cls index e8bf0c0..f6d4e03 100644 --- a/photobook.cls +++ b/photobook.cls @@ -24,6 +24,12 @@ % $ make doc % % +% NOTE: in a stripped code install this file may contain only code and +% code comments, in this case, to see the docs refer to either the +% source or the actual documentation/pdf. +% NOTE: the stripped code file is auto-generated, it is not recommended +% to edit it directly, edit the source instead. +% % % XXX Q: do we add the pdf to the repo and if so, should it be % compressed (diff-able) or uncompressed (blob)?? diff --git a/scripts/cls2tex.sh b/scripts/cls2tex.sh index 15313f1..370eb8f 100755 --- a/scripts/cls2tex.sh +++ b/scripts/cls2tex.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash #---------------------------------------------------------------------- +CMD="$0 $@" + SCRIPT_NAME=$(basename $0) printusage(){ @@ -18,6 +20,7 @@ printhelp(){ echo " -p | --prefix PREFIX" echo " Set the doc comment PREFIX (default: \"%\")" echo " -s | --strip Strip docs out" + echo " -n | --no-msg Don't add the \"generated with\" message to output" echo echo "This will:" echo " - read the INPUT" @@ -57,6 +60,17 @@ printerror(){ printusage } +printmsg(){ + # print message... + if [ -z $NO_MSG ] ; then + echo "%----------------------------------------------------------------------" + echo "% $1 file generated by:" + echo "% $CMD" + echo "% NOTE: multiple messages indicate multiple runs." + echo "%----------------------------------------------------------------------" + fi +} + #---------------------------------------------------------------------- @@ -79,6 +93,10 @@ while true ; do STRIP_DOC=1 shift ;; + -n|--no-msg) + NO_MSG=1 + shift + ;; # handle unknown options... -*|--*) @@ -108,6 +126,8 @@ MODULE=${MODULE/.*/} # make docs... if [ -z $STRIP_DOC ] ; then + printmsg "Documentation" \ + > "$OUTPUT" cat "$INPUT" \ | egrep '(^%'$PREFIX'|^\\edef\\'$MODULE'@[A-Z][A-Z]+)' \ | sed 's/^\(\\edef\\\)'$MODULE'@/%'$PREFIX'\1/' \ @@ -116,14 +136,16 @@ if [ -z $STRIP_DOC ] ; then | sed 's/%'$PREFIX'%% \(.*\)/%'$PREFIX'\\section{\1}\\label{sec:\1}/' \ | sed 's/%'$PREFIX'\s\+>>\s\+\(.*\)/%'$PREFIX'\\begin{verbatim} \1 \\end{verbatim}/' \ | cut -c 3- - \ - > "$OUTPUT" + >> "$OUTPUT" # make stripped code... else + printmsg "Stripped code" \ + > "$OUTPUT" cat "$INPUT" \ | egrep -v '%'$PREFIX'' \ | egrep -v '^(\s*%)?\s*$' \ - > "$OUTPUT" + >> "$OUTPUT" fi