]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Add addversion lilypond-book fragment option
[lilypond.git] / scripts / lilypond-book.py
index dee8223de6e66d51cdd85f2b6268f963cc2ddba4..0da7ce48289860bde8d4b0905402daa72f60f57c 100644 (file)
@@ -197,6 +197,7 @@ default_ly_options = { 'alt': "[image of music]" }
 #
 # Is this pythonic?  Personally, I find this rather #define-nesque. --hwn
 #
+ADDVERSION = 'addversion'
 AFTER = 'after'
 BEFORE = 'before'
 DOCBOOK = 'docbook'
@@ -682,6 +683,9 @@ output = {
 @verbatim
 %(verb)s@end verbatim
 ''',
+
+        ADDVERSION: r'''\version @w{"@version{}"}
+%(verb)s'''
     },
 }
 
@@ -1244,20 +1248,13 @@ class Lilypond_snippet (Snippet):
         str = ''
         if PRINTFILENAME in self.option_dict:
             base = self.basename ()
-            filename = self.substring ('filename')
-            str = output[global_options.format][PRINTFILENAME] % vars ()
+            filename = os.path.basename (self.substring ('filename'))
+            str = output[format][PRINTFILENAME] % vars ()
 
         return str
 
     def output_texinfo (self):
-        str = ''
-        if self.output_print_filename (TEXINFO):
-            str += ('@html\n'
-                + self.output_print_filename (HTML)
-                + '\n@end html\n')
-            str += ('@tex\n'
-                + self.output_print_filename (LATEX)
-                + '\n@end tex\n')
+        str = self.output_print_filename (TEXINFO)
         base = self.basename ()
         if TEXIDOC in self.option_dict:
             texidoc = base + '.texidoc'
@@ -1267,6 +1264,8 @@ class Lilypond_snippet (Snippet):
         substr = ''
         if VERBATIM in self.option_dict:
             verb = self.verb_ly ()
+            if ADDVERSION in self.option_dict:
+                verb = output[TEXINFO][ADDVERSION] % vars ()
             substr += output[TEXINFO][VERBATIM] % vars ()
             if not QUOTE in self.option_dict:
                 substr = output[TEXINFO][NOQUOTE] % {'str':substr}