ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: luigi scarso <luigi.scarso@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: context.labeltext(...)
Date: Mon, 4 Jul 2011 17:54:22 +0200	[thread overview]
Message-ID: <CAG5iGsDxBTGtu7JyzBP0QfS4ihYQgKKe5VfUrKY-YOrL19bNuQ@mail.gmail.com> (raw)
In-Reply-To: <3A06F342-571C-4790-B5F9-D3A63AC846A9@boede.nl>

On Mon, Jul 4, 2011 at 5:02 PM, Willi Egger <w.egger@boede.nl> wrote:
> Hi all,
>
> experimenting with context.labeltext...
>
> My question is how can I tweak the context.labeltext(text) command at the lua-side to make ConTeXt to typeset  the labeltext starting with an uppercase letter? e.g.  if "text" contains "january" to display "January"?
And if text is foo you want Foo ?
In char-ini.lua, among others, there is
function characters.upper(str)
    local new, n = { }, 0
    for u in utfvalues(str) do
        n = n + 1
        new[n] = ucchars[u]
    end
    return concat(new)
end
The idea is to take the first character from characters.upper(str),
and all but not first from str
and then join them using concat.

-- 
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2011-07-04 15:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 15:02 context.labeltext(...) Willi Egger
2011-07-04 15:41 ` context.labeltext(...) Wolfgang Schuster
2011-07-04 16:00   ` context.labeltext(...) Willi Egger
2011-07-04 16:12     ` context.labeltext(...) Wolfgang Schuster
2011-07-04 15:54 ` luigi scarso [this message]
2011-07-04 16:05   ` context.labeltext(...) Willi Egger
2011-07-04 16:14     ` context.labeltext(...) Wolfgang Schuster
2011-07-04 16:20     ` context.labeltext(...) luigi scarso
2011-07-04 16:53       ` context.labeltext(...) Khaled Hosny
2011-07-04 17:02         ` context.labeltext(...) Wolfgang Schuster
2011-07-05  7:22         ` context.labeltext(...) Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG5iGsDxBTGtu7JyzBP0QfS4ihYQgKKe5VfUrKY-YOrL19bNuQ@mail.gmail.com \
    --to=luigi.scarso@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).