[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \uppercase function
From: |
Thomas Morley |
Subject: |
Re: \uppercase function |
Date: |
Fri, 10 Apr 2015 02:38:07 +0200 |
2015-04-09 23:42 GMT+02:00 David Nalesnik <address@hidden>:
> Kieren,
>
>
>>
>>
>> On Thu, Apr 9, 2015 at 3:02 PM, Kieren MacMillan
>> <address@hidden> wrote:
>>>
>>>
>>>
>>> Here’s the concrete use-case:
>>> 1. I have musical theatre pieces with (naturally enough) title case
>>> titles, such as “My Lucky Day”.
>>> 2. When they’re included in the Piano/Conductor score (or other score
>>> from the regular performance materials), the title should remain in title
>>> case.
>>> 3. When they’re included in a songbook, I’m trying to show the title in
>>> the the expected format, which is all-caps (cf. modern Warner-Chappell
>>> imprints), e.g., “MY LUCKY DAY”.
>>> 4. I want to accomplish this entirely in the stylesheets, and not have to
>>> have two different ways of inputting the title in the code/content.
>
>
> I have no idea how intricate your workflow is, but could you adapt
> something like the following?
>
> Create a file "header.ily":
>
> %%%%%%%%%
>
> \header {
> title = "My Lucky Day"
> title = #(cond
> ((defined? 'songbook) (string-upcase title))
> ((defined? 'regular-performance-materials) title)
> (else title))
> }
>
> %%%%%%%%%%%
>
> Then mysongbook.ly:
>
> %%%%%%%%%%%%%%%%%%%%
>
> \version "2.19"
>
> #(define songbook #t)
>
> \include "header.ily"
>
> {
> c
> }
>
> %%%%%%%%%%%%%%%%%%%%
>
> Perhaps you could define songbook on the command line.
>
> --David
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
Hi,
well, it is possible.
\version "2.19.18"
#(define-markup-list-command
(fromproperty-upcase layout props args)(markup-list?)
(let* ((proc
(lambda (a)
(let ((fromproperty-markup?
(lambda (m) (if (procedure? m)
(eq? 'fromproperty-markup
(procedure-name m))))))
(cond
((and (list? a)
(not (null? a)) ;; hmm, can the argument ever be null?
(fromproperty-markup? (car a)))
(let* ((prop-arg (chain-assoc-get (last a) props))
(fromprop-arg (if (not (list? prop-arg))
(list prop-arg)
prop-arg))
(which-arg
(if (procedure? (car fromprop-arg))
(last fromprop-arg)
fromprop-arg)))
(if prop-arg
which-arg
(list ""))
))
(else (list ""))))))
(first-arg
(car (map proc args)))
(first-arg-upcase
(map
(lambda (s)
(if (string? s)
(string-upcase s)
""))
(if (not (list? first-arg))
(list first-arg)
first-arg))))
(interpret-markup-list layout props (remove string-null? first-arg-upcase))
))
\paper {
bookTitleMarkup =
\markup
\fill-line {
\fromproperty-upcase { \fromproperty #'header:dedication }
}
}
\header {
dedication =
\markup { \with-color #red \draw-line #'(0 . 1) "Testing Booktitle" }
}
{ c''1 }
This derived from my line-parts from
http://lists.gnu.org/archive/html/lilypond-user/2014-03/msg00590.html
Never got a feed-back, so I abondanded work on it...
Cheers,
Harm
- Re: \uppercase function, (continued)
- Re: \uppercase function, David Nalesnik, 2015/04/09
- Re: \uppercase function, Kieren MacMillan, 2015/04/09
- Re: \uppercase function, Kieren MacMillan, 2015/04/09
- Re: \uppercase function, David Nalesnik, 2015/04/09
- Re: \uppercase function, David Nalesnik, 2015/04/09
- Re: \uppercase function,
Thomas Morley <=
- Re: \uppercase function, Kieren MacMillan, 2015/04/09