From 327b83c6f6423386eef5a492d271698cc9b6ebea Mon Sep 17 00:00:00 2001 From: Torben <59419684+entorb@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:59:50 +0200 Subject: [PATCH] fixing followup error --- scripts/ebook/hpmor-ebook.tex | 4 ---- scripts/ebook/step_3.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) 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\}",