From: Han-Wen Nienhuys Date: Tue, 30 Aug 2005 23:26:04 +0000 (+0000) Subject: (PREAMBLE_LY): define X-Git-Tag: release/2.7.9~14 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=778041c845ba2b1977cd11e47510387ad47a0bb0;p=lilypond.git (PREAMBLE_LY): define inside-lilypond-book (modify_preamble): new function. Insert \RequirePackage{graphics} when no {graphics found in preamble. --- diff --git a/ChangeLog b/ChangeLog index e3da6b68ba..e75362441f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-08-31 Han-Wen Nienhuys + + * scripts/lilypond-book.py (PREAMBLE_LY): define + inside-lilypond-book + (modify_preamble): new function. Insert \RequirePackage{graphics} + when no {graphics found in preamble. + 2005-08030 Graham Percival * Documentation/user/basic-notation.itely, global.itely, diff --git a/lily/tie.cc b/lily/tie.cc index 4e103bb2ad..65be94ea35 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -411,7 +411,10 @@ Tie::print (SCM smob) if (CENTER == get_grob_direction (me)) set_direction (me); - + + if (!get_grob_direction (me)) + me->programming_error ("Tie direction not set."); + SCM cp = me->get_property ("control-points"); if (!scm_is_pair (cp)) { diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 37403c2967..eb4f4617ca 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -556,7 +556,7 @@ PREAMBLE_LY = r'''%%%% Generated by %(program_name)s p (scorify-music m p)))) #(ly:set-option (quote no-point-and-click)) - +#(define inside-lilypond-book #t) #(define version-seen? #t) %(preamble_string)s @@ -693,9 +693,13 @@ class Substring (Chunk): self.start = start self.end = end self.line_number = line_number + self.override_text = None def replacement_text (self): - return self.source[self.start:self.end] + if self.override_text: + return self.override_text + else: + return self.source[self.start:self.end] class Snippet (Chunk): def __init__ (self, type, match, format, line_number): @@ -1319,6 +1323,18 @@ def get_latex_textwidth (source): return textwidth +def modify_preamble (chunk): + str = chunk.replacement_text () + if (re.search (r"\\begin{document}", str) + and not re.search ("{graphic[sx]", str)): + str = re.sub (r"\\begin{document}", + r"\\RequirePackage{graphics}" + '\n' + + r"\\begin{document}", + str) + chunk.override_text = str + + + ext2format = { '.html': HTML, '.itely': TEXINFO, @@ -1481,6 +1497,11 @@ def do_file (input_filename): ) ly.progress (_ ("Dissecting...")) chunks = find_toplevel_snippets (source, snippet_types) + + if format == LATEX: + modify_preamble (chunks[0]) + + ly.progress ('\n') if filter_cmd: