From 3cfcb4922411493851bce1ad87252365dc82c4f4 Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Thu, 19 Aug 2010 18:57:16 +0100 Subject: [PATCH] Build: fix for extra whitespace in makelsr.py Yes, it's ugly, but I can't figure out these stupid regexes. --- scripts/auxiliar/makelsr.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/auxiliar/makelsr.py b/scripts/auxiliar/makelsr.py index 1c671178d7..d012f1faca 100755 --- a/scripts/auxiliar/makelsr.py +++ b/scripts/auxiliar/makelsr.py @@ -210,6 +210,7 @@ def update_ly_in_place (snippet_path): snippet_path, visited_languages), contents) + need_line_break_workaround = False for language_code in langdefs.LANGDICT: if not language_code in visited_languages: base = os.path.splitext (os.path.basename (snippet_path))[0] @@ -219,7 +220,16 @@ def update_ly_in_place (snippet_path): texidoc_translation = open (texidoc_path).read () texidoc_translation = texidoc_translation.replace ('\\', '\\\\') contents = begin_header_re.sub ('\\g<0>\n' + texidoc_translation, contents, 1) + else: + need_line_break_workaround = True contents = doctitle_re.sub (doctitle_sub, contents) + # workaround for a bug in the regex's that I'm not smart + # enough to figure out. -gp + if need_line_break_workaround: + first_translated = contents.find('%% Translation of') + keep = contents[:first_translated+5] + contents = keep + contents[first_translated+5:].replace('%% Translation of', '\n%% Translation of') + open (snippet_path, 'w').write (contents) if in_dir: -- 2.39.2