[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Header fields in custom footer
From: |
Thomas Morley |
Subject: |
Re: Header fields in custom footer |
Date: |
Tue, 6 Dec 2016 00:10:10 +0100 |
2016-12-02 0:43 GMT+01:00 Noeck <address@hidden>:
> Hi Harm,
>
> hm, I am still not getting what I want. I fear that's what you meant by
> the limitations concerning the $defaultheader.
Yep.
\headers can be set at very different levels, I simply don't know how
to catch others than the first instance at toplevel.
> Can this be solved?
Falling back to markup-commands may work. See below.
Though, I fear you'll have no difficulties to get it broken. Regard it
as a first sketch.
#(define-markup-command (my-with-url layout props url arg)
(markup? markup?)
#:properties ((proc '()))
(let* ((stil (interpret-markup layout props arg))
(xextent (ly:stencil-extent stil X))
(yextent (ly:stencil-extent stil Y))
(old-expr (ly:stencil-expr stil))
(possible-url-string (chain-assoc-get (last url) props))
;; be aware: not recursing!!!
(url-string
(if (string? possible-url-string)
(if (null? proc)
possible-url-string
(proc possible-url-string))
""))
(url-expr
(list 'url-link url-string `(quote ,xextent) `(quote ,yextent))))
(ly:stencil-add (ly:make-stencil url-expr xextent yextent) stil)))
#(define test-proc
(lambda (strg)
(if (string? strg)
(format #f "https://creativecommons.org/licenses/~a/4.0/"
(substring strg 3))
strg)))
\header {
composer = "Mozart"
maintainer = "NameName"
maintainerWeb = "http://example.com"
license = "cc-by-sa"
}
\paper {
oddFooterMarkup =
\markup \column {
\fill-line {
\on-the-fly #first-page
\line {
"By"
\my-with-url
\fromproperty #'header:maintainerWeb
\fromproperty #'header:maintainer
"-"
\override #`(proc . ,test-proc)
\my-with-url
\fromproperty #'header:license
\line { "License:" \smaller #(module-ref $defaultheader 'license) }
}
}
\fill-line {
%% Tagline header field only on last page in the book.
\on-the-fly #last-page \fromproperty #'header:tagline
}
}
}
{ a1 \pageBreak a \pageBreak a }
Cheers,
Harm