Lukas-Fabian Moser <[email protected]> writes:

> Hi all,
>
> I just can't seem to get it right:
>
> \version "2.19"
>
> #(define-markup-command (function-A-taking-markup-list layout props
>  input-list) (markup-list?)
>    (interpret-markup layout props (markup (string-concatenate
> input-list))))
>
> #(define-markup-command (feed-split-string-into-A layout props str)
>  (string?)
>    (let* ((strings (string-split str #\,)))
>      (interpret-markup layout props
>         #{ \markup { \function-A-taking-markup-list #strings } #} ;
> HERE: can this be done without #{ ... #} ?
>         )))
>
> \markup {
>   \function-A-taking-markup-list { a b c }
>   \feed-split-string-into-A "d,e,f"
> }
>
> What is the scheme way to construct a markup list (out of a list of
> strings, for example) that can be passed to a markup command?

A list of strings is a markup list.  However, not every markup list is a
list of strings, so you might be on the safer side by using markup list
processing commands rather than string processing commands.

> In the line marked HERE, I would have expected something like (markup
> #:function-A-taking-markup-list strings), but this did not work. 
> Probably it's because I never fully understood what a markup-list
> really is. :-)

That's more a case of

    Known issues and warnings
    .........................

    The markup-list argument of commands such as ‘#:line’, ‘#:center’, and
    ‘#:column’ cannot be a variable or the result of a function call.

         (markup #:line (function-that-returns-markups))

    is invalid.  One should use the ‘make-line-markup’,
    ‘make-center-markup’, or ‘make-column-markup’ functions instead,

         (markup (make-line-markup (function-that-returns-markups)))


So:

\version "2.19"

#(define-markup-command (function-A-taking-markup-list layout props
 input-list) (markup-list?)
   (interpret-markup layout props (make-concat-markup input-list)))

#(define-markup-command (feed-split-string-into-A layout props str)
 (string?)
   (let* ((strings (string-split str #\,)))
     (interpret-markup layout props
      (make-function-A-taking-markup-list-markup strings)
        )))

\markup {
  \function-A-taking-markup-list { a b c }
  \feed-split-string-into-A "d,e,f"
}

-- 
David Kastrup

Reply via email to