]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scripts/lilypond-book.py (Lilypond_file_snippet.ly): don't copy
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 25 Jul 2004 13:10:51 +0000 (13:10 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 25 Jul 2004 13:10:51 +0000 (13:10 +0000)
file contents, rather \include them, so default linewidth is set.
(ly_options): make BOOKPAPER set of options. Move linewidth
settings there.

* Documentation/user/examples.itely: new file. Templates are to be
moved here.

* Documentation/user/programming-interface.itely: move chapter.

* scm/document-markup.scm (doc-markup-function): add @code

* stepmake/stepmake/texinfo-rules.make: remove chmod.

14 files changed:
ChangeLog
Documentation/user/examples.itely [new file with mode: 0644]
Documentation/user/invoking.itexi
Documentation/user/lilypond.tely
Documentation/user/macros.itexi
Documentation/user/notation.itely
Documentation/user/programming-interface.itely
lily/main.cc
make/lilypond-vars.make
scm/document-markup.scm
scm/framework-tex.scm
scm/lily.scm
scripts/lilypond-book.py
stepmake/stepmake/texinfo-rules.make

index 5df19b848a627cbdbbddeb0385aa66801e51907e..097683aaa7b5fb4a1a59983b0bc6b083f06a7e11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2004-07-25  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * scripts/lilypond-book.py (Lilypond_file_snippet.ly): don't copy
+       file contents, rather \include them, so default linewidth is set.
+       (ly_options): make BOOKPAPER set of options. Move linewidth
+       settings there.
+
+       * Documentation/user/examples.itely: new file. Templates are to be
+       moved here.
+
+       * Documentation/user/programming-interface.itely: move chapter.
+
+       * scm/document-markup.scm (doc-markup-function): add @code
+
+       * stepmake/stepmake/texinfo-rules.make: remove chmod.
+
 2004-07-24  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
        * scm/page-layout.scm (plain-header): add printpagenumber boolean
diff --git a/Documentation/user/examples.itely b/Documentation/user/examples.itely
new file mode 100644 (file)
index 0000000..1c057b6
--- /dev/null
@@ -0,0 +1,4 @@
+@node Example templates
+@chapter Example templates
+
+[TODO]
index 9d1b0008a028b9a2bfd8214f40a923c95d2acb97..80eb9b6a4fce90f7f720a4e53ccda8867b3cf7a2 100644 (file)
@@ -173,26 +173,10 @@ file tree. A typical setting would be
 @{/usr/share/lilypond/1.6.0,@{!!/usr/share/texmf@}@}
 @end example
 
-
-@item GS_LIB
-For processing PostScript output (obtained with
-@code{-f ps}) with Ghostscript you have to set @code{GS_LIB} to
-point to the directory containing library PS files.
-
-@item GS_FONTPATH
-For processing PostScript output (obtained with
-@code{-f ps}) with Ghostscript you have to set @code{GS_FONTPATH} to
-point to the directory containing  PFA files.
-
-When you print direct PS output, remember to send the PFA files to the
-printer as well.
 @end table
 
 
-@cindex ghostscript
 @cindex PostScript
-@cindex GS_FONTPATH
-@cindex GS_LIB
 @cindex TEXMF
 @cindex printing postscript
 
index b1eea6655bc0bc00ce3e20b0b4a56011da1aa245..6072aca4ce22309bbdbc1081fc9fe6c3b5e3815b 100644 (file)
@@ -161,16 +161,17 @@ this and other documentation.
 * Preface::                        Preface.
 * Introduction::                   What, Why, How.
 * Tutorial::                       A tutorial introduction.
+* Example templates::              Larger examples
 * Notation manual::                All notation supported, and how to
                                    produce it.
 * Changing defaults::              Tuning output.
+* Interfaces for programmers::
 * Invoking LilyPond::              Operation.
 * Converting from other formats::  Converting to lilypond source format.
 * lilypond-book manual::           Integrating text and music with lilypond-book.
 * Unified index::                  
 * Notation manual details::
 * Literature list::
-* Interfaces for programmers::
 * Cheat sheet::     
 * GNU Free Documentation License:: FDL.
 @end menu
@@ -183,9 +184,11 @@ this and other documentation.
 @include preface.itely
 @include introduction.itely 
 @include tutorial.itely
+@include examples.itely
+@include invoking.itexi
 @include notation.itely
 @include changing-defaults.itely
-@include invoking.itexi
+@include programming-interface.itely
 @include lilypond-book.itely
 @include converters.itely
 
@@ -200,8 +203,6 @@ this and other documentation.
 
 @include literature.itely
 
-@include programming-interface.itely
-
 @include cheatsheet.itely
 
 @include fdl.itexi
index cbf3ce2acfc9fd1f70df316ae6cb0f744b2e4dde..887837466f784a570c38da5d49e14fe4468be3f3 100644 (file)
 
 
 @ifnottex
-@macro texisharp {word}
-#
-@end macro
+  @macro texisharp {word}
+  #
+  @end macro
+  @macro texiflat {word}
+  b
+  @end macro
 @end ifnottex
 
 @iftex
-@macro texisharp {word}
-@tex
-\\raise0.5ex\\fetachar\\fetasharp
-@end tex
-@end macro
+ @macro texiflat {word}
+ @tex
+ \\kern0.15em\\fetachar\\fetaflat
+ @end tex
+ @end macro
+ @macro texisharp {word}
+  @tex
+  \\raise0.5ex\\fetachar\\fetasharp
+  @end tex
+  @end macro
 @end iftex
 
-@ifnottex
-@macro texiflat {word}
-b
-@end macro
-@end ifnottex
-
-@iftex
-@macro texiflat {word}
-@tex
-\\kern0.15em\\fetachar\\fetaflat
-@end tex
-@end macro
-@end iftex
 
 @macro arrow{}
 @iftex
@@ -66,66 +61,91 @@ b
 
 
 @c dup?
+
 @ifhtml
-@macro internalsref{NAME}
-@uref{../lilypond-internals/\NAME\.html,\NAME\}@c
-@c should we do this? 
-@cindex @code{\NAME\}
-@end macro
 
+ @c ***** HTML *****
 
+ @macro internalsref{NAME}
+ @uref{../lilypond-internals/\NAME\.html,\NAME\}@c
+ @c should we do this? 
+ @cindex @code{\NAME\}
+ @end macro
 
-@macro inputfileref{DIR,NAME}
-@uref{../../../../\DIR\/out-www/collated-files.html#\NAME\,@file{\DIR\/\NAME\}}@c
-@end macro
+ @macro hyphenatedinternalsref{NAME,NODENAME}
+ @uref{../lilypond-internals/\NODENAME\.html,\NAME\}@c
+ @c should we do this? 
+ @cindex @code{\NAME\}
+ @end macro
+
+ @macro inputfileref{DIR,NAME}
+ @uref{../../../../\DIR\/out-www/collated-files.html#\NAME\,@file{\DIR\/\NAME\}}@c
+ @end macro
 
 @end ifhtml
 
 @ifinfo
+
+@c **** INFO ****
 @macro internalsref{NAME}
 @inforef{\NAME\,,lilypond/lilypond-internals}@c
 @cindex \NAME\@c
 @end macro
 
+@macro hyphenatedinternalsref{NAME,NODENAME}
+@inforef{\NODENAME\,,lilypond-internals}@c
+@c should we do this? 
+@cindex @code{\NAME\}
+@end macro
+
 @macro inputfileref{DIR,NAME}
 @file{\DIR\/\NAME\}
 @end macro
 
+
+@macro usermanref{NAME}
+@ref{\NAME\,,,lilypond/lilypond}@c
+@end macro
+
 @end ifinfo
 
 @iftex
+@c **** TEX ****
+
 @macro internalsref{NAME}@c
-@cindex \NAME\@c
+@cindex @code{\NAME\} @c
 @code{\NAME\}@c
 @end macro
+
 @macro inputfileref{DIR,NAME}@c
 @file{\DIR\/\NAME\}@c
 @end macro
-@end iftex
+
+@macro hyphenatedinternalsref{NAME,NODENAME}
+@code{\NAME\}@c
+@c should we do this? 
+@cindex @code{\NAME\} @c
+@end macro
+
 
 
-@iftex
 @macro seeinternals{NAME}
 internals document,  @internalsref{\NAME\}
 @end macro
 @end iftex
 
+@c **** not TEX ****
+
 @ifnottex
-@macro seeinternals{NAME}
-@internalsref{\NAME\}
-@end macro
+ @macro seeinternals{NAME}
+ @internalsref{\NAME\}
+ @end macro
 @end ifnottex
 
-@ifinfo
-@macro usermanref{NAME}
-@ref{\NAME\,,,lilypond/lilypond}@c
-@end macro
-@end ifinfo
-
 @ifnotinfo
-@macro usermanref{NAME}
-@ref{\NAME\}@c
-@end macro
+ @macro usermanref{NAME}
+ @ref{\NAME\}@c
+ @end macro
 @end ifnotinfo
 
 @macro refbugs
index 87ebcc272e439b0f690bd84215c6b55becde9455..7b597da7a396dc44f739b37a52174de0715d9983 100644 (file)
@@ -699,7 +699,7 @@ Bar checks can also be used in lyrics, for example
 @end example
 
 
-@cindex skipTypesetting
+@cindex @code{skipTypesetting}
 
 Failed bar checks are caused by entering incorrect
 durations. Incorrect durations often completely garble up the score,
@@ -1180,9 +1180,9 @@ The command @code{\bar }@var{bartype} is a short cut for doing
 @code{\set Timing.whichBar = }@var{bartype}.  Whenever @code{whichBar}
 is set to a string, a bar line of that type is created.
 
-@cindex whichBar
+@cindex @code{whichBar}
 @cindex @code{repeatCommands}
-@cindex defaultBarType
+@cindex @code{defaultBarType}
 
 You are encouraged to use @code{\repeat} for repetitions.  See
 @ref{Repeats}.
@@ -1424,7 +1424,7 @@ c16[ c c c c c c c]
 \set Score.beatLength = #(ly:make-moment 1 8)
 c16[ c c c c c c c]
 @end lilypond
-@cindex subdivideBeams
+@cindex @code{subdivideBeams}
 
 Kneed beams are inserted automatically, when a large gap is detected
 between the note heads.  This behavior can be tuned through the object
@@ -3766,7 +3766,7 @@ are printed as tablature, by using @internalsref{TabStaff} and
 }
 @end lilypond
 
-@cindex minimumFret
+@cindex @code{minimumFret}
 @cindex fret
 
 When no string is specified, the first string that does not give a
@@ -4044,7 +4044,7 @@ Klaus Ignatzek (see @ref{Literature list}).  It can be tuned through the
 following properties
 
 @table @code
-@cindex chordNameExceptions
+@cindex @code{chordNameExceptions}
 @item chordNameExceptions
 This is a list that contains the chords that have special formatting.
 For an example, see
@@ -4052,14 +4052,14 @@ For an example, see
 @cindex exceptions, chord names.
 
 
-@cindex majorSevenSymbol
+@cindex @code{majorSevenSymbol}
 @item majorSevenSymbol
 This property contains the markup object used for the 7th step, when
 it is major. Predefined options are @code{whiteTriangleMarkup} and
 @code{blackTriangleMarkup}.  See
 @inputfileref{input/regression,chord-name-major7.ly} for an example.
 
-@cindex chordNameSeparator
+@cindex @code{chordNameSeparator}
 @item chordNameSeparator
 Different parts of a chord name are normally separated by a
 slash. By setting @code{chordNameSeparator}, you can specify other
@@ -4073,7 +4073,7 @@ separators, e.g.
 }
 @end lilypond
 
-@cindex chordRootNamer
+@cindex @code{chordRootNamer}
 @item chordRootNamer
 The root of a chord is usually printed as a letter with an optional
 alteration. The transformation from pitch to letter is done by this
@@ -4084,7 +4084,7 @@ The predefined variables @code{\germanChords},
 @code{\semiGermanChords} set these variables.
 
 
-@cindex chordNoteNamer
+@cindex @code{chordNoteNamer}
 @item chordNoteNamer
 The default is to print single pitch, e.g. the bass note, using the
 @code{chordRootNamer}.  The @code{chordNoteNamer} property can be set
@@ -4281,12 +4281,11 @@ Examples: @inputfileref{input/regression,rehearsal-mark-letter.ly},
 
 @cindex bar numbers
 @cindex measure numbers
-@cindex currentBarNumber
+@cindex @code{currentBarNumber}
 
 Bar numbers are printed by default at the start of the line.  The
-number itself is stored in the 
-@code{currentBarNumber} property,
-which is normally updated automatically for every measure.
+number itself is stored in the @code{currentBarNumber} property, which
+is normally updated automatically for every measure.
 
 Bar numbers can be typeset at regular intervals instead of at the
 beginning of each line. This is illustrated in the following example,
@@ -7545,7 +7544,7 @@ correct result.
 
 @refcommands
 
-@cindex \setEasyHeads
+@cindex @code{\setEasyHeads}
 @code{\setEasyHeads}
 
 @node Sound
index 535714da983c53fde169f9f9b0621f18c6d95282..83db8292dd370c4d49fd3d91b1b3b2ef56e2f5de 100644 (file)
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @node Interfaces for programmers
-@appendix Interfaces for programmers
+@chapter Interfaces for programmers
 
 
 
@@ -11,7 +11,7 @@
 @end menu
 
 @node Programmer interfaces for input 
-@appendixsec Programmer interfaces for input 
+@section Programmer interfaces for input 
 
 @menu
 * Input variables and Scheme::  
@@ -22,7 +22,7 @@
 @end menu
 
 @node Input variables and Scheme
-@appendixsubsec Input variables and Scheme
+@subsection Input variables and Scheme
 
 
 The input format supports the notion of variable: in the following
@@ -91,7 +91,7 @@ written as
 Mixing Scheme and lily identifiers is not possible with @code{--safe}.
 
 @node Internal music representation
-@appendixsubsec Internal music representation
+@subsection Internal music representation
 
 When a music expression is parsed, it is converted into a set of
 Scheme music objects. The defining property of a music object is that
@@ -104,23 +104,22 @@ A music object has three kinds of types:
   music name: Each music expression has a name, for example, a note
 leads to a @internalsref{NoteEvent}, and @code{\simultaneous} leads to
 a @internalsref{SimultaneousMusic}. A list of all expressions
-available is in the internals manual, under @internalsref{Music
-expressions}.
+available is in the internals manual, under
+@hyphenatedinternalsref{Music expressions,Music-expressions}.
 
 @item
-  `type' or interface: Each music name has several `types' or interface,
-  for example, a note is an @code{event},
-  but it is also a @code{note-event},
-  a @code{rhythmic-event} and
-   a @code{melodic-event}.
+  `type' or interface: Each music name has several `types' or
+interfaces, for example, a note is an @code{event}, but it is also a
+@code{note-event}, a @code{rhythmic-event} and a @code{melodic-event}.
 
   All classes of music are listed in the internals manual, under
-  @internalsref{Music classes}.
-@item
-C++ object: Each music object is represented by a C++ object. For technical
-reasons, different music objects may be represented by different C++
-object types. For example, a note is @code{Event} object, while
-@code{\grace} creates a @code{Grace_music} object.
+  @hyphenatedinternalsref{Music classes,Music-classes}.
+
+  @item
+C++ object: Each music object is represented by a C++ object. For
+technical reasons, different music objects may be represented by
+different C++ object types. For example, a note is @code{Event}
+object, while @code{\grace} creates a @code{Grace_music} object.
 
 We expect that distinctions between different C++ types will disappear
 in the future.
@@ -145,7 +144,7 @@ and @internalsref{GraceMusic} has its single argument in
 
 
 @node Extending music syntax
-@appendixsubsec Extending music syntax
+@subsection Extending music syntax
 
 The syntax of composite music expressions, like
 @code{\repeat}, @code{\transpose} and @code{\context}
@@ -213,7 +212,7 @@ Examples of the use of @code{\applymusic} are in the next section.
 @file{ly/music-functions-init.ly}.
 
 @node Manipulating music expressions
-@appendixsubsec Manipulating music expressions
+@subsection Manipulating music expressions
 
 Music objects and their properties can be accessed and manipulated
 directly, through the @code{\applymusic} mechanism.
@@ -305,7 +304,7 @@ LilyPond input to other formats  (@inputfileref{input/test,to-xml.ly})
 
 
 @node Using LilyPond syntax inside Scheme
-@appendixsubsec Using LilyPond syntax inside Scheme
+@subsection Using LilyPond syntax inside Scheme
 
 Creating music expressions in scheme can be tedious, as they are
 heavily nested and the resulting scheme code is large. For some
@@ -412,7 +411,7 @@ This function may also be defined as a music function:
 
 
 @node Markup programmer interface
-@appendixsec Markup programmer interface
+@section Markup programmer interface
 
 
 @menu
@@ -421,7 +420,7 @@ This function may also be defined as a music function:
 @end menu
 
 @node Markup construction in scheme
-@appendixsubsec Markup construction in scheme
+@subsection Markup construction in scheme
 
 @cindex defining markup commands 
 
@@ -475,7 +474,7 @@ instead:
 @end lisp
 
 @node Markup command definition
-@appendixsubsec Markup command definition
+@subsection Markup command definition
 
 New markup commands can be defined
 with  the @code{def-markup-command} scheme macro.
@@ -636,7 +635,7 @@ to the @code{interpret-markup} function, with the @code{paper} and
 
 
 @node Contexts for programmers
-@appendixsec Contexts for programmers
+@section Contexts for programmers
 
 
 @menu
@@ -645,7 +644,7 @@ to the @code{interpret-markup} function, with the @code{paper} and
 @end menu
 
 @node Context evaluation
-@appendixsubsec Context evaluation
+@subsection Context evaluation
 
 @cindex calling code during interpreting
 @cindex @code{\applycontext}
@@ -670,7 +669,7 @@ current bar number on the standard output during the compile:
 
 
 @node Running a function on all layout objects
-@appendixsubsec Running a function on all layout objects
+@subsection Running a function on all layout objects
 
 
 @cindex calling code on layout objects
index 33e50ce334df7273c0d005dc99cfb43dc1370c54..8d57f86c8c9164a5ea124e0a146c7ffeee15b25b 100644 (file)
@@ -279,7 +279,15 @@ determine_output_options ()
        || make_ps
        || make_png
        || make_pdf))
