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: Mon, 3 Mar 2014 23:26:52 +0100

2014-03-03 15:51 GMT+01:00 David Kastrup <address@hidden>:
> Thomas Morley <address@hidden> writes:
>
>> 2014-02-27 2:21 GMT+01:00 Kieren MacMillan <address@hidden>:
>>
>> Though, I'm not convinced about it! Basically it's an extended
>> \fromproperty accepting a markuplist, rebuilding \line and the
>> column-commands (\right-column, \center-column etc)
>> Following this direction would mean to rewrite every
>> markuplist-command inside \fromproperty.
>> Not very attractive. I think it's the wrong way.
>
> Me too.  The main problem I see is that \fromproperty returns a markup,
> not a markup list.  You try fudging around that, but that's not
> convincing.  So what I think is needed is a
>
> \fromproperty-lines
>
> instead.  If course, this would require _all_ uses of page:title to
> expect a property list.
>
> Another approach would be to have a markup list command
>
> \line-parts
>
> that takes a line markup and splits it back into a markup list.  Then
> you can use something like
>
> title = \markup { "First part" "second part" } (which is an implicit
> form of \markup \line { "First part" "second part" }), and use something
> like
> \center-column \line-parts \fromproperty #'page:title
> in order to get the split version.
>
> In the end, this sounds like something that could benefit from the
> "markup/markup-list unification" project.
>
> --
> David Kastrup

Hi David,

thanks for your thoughts.
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.
It seems it's always necassary to do something with said list before
returning it. I wasn't able to circumvent that.

Thoughts?

Some dummy/example code below:

\version "2.19.1"

#(define-markup-command (line-parts layout props arg)(markup?)
  (let* ((args (cadr arg))
         (mrkp-ls (map (lambda (x) (markup x)) args))
         (stils (interpret-markup-list layout props args)))

  (display "\n\targ\t")(display arg)
      (display "\n\t\tmarkup-list?\t")(display (markup-list? arg))

  (display "\n\targs\t")(display args)
      (display "\n\t\tmarkup-list?\t")(display (markup-list? args))

  (display "\n\tmrkp-ls\t")(display mrkp-ls)
      (display "\n\t\tmarkup-list?\t")(display (markup-list? mrkp-ls))

  (display "\n\tstils\t")(display stils)
      (display "\n\t\tmarkup-list?\t")(display (markup-list? stils))

  (newline)

  ;; none of these works:
  ;arg
  ;args
  ;mrkp-ls
  ;stils

  (interpret-markup layout props arg)
  ))

\markup \fill-line { \line-parts \line { "Xxx" "Yyy" } }



Cheers,
  Harm



reply via email to

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