X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Flilypond-book.py;h=b8c765d3fb0b74799d2269f922a4bcbf2e3f43a4;hb=f52e59b15644e5da959b30a2e2d55fd5d5970bcb;hp=be9fef694a5d81049d92799b4ecb39d18498fbc9;hpb=eda788a9744b27765a6aaa7cc22a7ca08d66c735;p=lilypond.git diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index be9fef694a..b8c765d3fb 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -840,6 +840,8 @@ def verbatim_html (s): ly_var_def_re = re.compile (r'^([a-zA-Z]+)[\t ]*=', re.M) ly_comment_re = re.compile (r'(%+[\t ]*)(.*)$', re.M) +ly_context_id_re = re.compile ('\\\\(?:new|context)\\s+(?:[a-zA-Z]*?(?:Staff\ +(?:Group)?|Voice|FiguredBass|FretBoards|Names|Devnull))\\s+=\\s+"?([a-zA-Z]+)"?\\s+') def ly_comment_gettext (t, m): return m.group (1) + t (m.group (2)) @@ -858,6 +860,10 @@ def verb_ly_gettext (s): s = re.sub (r"(?m)(^|[' \\#])%s([^a-zA-Z])" % v, "\\1" + t (v) + "\\2", s) + for id in ly_context_id_re.findall (s): + s = re.sub (r'(\s+|")%s(\s+|")' % id, + "\\1" + t (id) + "\\2", + s) return s texinfo_lang_re = re.compile ('(?m)^@documentlanguage (.*?)( |$)')