diff --git a/Makefile b/Makefile index de119a6..5469056 100644 --- a/Makefile +++ b/Makefile @@ -28,9 +28,13 @@ TEX := latexmk -lualatex $(ARGS) # 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. +# # XXX BUG: for some odd reason this produces different results when called # from 'bash' and 'bash --login -i', mainly the egrep rule seems # to be broken... +# ...also appears to be broken under termux... +# .....seems that moving this out to a script would be the simplest way +# to solve this odd instability... texToDoc = \ @echo "texToDoc: $1 -> $2"; \ cat $1 \ diff --git a/cls2tex.sh b/cls2tex.sh new file mode 100755 index 0000000..35c4848 --- /dev/null +++ b/cls2tex.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# usage: cls2tex.sh INPUT OUTPUT PREFIX + +cat $1 \ + | egrep '(^%$3|^\\\\edef\\\\$*@[A-Z][A-Z]+)' \ + | sed 's/^\(\\\\edef\\\\\)$*@/%$3\\1/'\ + | sed 's/%$3%%%% \(.*\)/%$3\\\\subsubsection{\1}\\\\label{subsubsec:\1}/' \ + | sed 's/%$3%%% \(.*\)/%$3\\\\subsection{\1}\\\\label{subsec:\1}/' \ + | sed 's/%$3%% \(.*\)/%$3\\\\section{\1}\\\\label{sec:\1}/' \ + | sed 's/%$3\s\+>>\s\+\(.*\)/%$3\\\\begin{verbatim} \1 \\\\end{verbatim}/' \ + | cut -c 3- - > $2 +