|
From: | Lukas-Fabian Moser |
Subject: | Re: Making markup functions parametric |
Date: | Fri, 3 Jul 2020 23:29:10 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
Hi Urs,
Thanks a lot. That's exactly the kind of procedure I can store and apply: \version "2.20.0" #(define-markup-command (dyna layout props func content)(symbol? markup?) (let* ((funcs `((box . ,make-box-markup) (circle . ,make-circle-markup)))) (interpret-markup layout props (markup ((assq-ref funcs func) content))))) \markup \dyna #'circle "C:" \markup \dyna #'box "C:"
You don't even need to hardcode the make-xxx-markup functions: \version "2.20" #(define (get-scheme-markup-function func) (string->symbol (string-append "make-" (symbol->string func) "-markup"))) #(define-markup-command (dynb layout props func content)(symbol? markup?) (interpret-markup layout props (primitive-eval (list 'markup (list (get-scheme-markup-function func) content))))) \markup \dynb #'circle "C" \markup \dynb #'box "C" Best Lukas
[Prev in Thread] | Current Thread | [Next in Thread] |