Mark Polesky writes:
> I wrote a markup command which takes a string and parses
> it to make a special markup. I'm leaving out the details,
> but the input might look something like:
>
> \markup \foo #"abc123"
>
> I want to use this in a Lyrics context, but constantly
> retyping "\markup \foo #" is annoying and takes up a lot
> of space in my file:
>
> \lyricmode {
> \markup \foo #"abc123" __ _
> \markup \foo #"def456"
> \markup \foo #"ghi789" __ _ _
> }
>
> Is there a way to simplify the user interface? This would
> be ideal, but I'm open to other suggestions:
>
> \lyricmode \mapFoo {
> "abc123" __ _ "def456" "ghi789" __ _ _
> }
Try \mapFoo \lyricmode { ... } instead, making \mapFoo a music
function. You then iterate through the music using something like
mapFoo =
#(define-music-function (parser location music) (ly:music?)
(for-each
(lambda (m)
(set! (ly:music-property m 'text)
#{ \markup \foo $(ly:music-property m 'text) #}))
(extract-typed-music music 'lyric-text)))
--
David Kastrup
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user