From: Han-Wen Nienhuys Date: Sun, 23 Mar 2008 17:50:15 +0000 (-0300) Subject: Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond X-Git-Tag: release/2.11.43-1~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=537258dbe70c07593fbdf41840ff17d4edf4b333;p=lilypond.git Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond Conflicts: Documentation/user/pitches.itely scripts/lilypond-book.py --- 537258dbe70c07593fbdf41840ff17d4edf4b333 diff --cc scripts/lilypond-book.py index b6a8fe236c,d4af98cf65..6747a055e2 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@@ -807,14 -804,34 +809,20 @@@ def verbatim_html (s) re.sub ('<', '<', re.sub ('&', '&', s))) -def split_options (option_string): - if option_string: - if global_options.format == HTML: - options = re.findall('[\w\.-:]+(?:\s*=\s*(?:"[^"]*"|\'[^\']*\'|\S+))?',option_string) - for i in range(len(options)): - options[i] = re.sub('^([^=]+=\s*)(?P["\'])(.*)(?P=q)','\g<1>\g<3>',options[i]) - return options - else: - return re.split (format_res[global_options.format]['option_sep'], - option_string) - return [] + texinfo_lang_re = re.compile ('(?m)^@documentlanguage (.*?)( |$)') - -def set_default_options (source): - global default_ly_options - if not default_ly_options.has_key (LINE_WIDTH): - if global_options.format == LATEX: +def set_default_options (source, default_ly_options, format): + if LINE_WIDTH not in default_ly_options: + if format == LATEX: textwidth = get_latex_textwidth (source) - default_ly_options[LINE_WIDTH] = \ - '''%.0f\\pt''' % textwidth - elif global_options.format == TEXINFO: + default_ly_options[LINE_WIDTH] = '%.0f\\pt' % textwidth + elif format == TEXINFO: + m = texinfo_lang_re.search (source) + if m and not m.group (1).startswith ('en'): + default_ly_options[LANG] = m.group (1) + else: + default_ly_options[LANG] = '' - for (k, v) in texinfo_line_widths.items (): + for regex in texinfo_line_widths: # FIXME: @layout is usually not in # chunk #0: # @@@ -1792,13 -1768,12 +1803,13 @@@ def do_file (input_filename) progress ('\n') return do_file (name) - include_chunks = [process_include (c) for c in chunks - if is_derived_class (c.__class__, Include_snippet)] + include_chunks = map (process_include, - filter (lambda x: isinstance (x, IncludeSnippet), - chunks)) ++ filter (lambda x: isinstance (x, IncludeSnippet), ++ chunks)) - return chunks + reduce (operator.add, include_chunks, []) + return chunks + reduce (lambda x, y: x + y, include_chunks, []) - except Compile_error: + except CompileError: os.chdir (original_dir) progress (_ ("Removing `%s'") % output_filename) progress ('\n')