This patch makes lilypond-book properly handle quoted html attributes.

I thought it was surprising and undocumented that
  <lilypond option="quoted option">
is not parsed correctly, so this fixes that.

Currently, it gives you an option called 'option' with the value '"quoted'
and a second option called 'option"' with no value.

~ John Williams

--- lilypond-book       2005/04/02 22:46:41     1.1.1.2
+++ lilypond-book       2005/04/02 22:49:45     1.1.1.3
@@ -615,9 +615,6 @@
                       re.sub ('}', '@}',
                               re.sub ('@', '@@', s)))
 
-def split_options (option_string):
-       return re.split (format_res[format]['option_sep'], option_string)
-
 class Chunk:
        def replacement_text (self):
                return ''
@@ -686,7 +683,12 @@
        def do_options (self, option_string, type):
                self.option_dict = {}
 
-               options = split_options(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])
+               else:
+                       options = re.split (format_res[format]['option_sep'], 
option_string)
 
                for i in options:
                        if string.find (i, '=') > 0:
_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to