cleanup and docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-11-16 00:58:45 +03:00
parent 919f02fb3d
commit f4ceb108e6
3 changed files with 37 additions and 20 deletions

View File

@ -22,7 +22,7 @@ SHELL := bash
# LaTeX... # LaTeX...
ARGS := 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... # go is to use latexmk...
#TEX := lualatex $(ARGS) #TEX := lualatex $(ARGS)
TEX := latexmk -lualatex $(ARGS) TEX := latexmk -lualatex $(ARGS)

View File

@ -691,7 +691,7 @@
\newlength\bindingoffset \newlength\bindingoffset
\setlength\bindingoffset{\photobook@bindingoffset} \setlength\bindingoffset{\photobook@bindingoffset}
%% \DescribeMacro{\defaultfoldout=<fold-spce>} %% \DescribeMacro{\defaultfoldout=<fold-spec>}
% %
%% Set the default fold specification. %% Set the default fold specification.
%% %%

View File

@ -1,22 +1,37 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Generate docs from latex package/class... printhelp(){
# echo "Generate docs from latex package/class"
# Usage: cls2tex.sh INPUT OUTPUT [PREFIX] echo
# echo "Usage: $(basename $0) [-h] INPUT OUTPUT [PREFIX]"
# - keep lines starting with \def\<module-name>@[A-Z]\+ echo
# - keep lines starting with '%%' echo "This will:"
# - %%%%% Text -> \subsection(Text) echo " - keep lines starting with \\def\\<module-name>@[A-Z]\\+"
# - %%%% Text -> \section(Text) echo " - keep lines starting with '%%'"
# - %% >> code -> \begin{verbatim}code\end{verbatim} echo " - %%%%% Text -> \\subsection(Text)"
# echo " - %%%% Text -> \\section(Text)"
# NOTE: the idea of keeping latex docs in a latex file is far similar echo " - %% >> code -> \\begin{verbatim}code\\end{verbatim}"
# than all the stuff crammed into .dtx, at least for my needs: echo
# - keep the code readable echo "NOTE: the idea of keeping latex docs in a latex file is far simpler"
# - keep the docs readable echo " than all the stuff crammed into .dtx, at least for my needs:"
# in both the repo and in installed form. echo " - keep the code readable"
# NOTE: this is evolving as need arises, when this gets too complicated echo " - keep the docs readable"
# we'll split it out into it's own script. 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 INPUT=$1
@ -28,6 +43,7 @@ if [ -z $PREFIX ] ; then
fi fi
# do the work...
cat "$INPUT" \ cat "$INPUT" \
| egrep '(^%'$PREFIX'|^\\edef\\.*@[A-Z][A-Z]+)' \ | egrep '(^%'$PREFIX'|^\\edef\\.*@[A-Z][A-Z]+)' \
| sed 's/^\(\\edef\\\).*@/%'$PREFIX'\1/' \ | sed 's/^\(\\edef\\\).*@/%'$PREFIX'\1/' \
@ -35,7 +51,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- - > "$OUTPUT" | cut -c 3- - \
> "$OUTPUT"
# vim:set ts=4 sw=4 nowrap : # vim:set ts=4 sw=4 nowrap :