diff --git a/scripts/check_chapters.py b/scripts/check_chapters.py index e0e5707c9..cf2766cf2 100755 --- a/scripts/check_chapters.py +++ b/scripts/check_chapters.py @@ -609,9 +609,9 @@ def fix_spell(s: str) -> str: # V2: using multiprocessing # prepare num_processes = min(cpu_count(), len(list_of_chapter_files)) - pool = Pool(processes=num_processes) - # run - results = pool.map(process_file, list_of_chapter_files) + with Pool(processes=num_processes) as pool: + # run + results = pool.map(process_file, list_of_chapter_files) any_issue_found = True in results # V1: single processing diff --git a/scripts/ebook/step_3.py b/scripts/ebook/step_3.py index 8e00812bb..515dc5662 100755 --- a/scripts/ebook/step_3.py +++ b/scripts/ebook/step_3.py @@ -86,7 +86,7 @@ # not used in DE version # \censor - cont = re.sub(r"\\censor\{.*?\}", r"xxxxxx", cont) + cont = re.sub(r"\\censor\{[^}]*\}", r"xxxxxx", cont) # # remove Deathly_Hallows_Sign.pdf and other pdf images # # \includegraphics[scale=0.125]{images/Deathly_Hallows_Sign.pdf} diff --git a/scripts/ebook/step_6.py b/scripts/ebook/step_6.py index 62bca5656..7b432d221 100755 --- a/scripts/ebook/step_6.py +++ b/scripts/ebook/step_6.py @@ -23,7 +23,7 @@ def fix_ellipsis(s: str) -> str: # 1. remove all spaces around ellipsis s = re.sub(r" *… *", "…", s) # 2. recreate some spaces - # before punctuation : no space, so governed by 1. + # before punctuation : no space, so covered by 1. # between words s = re.sub(r"(?<=[\w])…(?=[\w])", "… ", s) # after punctuation: add space