lilypond-user
[Top][All Lists]
Advanced

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

Re: storing and manipulating multi-chunk texts


From: Thomas Morley
Subject: Re: storing and manipulating multi-chunk texts
Date: Tue, 4 Mar 2014 03:11:59 +0100

2014-03-04 0:06 GMT+01:00 David Kastrup <address@hidden>:
> Thomas Morley <address@hidden> writes:
>
>> 2014-03-03 15:51 GMT+01:00 David Kastrup <address@hidden>:
>>
>>> Another approach would be to have a markup list command \line-parts
>
>> I tried the \line-parts approach:
>> Although it is quite easy to split a simple markup back into a
>> markup-list, I found no way to return a simple list of markups (or
>> stencils) from a markup-command.
>
> That's why I was suggesting making \line-parts a markup list command
> rather than a markup command as you do here:
>
>> #(define-markup-command (line-parts layout props arg)(markup?)
>
Had overlooked it. Thanks for the hint!
I now come up with the code below.
Not sure, if the list picking is really save. Some more tests needed, I guess.
At least it works in the examples.

\version "2.19.1"

#(define-markup-list-command (line-parts layout props args)(markup-list?)
  (let* ((ls (if (chain-assoc-get (cadar args) props)
                 (cadr (chain-assoc-get (cadar args) props))
                 (cadar args))))
  (interpret-markup-list layout props ls)))

%%%%%%%%%%%%
%% TESTS
%%%%%%%%%%%%

\paper {
  bookTitleMarkup =
  \markup
  \box
  \column {
    \fill-line { \bold \fontsize #4 \fromproperty #'header:dedication }
    \vspace #2
    \fontsize #5
    \fill-line { \line-parts { \fromproperty #'header:title } }
    \fill-line {
      \abs-fontsize #12
      \center-column { \line-parts { \fromproperty #'header:meter } }
      \null
    }
  }

  oddHeaderMarkup =
  \markup
    \column {
      \abs-fontsize #12
      \fill-line {
          \rounded-box
          \center-column {
            \bold \fontsize #4 "page-header-test"
            \line-parts { \fromproperty #'header:title }
            \fromproperty #'header:meter
          }
      }
    }
}

\header {
  dedication = "TESTING BOOKTITLE"
  title = \markup { "Aaa" "Bbb" "Ccc" }
  meter = \markup { \rotate #3 "Crazy" \rotate #-3 "Whatever" }
}

\markup
  \column { \vspace #2 \box \bold \fontsize #4 "testing toplevel markups:" }

testOne = \markup { \fontsize #4 "X|X" \italic "YyyyY" }

\markup \box { \line { \line-parts { \testOne } } }
\markup \box { \fill-line { \line-parts { \testOne } } }
\markup \box { \center-column { \line-parts { \testOne } } }


Cheers,
  Harm



reply via email to

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