-    make_pdf = true;
+    {
+      make_pdf = true;
+      make_ps = true;
+      if (found_tex)
+       {
+         make_dvi = true;
+         make_tex = true;
+       }
+    }
 }
 
 static void
index e78d33c23b458aa9e0278dbcfe508fcb531f5ed2..939329fe9fb706e9223f40b9808be341cdc9cb4f 100644 (file)
@@ -38,7 +38,7 @@ CONVERT_LY = $(script-dir)/convert-ly.py
 LILYPOND = $(builddir)/lily/$(outconfbase)/lilypond
 LILYPOND_BOOK = $(script-dir)/lilypond-book.py
 LILYPOND_BOOK_INCLUDES = -I $(pwd) -I $(outdir) -I$(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(builddir)/mf/$(outconfbase)/  -I $(builddir)/mf/out/
-LILYPOND_BOOK_FLAGS = --process="lilypond-bin -f tex --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"
+LILYPOND_BOOK_FLAGS = --process="lilypond -f tex --tex --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"
 
 #texi-html for www only:
 LILYPOND_BOOK_FORMAT=$(if $(subst out-www,,$(notdir $(outdir))),texi,texi-html)
index ad02d4f3eded0dfd14ec4e3498555e7244a35e52..7478a70dc5822a280b1e158f5e3ca69c9aa3e66d 100644 (file)
@@ -30,7 +30,7 @@
    "\n\n@item @code{\\" c-name "} " signature-str
    
    "\n@findex " f-name "\n"
-   "\n@cindex " c-name "\n"
+   "\n@cindex @code{" c-name "}\n"
    
    (if (string? doc-str)
        doc-str
index ba2992b0427148b28f5b08db5dc2b893f7a1866b..a63f6cf1108afd5970cc9ded25eea18d46d601ff 100644 (file)
 (define-public (convert-to-pdf book name)
   (let*
       ((defs (ly:paper-book-book-paper book))
-       (size (ly:output-def-lookup book 'papersize)))
+       (size (ly:output-def-lookup defs 'papersize)))
 
     (postscript->pdf (if (string? size) size "a4")
                     (string-append
index e5c27d303aed555e2a1d689f91df7212e3e29c97..532f1a9f9db8de336a1bfb621f42d3c60b8d0dd5 100644 (file)
@@ -569,7 +569,9 @@ L1 is copied, L2 not.
           (if (number? resolution)
               (number->string resolution)
               "90")
-          " "
+          (if (ly:get-option 'verbose)
+              "--verbose "
+              " ")
           name)))
 
 (define-public (lilypond-main files)
index 4c3348247a4b9c4c53d11c6b8c77ec66d722c955..8f842eb33f53a448d205f33845f5f727722e1f9f 100644 (file)
@@ -28,6 +28,15 @@ import __main__
 import glob
 import stat
 import string
+
+#
+# TODO:
+#
+#  * should have a sane default --process setting 
+#
+#  * use --png --ps --pdf for making images? 
+#
+
 ################################################################
 # Users of python modules should include this snippet
 # and customize variables below.
@@ -106,10 +115,14 @@ filter_cmd = 0
 process_cmd = lilypond_binary
 default_ly_options = {}
 
+#
+# is this pythonic? Personally, I find this rather #define-nesque. --hwn
+#
 AFTER = 'after'
-FILTER = 'filter'
 BEFORE = 'before'
+BOOKPAPER = 'bookpaper'
 EXAMPLEINDENT = 'exampleindent'
+FILTER = 'filter'
 FRAGMENT = 'fragment'
 HTML = 'html'
 INDENT = 'indent'
@@ -123,9 +136,9 @@ OUTPUT = 'output'
 PAPER = 'paper'
 PREAMBLE = 'preamble'
 PRINTFILENAME = 'printfilename'
+QUOTE = 'quote'
 RAGGEDRIGHT = 'raggedright'
 RELATIVE = 'relative'
-QUOTE = 'quote'
 STAFFSIZE = 'staffsize'
 TEXIDOC = 'texidoc'
 TEXINFO = 'texinfo'
@@ -192,32 +205,39 @@ format_res = {
 
 ly_options = {
        NOTES: {
-       RELATIVE: r'''\relative c%(relative_quotes)s''',
+               RELATIVE: r'''\relative c%(relative_quotes)s''',
        },
-       PAPER: {
-       EXAMPLEINDENT : '',
-       INDENT : r'''
+       BOOKPAPER: {
+               INDENT : r'''
     indent = %(indent)s''',
        'linewidth' : r'''
     linewidth = %(linewidth)s''',
-       NOINDENT : r'''
-    indent = 0.0\mm''',
-       NOTIME : r'''
-    \context {
-        \Staff
-        \remove Time_signature_engraver
-    }''',
-       QUOTE : r'''
+               NOINDENT : r'''
+    indent = 0.0\mm''',        
+               QUOTE : r'''
     linewidth = %(linewidth)s - 2.0 * %(exampleindent)s
 ''',   
-       RAGGEDRIGHT : r'''
+               RAGGEDRIGHT : r'''
     indent = 0.0\mm
     raggedright = ##t''',
        },
+
+       ##
+       PAPER: {
+               EXAMPLEINDENT : '',
+
+               NOTIME : r'''
+    \context {
+        \Staff
+        \remove Time_signature_engraver
+    }''',
+       },
+
+       ##
        PREAMBLE: {
-       STAFFSIZE: r'''
+               STAFFSIZE: r'''
 #(set-global-staff-size %(staffsize)s)''',
-       },
+               },
        }
 
 output = {
@@ -304,8 +324,11 @@ PREAMBLE_LY = r'''%%%% Generated by %(program_name)s
                                p (ly:music-scorify m))
                            ))
 %(preamble_string)s
-\paper {%(paper_string)s
+\bookpaper {%(bookpaper_string)s
+}
+\paper { %(paper_string)s
 }
+
 ''' 
 
 FRAGMENT_LY = r'''
@@ -367,9 +390,12 @@ def compose_ly (code, options):
        override[EXAMPLEINDENT] = r'9.0 \mm'
 
        option_string = string.join (options, ',')
-       notes_options = []
-       paper_options = []
-       preamble_options = []
+
+       options_dict = {}
+       option_types = [NOTES, PREAMBLE, PAPER, BOOKPAPER]
+       for a in option_types:
+               options_dict[a] = []
+               
        for i in options:
                c = classic_lilypond_book_compatibility (i)
                if c:
@@ -383,17 +409,19 @@ def compose_ly (code, options):
                        override[key] = value
                else:
                        key = i
-                       if i not in override.keys ():
+                       if not override.has_key (i):
                                override[i] = None
 
-               if key in ly_options[NOTES].keys ():
-                       notes_options.append (ly_options[NOTES][key])
-               elif key in ly_options[PREAMBLE].keys ():
-                       preamble_options.append (ly_options[PREAMBLE][key])
-               elif key in ly_options[PAPER].keys ():
-                       paper_options.append (ly_options[PAPER][key])
-               elif key not in (FRAGMENT, NOFRAGMENT, PRINTFILENAME,
-                                RELATIVE, VERBATIM, TEXIDOC):
+               found = 0
+               for type in option_types:
+                       if ly_options[type].has_key (key):
+                               
+                               options_dict[type].append (ly_options[type][key])
+                               found = 1
+                               break
+
+               if not found and key not in (FRAGMENT, NOFRAGMENT, PRINTFILENAME,
+                                            RELATIVE, VERBATIM, TEXIDOC):
                        ly.warning (_("ignoring unknown ly option: %s") % i)
 
        #URGS
@@ -409,11 +437,14 @@ def compose_ly (code, options):
                relative_quotes += "'" * relative
                
        program_name = __main__.program_name
-       paper_string = string.join (paper_options, '\n    ') % override
-       preamble_string = string.join (preamble_options, '\n    ') % override
-       notes_string = string.join (notes_options, '\n    ') % vars ()
+       
+       paper_string = string.join (options_dict[PAPER], '\n    ') % override
+       bookpaper_string = string.join (options_dict[BOOKPAPER], '\n    ') % override
+       notes_string = string.join (options_dict[NOTES], '\n    ') % vars ()
+       preamble_string = string.join (options_dict[PREAMBLE], '\n    ') % override
        return (PREAMBLE_LY + body) % vars ()
 
+
 # BARF
 # use lilypond for latex (.lytex) books,
 # and lilypond --preview for html, texinfo books?
@@ -529,7 +560,8 @@ class Lilypond_snippet (Snippet):
                if s:
                        return compose_ly (s, self.options)
                return ''
-       
+
+       # todo: use md5?
        def get_hash (self):
                if not self.hash:
                        self.hash = abs (hash (self.full_ly ()))
@@ -680,8 +712,15 @@ class Lilypond_snippet (Snippet):
 class Lilypond_file_snippet (Lilypond_snippet):
        def ly (self):
                name = self.substring ('filename')
-               return '\\renameinput \"%s\"\n' % name\
-                              + open (find_file (name)).read ()
+               contents = open (find_file (name)).read ()
+               checksum =  abs (hash (contents))
+               width = default_ly_options[LINEWIDTH]
+               return r'''
+%% hash of included file:  %(checksum)d
+
+\include "%(name)s"
+''' % locals()
+                          
        
                        
 snippet_type_to_class = {
@@ -941,7 +980,7 @@ def do_file (input_filename):
 
        global default_ly_options
        textwidth = 0
-       if LINEWIDTH not in default_ly_options.keys ():
+       if not default_ly_options.has_key (LINEWIDTH):
                if format == LATEX:
                        textwidth = get_latex_textwidth (source)
                        default_ly_options[LINEWIDTH] = '''%.0f\\pt''' \
index 6d9dde7a3f5b1677f6fe46f4c6b92d95839319cc..853ecaa6c144528f1f64368dec9ca181c8ede9bf 100644 (file)
@@ -30,7 +30,6 @@ $(outdir)/%.txt: $(outdir)/%.texi
 $(outdir)/%.texi: %.texi
        rm -f $@
        cp $< $@
-       chmod -w $@