From c284a1b5b3b18132b665fbb47da9f91548745190 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Tue, 2 Jan 2018 13:55:01 +0100 Subject: [PATCH] lyx_pot.py: consider empty encoding gui name (cherry picked from commit 43c05fe16b35d302352d540a30012b353342687a) --- po/lyx_pot.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/po/lyx_pot.py b/po/lyx_pot.py index b45f34f346..d16a139382 100755 --- a/po/lyx_pot.py +++ b/po/lyx_pot.py @@ -601,14 +601,16 @@ def encodings_l10n(input_files, output, base): output = io.open(output, 'w', encoding='utf_8', newline='\n') # assuming only one encodings file # Encoding utf8 utf8 "Unicode (utf8)" UTF-8 variable inputenc - reg = re.compile('Encoding [\w-]+\s+[\w-]+\s+"([\w \-\(\)]+)"\s+[\w-]+\s+(fixed|variable|variableunsafe)\s+\w+.*') + reg = re.compile('Encoding [\w-]+\s+[\w-]+\s+"([\w \-\(\)^"]*)"\s+["\w-]+\s+(fixed|variable|variableunsafe)\s+\w+.*') input = io.open(input_files[0], encoding='utf_8') for lineno, line in enumerate(input.readlines()): if not line.startswith('Encoding'): continue if reg.match(line): - print(u'#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % \ - (relativePath(input_files[0], base), lineno+1, reg.match(line).groups()[0]), file=output) + guiname = reg.match(line).groups()[0] + if guiname != "": + print(u'#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % \ + (relativePath(input_files[0], base), lineno+1, guiname), file=output) else: print("Error: Unable to handle line:") print(line)