From f6caefb696b778cd8f49acc127583253f020248c Mon Sep 17 00:00:00 2001 From: John Mandereau Date: Fri, 29 Feb 2008 17:12:58 +0100 Subject: [PATCH 1/1] Add addversion lilypond-book fragment option --- Documentation/user/lilypond-book.itely | 4 ++++ scripts/lilypond-book.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/Documentation/user/lilypond-book.itely b/Documentation/user/lilypond-book.itely index edafa9e528..ed457215df 100644 --- a/Documentation/user/lilypond-book.itely +++ b/Documentation/user/lilypond-book.itely @@ -656,6 +656,10 @@ will be printed with a verbatim block like f2 e @end example +@item addversion +(Only for Texinfo output.) Prepend line @code{\version +@@w{"@@version@{@}"}} to @code{verbatim} output. + @item texidoc (Only for Texinfo output.) If @command{lilypond} is called with the @option{--header=@/texidoc} option, and the file to be processed is diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 824cbabef9..0da7ce4828 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -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''' }, } @@ -1260,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} -- 2.39.2