From eb452cb7c7e6c35b8d60700fca2f9de69822a4a9 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 18 Aug 2007 01:57:27 -0300 Subject: [PATCH] Fix #404 Mix output-suffix into output filename, and document. --- Documentation/user/running.itely | 15 +++++++++++++++ scm/lily-library.scm | 9 ++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Documentation/user/running.itely b/Documentation/user/running.itely index 10aec0a9f0..34eca21c20 100644 --- a/Documentation/user/running.itely +++ b/Documentation/user/running.itely @@ -61,6 +61,21 @@ they will each be processed independently. @footnote{The status of GUILE is not reset after processing a @code{.ly} file, so be careful not to change any system defaults from within Scheme.} +In addition, the value of @code{output-suffix} will be inserted between +the basename and the number. An input file containing + +@example +#(define output-suffix "violin") +\book @{ @dots{} @} +#(define output-suffix "cello") +\book @{ @dots{} @} +@end example + +@noindent +will output @var{base}@file{-violin.ps} and +@var{base}@file{-cello-1.ps}. + + @subsection Command line options diff --git a/scm/lily-library.scm b/scm/lily-library.scm index 068bbb2873..c925a808f1 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -117,9 +117,13 @@ (let* ((paper (ly:parser-lookup parser '$defaultpaper)) (layout (ly:parser-lookup parser '$defaultlayout)) - (count (ly:parser-lookup parser 'output-count)) - (base (ly:parser-output-name parser))) + (base (ly:parser-output-name parser)) + (output-suffix (ly:parser-lookup parser 'output-suffix)) ) + + (if (string? output-suffix) + (set! base (format "~a-~a" base (string-regexp-substitute + "[^a-zA-Z0-9-]" "_" output-suffix)))) ;; must be careful: output-count is under user control. (if (not (integer? count)) @@ -127,7 +131,6 @@ (if (> count 0) (set! base (format #f "~a-~a" base count))) - (ly:parser-define! parser 'output-count (1+ count)) (process-procedure book paper layout base) )) -- 2.39.2