summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/third/transliterator/t-transliterator.mkiv4
-rw-r--r--tex/context/third/transliterator/transliterator.lua19
2 files changed, 13 insertions, 10 deletions
diff --git a/tex/context/third/transliterator/t-transliterator.mkiv b/tex/context/third/transliterator/t-transliterator.mkiv
index e9510e0..b8c577a 100644
--- a/tex/context/third/transliterator/t-transliterator.mkiv
+++ b/tex/context/third/transliterator/t-transliterator.mkiv
@@ -1,6 +1,6 @@
%D \module
%D [ file=t-transliterator,
-%D version=2010-12-23 22:10:09+0100,
+%D version=2013-03-27 21:23:59+0100,
%D title=\CONTEXT\ User Module,
%D subtitle=The Transliterator,
%D author=Philipp Gesang,
@@ -22,7 +22,7 @@
setup=list,
parent=TRL,
style=no,
- version=hg-r16,
+ version=hg-r56,
comment=Transliteration from non-Latin scripts.,
]
diff --git a/tex/context/third/transliterator/transliterator.lua b/tex/context/third/transliterator/transliterator.lua
index 873e6d6..1278aeb 100644
--- a/tex/context/third/transliterator/transliterator.lua
+++ b/tex/context/third/transliterator/transliterator.lua
@@ -1,10 +1,10 @@
#!/usr/bin/env texlua
--------------------------------------------------------------------------------
-- FILE: transliterator.lua
--- USAGE: to be called by t-transliterator.mkiv
+-- USAGE: to be called by t-transliterator.mkiv
-- DESCRIPTION: basic lua environment for the Transliterator module
-- REQUIREMENTS: latest ConTeXt MkIV
--- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
+-- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com>
-- CREATED: 2010-12-23 22:12:31+0100
--------------------------------------------------------------------------------
--
@@ -17,6 +17,10 @@ translit.methods = translit.methods or { }
translit.deficient_font = "no"
translit.parser_cache = { }
+local utf8 = unicode.utf8
+local utf8byte = utf8.byte
+local utf8len = utf8.len
+
--------------------------------------------------------------------------------
-- Predefining vowel lists
--------------------------------------------------------------------------------
@@ -76,7 +80,7 @@ do
end
}
- function translit.make_add_dict(dict)
+ translit.make_add_dict = function (dict)
return setmetatable(dict, Dict_add)
end
end
@@ -88,13 +92,12 @@ end
-- Generate a rule pattern from hash table.
do
local P, R, V = lpeg.P, lpeg.R, lpeg.V
- local len = unicode.utf8.len
-- multi-char rules first
- function translit.addrules (dict, rules)
+ translit.addrules = function (dict, rules)
local by_length, occurring_lengths = { }, { }
for chr, _ in next, dict do
- local l = len(chr)
+ local l = utf8len(chr)
if not by_length[l] then
by_length[l] = { }
occurring_lengths[#occurring_lengths+1] = l
@@ -141,9 +144,9 @@ local strempty = function (s)
local i = 1
local r = ""
repeat
- r = r .. utf.byte(s,i) .. " "
+ r = r .. utf8byte(s,i) .. " "
i = i + 1
- until utf.byte(s,i) == nil
+ until utf8byte(s,i) == nil
return r
end
end