lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Header fields in custom footer


From: Noeck
Subject: Re: Header fields in custom footer
Date: Sat, 26 Nov 2016 23:17:46 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

Hi,

your code works pretty well. Thanks, Harm!

The following questions are left:

(1) How to center the whole markup? \center-column does not work.
    It should be easy, but perhaps it's too late.

(2) The footer should appear only on the first page, the last page
    should be different, all other pages should be empty.
    Like \on-the-fly #first-page and #last-page which I could not use
    successfully

(3) How can I use header fields for the url in \with-url?
    Your clever functions couldn't help me. Probably such a function
    should return a string instead of a markup?

Thanks again!
Joram


Here is what I have got so far:

%%%%%%%%%%%%%%%%%%%%%

\version "2.19.22"

#(define-markup-command (fillwith layout props arg)(symbol?)
  #:properties ((proc '()))
  (let* ((target (chain-assoc-get arg props))
         (target-string (markup->string target))
         (output
           (if (or (null? proc) (string-null? target-string))
               target
               (proc target-string))))

    (if (markup? output)
        ;; prevent infinite loops by clearing the interpreted property:
        (interpret-markup
          layout
          (cons
            (list (cons symbol `(,property-recursive-markup ,symbol)))
props)
          output)
        empty-stencil)))

#(define (transform-web)
  (lambda (strg)
    (if (string? strg)
        (format #f "- ~a" (substring strg 7))
        strg)))

#(define (transform-license)
   (lambda (strg)
     (if (string? strg)
         (format #f "CC ~a"
           (string-upcase (substring strg 3))))))


\header {
  composer = "Mozart"
  maintainer = "Name"
  maintainerWeb = "http://example.com";
  license = "cc-by-sa"
}


\paper {
  % (1) how to center the whole markup? \center-column does not work:
  %     oddFooterMarkup = \markup \center-column \line {
  % (2) it should appear only on the first page
  %     the last page should be different
  %     all other pages should be empty
  %     oddFooterMarkup = \on-the-fly #first-page \markup \line {
  %     does not work

  oddFooterMarkup = \markup \line{
    "By"
    \with-url
      #"http://example.com";   % (3a) how to use maintainerWeb here?
      \line {
        \fillwith #'header:maintainer
        \override #`(proc . ,(transform-web)) \fillwith
#'header:maintainerWeb
      }
    "-"
    \with-url
      #(format
        "https://creativecommons.org/licenses/~a/4.0/";
        (substring "cc-by-sa" 3))  % (3b) how to use license here?
     \line {
       "License:" \smaller
       \override #`(proc . ,(transform-license)) \fillwith #'header:license
     }
  }
}


{ a1 \pageBreak a }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]