X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fhtml-gettext.py;h=7b381349b56fc4cd8a59b66b714382e9c5713ecd;hb=f96e38fbbbfba9cf4729323beb518a65ae77d562;hp=4583d37c5d1e731e0af0dddc6bed6556d7e9f7a7;hpb=2208ffc39db9da413fa7ac2c6dd8dfd7c3348e13;p=lilypond.git
diff --git a/buildscripts/html-gettext.py b/buildscripts/html-gettext.py
index 4583d37c5d..7b381349b5 100644
--- a/buildscripts/html-gettext.py
+++ b/buildscripts/html-gettext.py
@@ -25,18 +25,31 @@ sys.path.append (buildscript_dir)
import langdefs
double_punct_char_separator = langdefs.LANGDICT[lang].double_punct_char_sep
-print localedir
-print lang
t = gettext.translation('lilypond-doc', localedir, [lang])
my_gettext = t.gettext
html_codes = ((' -- ', ' – '),
(' --- ', ' — '))
+html2texi = {'command': (re.compile (r'(.*?)'), r'@command{\1}'),
+ 'code': (re.compile (r'(.*?)
'), r'@code{\1}')
+ }
+texi2html = {'command': (re.compile (r'@command{(.*?)}'), r'\1'),
+ 'code': (re.compile (r'@code{(.*?)}'), r'\1
')
+ }
+whitespaces = re.compile (r'\s+')
+
def _ (s):
+ if not s:
+ return ''
+ s = whitespaces.sub (' ', s)
for c in html_codes:
s = s.replace (c[1], c[0])
+ for u in html2texi.values():
+ s = u[0].sub (u[1], s)
s = my_gettext (s)
+ for u in texi2html.values():
+ s = u[0].sub (u[1], s)
for c in html_codes:
s = s.replace (c[0], c[1])
return s
@@ -48,18 +61,24 @@ def title_gettext (m):
return '
|)(?:[\d.]+ |))([^<]+)(
|)(:)?', a_href_gettext, page)
- page = re.sub (r')?(Appendix )?([A-Z\d.]+ |)(.+?)(?(3)
):?', a_href_gettext, page)
+ page = re.sub (r'