From: John Mandereau Date: Sat, 25 Jul 2009 10:52:15 +0000 (+0200) Subject: Add script to split texidocs translations X-Git-Tag: release/2.13.4-1~305 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8224e66b9a5d298d4be3c43d06a2db6893d21495;p=lilypond.git Add script to split texidocs translations --- diff --git a/scripts/auxiliar/split-texidocs.py b/scripts/auxiliar/split-texidocs.py new file mode 100644 index 0000000000..161448087b --- /dev/null +++ b/scripts/auxiliar/split-texidocs.py @@ -0,0 +1,20 @@ +import os +import sys +import re +import glob + +source_files = glob.glob (os.path.join ('input', 'texidocs', '*.texidoc')) +dest_path = os.path.join ('Documentation', '%s', 'texidocs', '%s') + +s = 'Translation of GIT [Cc]ommittish' +texidoc_chunk_re = re.compile (r'^(?:%+\s*' + s + \ + r'.+)?\s*(?:texidoc|doctitle)([a-zA-Z]{2,4})\s+=(?:.|\n)*?(?=%+\s*' + \ + s + r'|$(?!.|\n))', re.M) + +for file_name in source_files: + base_name = os.path.basename (file_name) + contents = open (file_name).read () + for match in texidoc_chunk_re.finditer (contents): + language_code = match.group (1) + print language_code + open (dest_path % (language_code, base_name), 'w').write (match.group (0))