diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-05-19 16:24:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-05-19 16:24:00 +0200 |
commit | 663cdcff77510b4cf9f165a7c8aa147f8ad2a50a (patch) | |
tree | aa38316838dcda4a112c6114bd183269c8002757 /tex/context/base/char-ini.lua | |
parent | cf10a29d938a8fd2ad81f8034b53ee7409990169 (diff) | |
download | context-663cdcff77510b4cf9f165a7c8aa147f8ad2a50a.tar.gz |
beta 2010.05.19 16:24
Diffstat (limited to 'tex/context/base/char-ini.lua')
-rw-r--r-- | tex/context/base/char-ini.lua | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua index 1970f7579..9393feee7 100644 --- a/tex/context/base/char-ini.lua +++ b/tex/context/base/char-ini.lua @@ -11,7 +11,7 @@ xml = xml or { } local utf = unicode.utf8 -local utfchar, utfbyte = utf.char, utf.byte +local utfchar, utfbyte, utfvalues = utf.char, utf.byte, string.utfvalues local concat = table.concat local next, tonumber = next, tonumber local texsprint, texprint = tex.sprint, tex.print @@ -632,3 +632,21 @@ characters.active_offset = 0x10000 -- there will be remapped in that byte range -- entities.amp = utfchar(characters.active_offset + utfbyte("&")) -- entities.gt = utfchar(characters.active_offset + utfbyte(">")) -- end + +-- some day we will make a table + +function characters.lower(str) + local new = { } + for u in utfvalues(str) do + new[#new+1] = utfchar(data[u].lccode or u) + end + return concat(new) +end + +function characters.upper(str) + local new = { } + for u in utfvalues(str) do + new[#new+1] = utfchar(data[u].uccode or u) + end + return concat(new) +end |