]> git.donarmstrong.com Git - lilypond.git/commitdiff
patches by John Williams:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 20 Apr 2005 10:52:20 +0000 (10:52 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 20 Apr 2005 10:52:20 +0000 (10:52 +0000)
htmlquote bugfix.
Allow snippets to be given distinct filenames.
Allow the default alt text to be overridden.

ChangeLog
Documentation/user/basic-notation.itely
lily/slur-scoring.cc
scripts/lilypond-book.py

index 493451251cf5d84c26218bbb3b6cf0ed1a2212f6..987469c926f0b7a9783804abd8911547dad443d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,19 @@
+2005-04-20  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scripts/lilypond-book.py: patches by John Williams:
+       htmlquote bugfix.
+       Allow snippets to be given distinct filenames.
+       Allow the default alt text to be overridden.
+
 2005-04-20  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * configure.in (no gui_b): Remove optional gtk+ requirement.
 
 2005-04-20  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * Documentation/user/basic-notation.itely (Pitches): add
+       LedgerLineSpanner.
+
        * lily/dynamic-engraver.cc (process_music): set right bound to
        script if present. Else, do not set.
        (acknowledge_grob): only set right bound of finished spanner to
index 41aa2070383aefc2eae9bf6a563d22dc0767146c..740a7d0a3752ae3ccc513c1bf346aaba694b0906 100644 (file)
@@ -138,7 +138,8 @@ espanol.ly     do  re  mi  fa  sol la  sib si  -s          -b
 
 @seealso
 
-Program reference: @internalsref{NoteEvent}, and @internalsref{NoteHead}.
+Program reference: @internalsref{NoteEvent},
+@internalsref{LedgerLineSpanner}, and @internalsref{NoteHead}.
 
 
 
index f0cebb1a73f86210785dd7c4dd98b3f0c7a451b7..160e157089c104be4c3450d01b3f2370bdaa8162 100644 (file)
@@ -32,8 +32,6 @@
 
   - curve around flag for y coordinate
 
-  - this file is a mess, clean it up
-
   - short-cut: try a smaller region first.
 
   - handle non-visible stems better.
index 04ac4a65aaa79b24cf0c6dcd2d6dec621078eafd..49c0a46565ba81e50d2ecbc9cb849287b3f8b880 100644 (file)
@@ -118,7 +118,7 @@ output_name = ''
 latex_filter_cmd = 'latex "\\nonstopmode \input /dev/stdin"'
 filter_cmd = 0
 process_cmd = ''
-default_ly_options = {}
+default_ly_options = { 'alt': "[image of music]" }
 
 #
 # Is this pythonic?  Personally, I find this rather #define-nesque. --hwn
@@ -152,6 +152,8 @@ TEXIDOC = 'texidoc'
 TEXINFO = 'texinfo'
 VERBATIM = 'verbatim'
 FONTLOAD = 'fontload'
+FILENAME = 'filename'
+ALT = 'alt'
 
 
 # NOTIME has no opposite so it isn't part of this dictionary.
@@ -390,7 +392,9 @@ simple_options = [
        PRINTFILENAME,
        TEXIDOC,
        VERBATIM,
-       FONTLOAD
+       FONTLOAD,
+       FILENAME,
+       ALT
 ]
 
 ly_options = {
@@ -443,7 +447,7 @@ output = {
 
                OUTPUT: r'''
     <img align="center" valign="center"
-        border="0" src="%(image)s" alt="[image of music]">''',
+        border="0" src="%(image)s" alt="%(alt)s">''',
 
                PRINTFILENAME: '<p><tt><a href="%(base)s.ly">%(filename)s</a></tt></p>',
 
@@ -507,13 +511,13 @@ output = {
 
                OUTPUTIMAGE: r'''@noindent
 @ifinfo
-@image{%(base)s,,,[image of music],%(ext)s}
+@image{%(base)s,,,%(alt)s,%(ext)s}
 @end ifinfo
 @html
 <p>
   <a href="%(base)s.ly">
     <img align="center" valign="center"
-        border="0" src="%(image)s" alt="[image of music]">
+        border="0" src="%(image)s" alt="%(alt)s">
   </a>
 </p>
 @end html
@@ -623,8 +627,14 @@ def verbatim_texinfo (s):
 
 def split_options (option_string):
        if option_string:
-               return re.split (format_res[format]['option_sep'],
-                                option_string)
+               if format == HTML:
+                       options = re.findall('[\w\.-:]+(?:\s*=\s*(?:"[^"]*"|\'[^\']*\'|\S+))?',option_string)
+                       for i in range(len(options)):
+                               options[i] = re.sub('^([^=]+=\s*)(?P<q>["\'])(.*)(?P=q)','\g<1>\g<3>',options[i])
+                       return options
+               else:
+                       return re.split (format_res[format]['option_sep'],
+                                        option_string)
        return []
 
 class Chunk:
@@ -683,8 +693,7 @@ class Lilypond_snippet (Snippet):
        def __init__ (self, type, match, format, line_number):
                Snippet.__init__ (self, type, match, format, line_number)
                os = match.group ('options')
-               if os:
-                       self.do_options (os, self.type)
+               self.do_options (os, self.type)
 
        def ly (self):
                return self.substring ('code')
@@ -872,6 +881,8 @@ class Lilypond_snippet (Snippet):
                return self.hash
 
        def basename (self):
+               if FILENAME in self.option_dict:
+                       return self.option_dict[FILENAME]
                if use_hash_p:
                        return 'lily-%d' % self.get_hash ()
                raise 'to be done'
@@ -893,8 +904,9 @@ class Lilypond_snippet (Snippet):
                     and os.path.exists (system_file)\
                     and os.stat (system_file)[stat.ST_SIZE] \
                     and re.match ('% eof', open (system_file).readlines ()[-1])
-               if ok and (use_hash_p \
-                          or self.ly () == open (ly_file).read ()):
+               if ok and (not use_hash_p or FILENAME in self.option_dict):
+                       ok = (self.full_ly () == open (ly_file).read ())
+               if ok:
                        # TODO: Do something smart with target formats
                        #       (ps, png) and m/ctimes.
                        return None
@@ -957,6 +969,7 @@ class Lilypond_snippet (Snippet):
                str += output[HTML][BEFORE] % vars ()
                for image in self.get_images ():
                        (base, ext) = os.path.splitext (image)
+                       alt = self.option_dict[ALT]
                        str += output[HTML][OUTPUT] % vars ()
                str += output[HTML][AFTER] % vars ()
                return str
@@ -969,6 +982,7 @@ class Lilypond_snippet (Snippet):
                        # URG, makeinfo implicitly prepends dot to extension.
                        # Specifying no extension is most robust.
                        ext = ''
+                       alt = self.option_dict[ALT]
                        str += output[TEXINFO][OUTPUTIMAGE] % vars ()
 
                base = self.basename ()