[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use markup in \replace when lilypond is expecting a string?
From: |
David Kastrup |
Subject: |
Re: Use markup in \replace when lilypond is expecting a string? |
Date: |
Wed, 15 Jun 2022 22:44:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
P J <p.j.112600@gmail.com> writes:
> Sorry if this is a silly question... but I am struggling with the
> \replace function.
>
> Let's take this example:
>
> -----------
>
> \markup \replace #'(("100" . "hundred")
> ("dpi" . "dots per inch")) "A 100 dpi."
>
> -----------
>
> What code should I use if rather than replacing "100" with "hundred" I
> want, say, to replace "100" with a markup, for instance:
>
> \markup \concat { "1" \translate-scaled #' (-0.5 . 0) "00" }
>
> I have not been able to figure this out!
You'd use
\markup \replace #`(("100" . ,#{ \markup \concat { "1" \translate-scaled
#'(-0.5 . 0) "00" } #}) ("dpi" . "dots per inch")) "A 100 dpi."
if it were supported, which it isn't. Text replacements are purely
string-to-string at the moment. Logically that should not be required
since the replacements happen in the course of creating a stencil from a
string in ly:text-interface::interpret-string which has all the
information it needs to also properly interpret markups.
But it would make for quite trickier code paths.
--
David Kastrup