diff --git a/scripts/ebook/hpmor-ebook.tex b/scripts/ebook/hpmor-ebook.tex index 398603a0..cbd003ea 100644 --- a/scripts/ebook/hpmor-ebook.tex +++ b/scripts/ebook/hpmor-ebook.tex @@ -7,10 +7,6 @@ \input{layout/hp-intro} -\renewenvironment{headlines}{}{} -\renewenvironment{writtenNote}{}{} -\renewenvironment{playdialog}{}{} - \newcommand{\writtenNoteA}[1]{\par\textcolor{writtenNote}{#1}} \renewcommand{\parsel}[1]{\textcolor{parsel}{#1}} \renewcommand{\McGonagallWhiteBoard}[1]{\textcolor{McGonagallWhiteBoard}{\par#1}} diff --git a/scripts/ebook/step_3.py b/scripts/ebook/step_3.py index f14a275a..fcc18c3f 100755 --- a/scripts/ebook/step_3.py +++ b/scripts/ebook/step_3.py @@ -25,6 +25,16 @@ date_str = dt.datetime.now(dt.UTC).date().strftime("%d.%m.%Y") cont = cont.replace("\\today{}", date_str) + # empty the newenvironments: headlines, writtenNote, playdialog + # to prevent implications on other cleanup scripts + cont = re.sub( + r"\\newenvironment\{(headlines|writtenNote|playdialog)\}.*?\n\n", + r"\\newenvironment{\1}{}{}\n\n", + cont, + flags=re.DOTALL, + count=3, + ) + # writtenNote env -> \writtenNoteA cont = re.sub( r"\s*\\begin\{writtenNote\}\s*(.*?)\s*\\end\{writtenNote\}",