diff --git a/Makefile b/Makefile index d040a4e..0fab22f 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ SHELL := bash # LaTeX... ARGS := -# NOTE: need to run latex two times to build index, the simpler way to +# NOTE: need to run latex two+ times to build index, the simpler way to # go is to use latexmk... #TEX := lualatex $(ARGS) TEX := latexmk -lualatex $(ARGS) diff --git a/photobook.cls b/photobook.cls index 79299f4..b253796 100644 --- a/photobook.cls +++ b/photobook.cls @@ -691,7 +691,7 @@ \newlength\bindingoffset \setlength\bindingoffset{\photobook@bindingoffset} -%% \DescribeMacro{\defaultfoldout=} +%% \DescribeMacro{\defaultfoldout=} % %% Set the default fold specification. %% diff --git a/scripts/cls2tex.sh b/scripts/cls2tex.sh index 0582a36..d6e7732 100755 --- a/scripts/cls2tex.sh +++ b/scripts/cls2tex.sh @@ -1,22 +1,37 @@ #!/usr/bin/env bash -# Generate docs from latex package/class... -# -# Usage: cls2tex.sh INPUT OUTPUT [PREFIX] -# -# - keep lines starting with \def\@[A-Z]\+ -# - keep lines starting with '%%' -# - %%%%% Text -> \subsection(Text) -# - %%%% Text -> \section(Text) -# - %% >> code -> \begin{verbatim}code\end{verbatim} -# -# NOTE: the idea of keeping latex docs in a latex file is far similar -# than all the stuff crammed into .dtx, at least for my needs: -# - keep the code readable -# - keep the docs readable -# in both the repo and in installed form. -# NOTE: this is evolving as need arises, when this gets too complicated -# we'll split it out into it's own script. +printhelp(){ + echo "Generate docs from latex package/class" + echo + echo "Usage: $(basename $0) [-h] INPUT OUTPUT [PREFIX]" + echo + echo "This will:" + echo " - keep lines starting with \\def\\@[A-Z]\\+" + echo " - keep lines starting with '%%'" + echo " - %%%%% Text -> \\subsection(Text)" + echo " - %%%% Text -> \\section(Text)" + echo " - %% >> code -> \\begin{verbatim}code\\end{verbatim}" + echo + echo "NOTE: the idea of keeping latex docs in a latex file is far simpler" + echo " than all the stuff crammed into .dtx, at least for my needs:" + echo " - keep the code readable" + echo " - keep the docs readable" + echo " in both the repo and in installed form, so .dtx is not used." +} + +# args/defaults... +while true ; do + case $1 in + -h|--help) + printhelp + exit + ;; + + *) + break + ;; + esac +done INPUT=$1 @@ -28,6 +43,7 @@ if [ -z $PREFIX ] ; then fi +# do the work... cat "$INPUT" \ | egrep '(^%'$PREFIX'|^\\edef\\.*@[A-Z][A-Z]+)' \ | sed 's/^\(\\edef\\\).*@/%'$PREFIX'\1/' \ @@ -35,7 +51,8 @@ cat "$INPUT" \ | sed 's/%'$PREFIX'%%% \(.*\)/%'$PREFIX'\\subsection{\1}\\label{subsec:\1}/' \ | sed 's/%'$PREFIX'%% \(.*\)/%'$PREFIX'\\section{\1}\\label{sec:\1}/' \ | sed 's/%'$PREFIX'\s\+>>\s\+\(.*\)/%'$PREFIX'\\begin{verbatim} \1 \\end{verbatim}/' \ - | cut -c 3- - > "$OUTPUT" + | cut -c 3- - \ + > "$OUTPUT" # vim:set ts=4 sw=4 nowrap :