This is similar to something I learned to do from this list. Thank you,
list wizards.

I generate scores for both printing (paginated PDFs) and displaying on a
website generated by the Sphinx documentation system (unpaginated SVGs).
Sometimes, I want to regenerate ALL the scores. So I have a Bash script to
do the work and a command-line argument that determines which type  (PDF or
SVG) will be generated. I have two include scripts: svg.ily and pdf.ily
(which I keep in ~/.local/lib/lilypond/). In all of my Frescobaldi
templates, I have the lines:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use environment variable to decide if discrete pagination (PDF) or
% continuous pagination (SVG). Default to SVG if not defined.
%
pageBreaking = #(string-append (getenv "HOME") "/.local/lib/lilypond/" (if
(getenv "PAGE_BREAKING") (getenv "PAGE_BREAKING") "svg") ".ily")
\include \pageBreaking
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Then, in my Bash scripts, I can have code like:

#######################################################
for source in $(find . -name "*.ly")
do
  PAGE_BREAKING=svg lilypond --svg $source
  # ... generate MP3 from MIDI, reduce SVG size, etc.
done
#######################################################

The two include files:

pdf.ily:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PDF
% 8.5" x 11" (Letter) page size
%

\paper {
  #(include-special-characters)
  #(set-paper-size "letter")
  print-page-number = ##f
  ragged-last-bottom = ##t
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

svg.ily:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Web SVG (Sphinx Cloud theme):
% One long continuous page
%

#(ly:set-option 'backend 'cairo)
\paper {
  #(include-special-characters)
  oddHeaderMarkup = \markup \null
  evenHeaderMarkup = \markup \null
  page-breaking = #ly:one-page-breaking

  #(define fonts
     (set-global-fonts
      #:roman "Open Sans"
      #:sans "Open Sans"
      #:typewriter "DejaVu Sans Mono"
      ; unnecessary if the staff size is default
      #:factor (/ staff-height pt 20)
      ))
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Reply via email to