From 8224e66b9a5d298d4be3c43d06a2db6893d21495 Mon Sep 17 00:00:00 2001 From: John Mandereau Date: Sat, 25 Jul 2009 12:52:15 +0200 Subject: [PATCH] Add script to split texidocs translations --- scripts/auxiliar/split-texidocs.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 scripts/auxiliar/split-texidocs.py 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)) -- 2.39.5