]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add script to split texidocs translations
authorJohn Mandereau <john.mandereau@gmail.com>
Sat, 25 Jul 2009 10:52:15 +0000 (12:52 +0200)
committerJohn Mandereau <john.mandereau@gmail.com>
Sat, 25 Jul 2009 10:52:15 +0000 (12:52 +0200)
scripts/auxiliar/split-texidocs.py [new file with mode: 0644]

diff --git a/scripts/auxiliar/split-texidocs.py b/scripts/auxiliar/split-texidocs.py
new file mode 100644 (file)
index 0000000..1614480
--- /dev/null
@@ -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))