tired of trying to figure out how make and grep negotiate quoting and when, now will try and move things to a propper script... (in progress)

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-11-09 06:46:22 +03:00
parent 28aeeee3fe
commit 0e93f9e96a
2 changed files with 17 additions and 0 deletions

View File

@ -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 \

13
cls2tex.sh Executable file
View File

@ -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