]> git.donarmstrong.com Git - lilypond.git/blob - scripts/auxiliar/split-texidocs.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / auxiliar / split-texidocs.py
1 import os
2 import sys
3 import re
4 import glob
5
6 source_files = glob.glob (os.path.join ('input', 'texidocs', '*.texidoc'))
7 dest_path = os.path.join ('Documentation', '%s', 'texidocs', '%s')
8
9 s = 'Translation of GIT [Cc]ommittish'
10 texidoc_chunk_re = re.compile (r'^(?:%+\s*' + s + \
11     r'.+)?\s*(?:texidoc|doctitle)([a-zA-Z]{2,4})\s+=(?:.|\n)*?(?=%+\s*' + \
12     s + r'|$(?!.|\n))', re.M)
13
14 for file_name in source_files:
15     base_name = os.path.basename (file_name)
16     contents = open (file_name).read ()
17     for match in texidoc_chunk_re.finditer (contents):
18         language_code = match.group (1)
19         print language_code
20         open (dest_path % (language_code, base_name), 'w').write (match.group (0))