]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix HTML Info docs gettext trickery
authorJohn Mandereau <john.mandereau@gmail.com>
Tue, 13 Mar 2007 17:20:38 +0000 (18:20 +0100)
committerJohn Mandereau <john.mandereau@gmail.com>
Tue, 13 Mar 2007 17:20:38 +0000 (18:20 +0100)
buildscripts/html-gettext.py
buildscripts/texi-langutils.py

index 4583d37c5d1e731e0af0dddc6bed6556d7e9f7a7..edf7d197c03fad35662aba2e8152b27a3e9046bc 100644 (file)
@@ -32,11 +32,15 @@ my_gettext = t.gettext
 
 html_codes = ((' -- ', ' &ndash; '),
              (' --- ', ' &mdash; '))
+html2texi_command = re.compile (r'<samp><span class="command">(.*?)</span></samp>')
+texi2html_command = re.compile (r'@command{(.*?)}')
 
 def _ (s):
        for c in html_codes:
                s = s.replace (c[1], c[0])
+       s = html2texi_command.sub (r'@command{\1}', s)
        s = my_gettext (s)
+       s = texi2html_command.sub (r'<samp><span class="command">\1</span></samp>', s)
        for c in html_codes:
                s = s.replace (c[0], c[1])
        return s
@@ -67,7 +71,7 @@ for filename in args[3:]:
        f.close()
        page = re.sub (r'<link rel="(up|prev|next)" (.*?) title="([^"]*?)">', link_gettext, page)
        page = re.sub (r'<title>([^<]*?) - ([^<]*?)</title>', title_gettext, page)
-       page = re.sub (r'<a ((?:rel="\w+")? ?(?:accesskey="[^"]+?" ?)?)(href="[^"]+?">)((?:<code>|)(?:[\d.]+ |))([^<]+)(</code>|)</a>(:)?', a_href_gettext, page)
+       page = re.sub (r'<a ((?:rel="\w+")? ?(?:accesskey="[^"]+?")? ?(?:name=".*?")? ?)(href="[^"]+?">)((?:<code>|)(?:[\d.]+ |))([^<]+)(</code>|)</a>(:)?', a_href_gettext, page)
        page = re.sub (r'<h(\d)( class="\w+"|)>([\d.]+ |)?([^<]+)</h\1>', h_gettext, page)
        page = re.sub (r'<a href="../music-glossary/(.+?)">(.+?)</a>', rglos_gettext, page)
        for w in ('Next:', 'Previous:', 'Up:'):
index 8fc24187dededcdd73e3a6cb9429ca3215cd6007..4e54169dd0fa3ebcb1838b34f78a9960aeec5e51 100644 (file)
@@ -123,7 +123,7 @@ if make_gettext:
        node_list = open (node_list_filename, 'w')
        for texi_file in texi_files:
                process_texi (texi_file, intro_blurb, node_blurb, make_skeleton, node_list)
-       for word in ('Up:', 'Next:', 'Previous:', 'Appendix', 'Footnotes'):
+       for word in ('Up:', 'Next:', 'Previous:', 'Appendix', 'Footnotes', 'Table of Contents'):
                node_list.write ('_("' + word + '")\n')
        node_list.close ()
        os.system ('xgettext -c -L Python --no-location -o ' + output_file + ' ' + node_list_filename)