[Top][All Lists]

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

Re: defining an \uppercase markup function

From: Nicolas Sceaux
Subject: Re: defining an \uppercase markup function
Date: Wed, 9 Sep 2009 19:29:24 +0200

Le 9 sept. 09 à 15:58, Kieren MacMillan a écrit :

The problem is, something like

 \markup \uppercase \fromproperty #'header:title

fails. In general, I'd rather have the syntax be

 \markup \uppercase { "test }

instead of

 \markup \uppercase #"test"

There is currently no workaround to this issue.

If all pure string markups were interpreted through the `simple'
command, (which would require modifying the parser and the `markup'
scheme macro), it would possible to do eg:

#(define-markup-command (uppercase paper props markup-argument) (markup?)
   "Make the markup uppercase.
 Syntax: \\uppercase \"string\""
(interpret-markup paper (prepend-alist-chain 'case 'up props) markup-argument))

#(define-markup-command (simple paper props str) (string?)
  "Depending on the `case' property, may change the case
of the string before interpreting it."
  (let ((text-case (chain-assoc-get 'case props 'normal)))
    (interpret-markup paper props
      (case text-case
       ((up) (string-upcase str))
       ((down) (string-downcase str))
       ;; TODO: small caps, capitalized text, etc
       (else str)))))

%%\markup { \uppercase { toto \bold titi } tata }
\markup { \uppercase { \simple #"toto" \bold \simple #"titi" } \simple #"tata" }

==> TOTO *TITI* tata


reply via email to

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