]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/book_html.py
lilypond-manuals.css: edit color scheme and some spacing
[lilypond.git] / python / book_html.py
index d5eb6dfede52aa48a558a150cfa7a7c9bbe7f496..ac70b743a0e3a91727f3ee099b5026056b028bbb 100644 (file)
@@ -40,6 +40,13 @@ HTML_snippet_res = {
     'multiline_comment':
          r'''(?smx)(?P<match>\s*(?!@c\s+)(?P<code><!--\s.*?!-->)\s)''',
 
+    'musicxml_file':
+         r'''(?mx)
+          (?P<match>
+          <musicxmlfile\s*(?P<options>.*?)\s*>
+          \s*(?P<filename>.*?)\s*
+          </musicxmlfile\s*>)''',
+
     'verb':
          r'''(?x)(?P<match>(?P<code><pre>.*?</pre>))''',
 
@@ -62,7 +69,7 @@ HTML_output = {
 </p>''',
 
     BEFORE: r'''<p>
- <a href="%(base)s.ly">''',
+ <a href="%(base)s%(ext)s">''',
 
     OUTPUT: r'''
   <img align="middle"
@@ -70,7 +77,7 @@ HTML_output = {
        src="%(image)s"
        alt="%(alt)s">''',
 
-    PRINTFILENAME: '<p><tt><a href="%(base)s.ly">%(filename)s</a></tt></p>',
+    PRINTFILENAME: '<p><tt><a href="%(base)s%(ext)s">%(filename)s</a></tt></p>',
 
     QUOTE: r'''<blockquote>
 %(str)s
@@ -101,7 +108,7 @@ class BookHTMLOutputFormat (BookBase.BookOutputFormat):
 
     def split_snippet_options (self, option_string):
         if option_string:
-            options = re.findall('[\w\.-:]+(?:\s*=\s*(?:"[^"]*"|\'[^\']*\'|\S+))?',
+            options = re.findall('[-\w\.-:]+(?:\s*=\s*(?:"[^"]*"|\'[^\']*\'|\S+))?',
                                  option_string)
             options = [re.sub('^([^=]+=\s*)(?P<q>["\'])(.*)(?P=q)', '\g<1>\g<3>', opt)
                        for opt in options]
@@ -118,12 +125,14 @@ class BookHTMLOutputFormat (BookBase.BookOutputFormat):
         str = ''
         rep = snippet.get_replacements ();
         rep['base'] = basename
+        rep['filename'] = os.path.basename (snippet.filename)
+        rep['ext'] = snippet.ext
         str += self.output_print_filename (basename, snippet)
         if VERBATIM in snippet.option_dict:
             rep['verb'] = BookBase.verbatim_html (snippet.verb_ly ())
             str += self.output[VERBATIM] % rep
         if QUOTE in snippet.option_dict:
-            str = self.output[QUOTE] % rep
+            str = self.output[QUOTE] % {'str': str}
 
         str += self.output[BEFORE] % rep
         for image in snippet.get_images ():