lilypond-devel
[Top][All Lists]
Advanced

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

Re: markup to string function?


From: Jan-Peter Voigt
Subject: Re: markup to string function?
Date: Fri, 28 Jan 2011 12:42:58 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7

Hello again,

maybe my answer is a bit off your topic, because I think you are looking for a C function. But still, markups are lists in scheme, so you might use libguile to access this function in C:

--snip--
#(define (markup->string mup conc)
        (let ((result ""))
             ;;(display "(")
             (map (lambda (x)
                          (begin
                            ;;(display "> ")(display conc)(display "\n")
                            (if (eq? x concat-markup)(set! conc #t))
                            (if (list? x)
                                (set! result
                                  (if (or conc (string=? result ""))
(string-append result (markup->string x conc)) (string-append result " " (markup->string x conc)))))
                            (if (string? x)
                                (set! result
                                  (if (or conc (string=? result ""))
                                      (string-append result x)
                                      (string-append result " " x))))
                            result))
                  mup)
             ;;(display ")")
             result)
)
#(define-markup-command (plain-text layout props arg)(markup?)
(interpret-markup layout props (markup (markup->string arg #f))))

ttt = \markup { \italic "Title of " \bold \concat {"the" " " "piece"} }

\header {
  title = \ttt
  subtitle = \markup { \normal-text { \italic { \plain-text \ttt } } }
}
\relative c' {
  c
}
--snip--

Regards,
Jan-Peter




reply via email to

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