]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/auxiliar/texi-langutils.py
WEB: Integration of new web site [general.texi].
[lilypond.git] / scripts / auxiliar / texi-langutils.py
index d5666becf85552028d93fd0132fd77f7270a1637..e9798a619167c2ba925dd2277e17fe49379a983e 100755 (executable)
@@ -32,7 +32,7 @@ node_blurb = '''@untranslated
 '''
 doclang = ''
 head_committish = read_pipe ('git rev-parse HEAD')
-intro_blurb = '''@c -*- coding: utf-8; mode: texinfo%(doclang)s -*-
+intro_blurb = '''\\input texinfo @c -*- coding: utf-8; mode: texinfo%(doclang)s -*-
 @c This file is part of %(topfile)s
 @ignore
     Translation of GIT committish: %(head_committish)s
@@ -49,6 +49,8 @@ for x in optlist:
     if x[0] == '-o': # -o NAME   set PO output file name to NAME
         output_name = x[1]
     elif x[0] == '-d': # -d DIR    set working directory to DIR
+        print 'FIXME: this is evil.  use cd DIR && texi-langutils ...'
+        # even better, add a sane -o option
         os.chdir (x[1])
     elif x[0] == '-b': # -b BLURB  set blurb written at each node to BLURB
         node_blurb = x[1]
@@ -57,7 +59,7 @@ for x in optlist:
     elif x[0] == '-l': # -l ISOLANG  set documentlanguage to ISOLANG
         doclang = '; documentlanguage: ' + x[1]
 
-texinfo_with_menus_re = re.compile (r"^(\*) +([^:\n]+)::.*?$|^@(include|menu|end menu|node|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading) *(.*?)$|@(rglos){(.+?)}", re.M)
+texinfo_with_menus_re = re.compile (r"^(\*) +([^:\n]+)::.*?$|^@(afourpaper|author|bye|contents|copying|end copying|divClass|divEnd|divId|documentencoding|documentlanguage|finalout|ifnottex|end ifnottex|imageFloat|imageId|include|menu|end menu|node|quotation|end quotation|ref|rgloss|setfilename|settitle|set|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|titlefont|titlepage|end titlepage|title|subtitle|top|vskip|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading|c) *(([^ \n].*)|$)", re.M)
 
 texinfo_re = re.compile (r"^@(include|node|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading) *(.+?)$|@(rglos){(.+?)}", re.M)
 
@@ -119,7 +121,10 @@ def process_texi (texifilename, i_blurb, n_blurb, write_skeleton, topfile, outpu
                 elif item[2] == 'end menu':
                     g.write ('@end menu\n\n')
                 else:
-                    g.write ('@' + item[2] + ' ' + item[3] + '\n')
+                    space = ' '
+                    if item[3].startswith ('{') or not item[3].strip ():
+                        space = ''
+                    g.write ('@' + item[2] + space + item[3] + '\n')
                     if node_trigger:
                         g.write (n_blurb)
                         node_trigger = False
@@ -162,7 +167,15 @@ if make_gettext:
     node_list.write ('# -*- coding: utf-8 -*-\n')
     for texi_file in texi_files:
         # Urgly: scan ly comments and variable names only in English doco
-        is_english_doc = 'Documentation/user' in texi_file
+        is_english_doc = (
+            True
+            and not 'Documentation/de/' in texi_file
+            and not 'Documentation/es/' in texi_file
+            and not 'Documentation/fr/' in texi_file
+            and not 'Documentation/ja/' in texi_file
+            and not 'Documentation/nl/' in texi_file
+            and not 'Documentation/po/' in texi_file
+            )
         process_texi (texi_file, intro_blurb, node_blurb, make_skeleton,
                       os.path.basename (texi_file), node_list,
                       scan_ly=is_english_doc)