summaryrefslogtreecommitdiff
path: root/tex/context/base/char-tex.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-10-20 22:40:11 +0300
committerMarius <mariausol@gmail.com>2010-10-20 22:40:11 +0300
commit575435e91f9abcf123aa96fd3790e0d61b719333 (patch)
treed59a1d839eb9a477cb5b2c4301218de0ba0ef815 /tex/context/base/char-tex.lua
parentb23c2188805ed9f7bdbdbe11eed957a32e90f5ce (diff)
downloadcontext-575435e91f9abcf123aa96fd3790e0d61b719333.tar.gz
beta 2010.10.20 21:33
Diffstat (limited to 'tex/context/base/char-tex.lua')
-rw-r--r--tex/context/base/char-tex.lua12
1 files changed, 5 insertions, 7 deletions
diff --git a/tex/context/base/char-tex.lua b/tex/context/base/char-tex.lua
index 6e57a860a..538915dd3 100644
--- a/tex/context/base/char-tex.lua
+++ b/tex/context/base/char-tex.lua
@@ -6,9 +6,9 @@ if not modules then modules = { } end modules ['char-tex'] = {
license = "see context related readme files"
}
-local find = string.find
-
local lpeg = lpeg
+
+local find = string.find
local P, C, R, S, Cs, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc
local U, lpegmatch = lpeg.patterns.utf8, lpeg.match
@@ -77,13 +77,11 @@ local convert_accents_strip = Cs((no_l * accents * no_r + accents + P(1))^0)
local convert_commands_strip = Cs((no_l * commands * no_r + commands + P(1))^0)
function characters.tex.toutf(str,strip)
- if find(str,"\\") then -- we can start at teh found position
+ if find(str,"\\") then -- we can start at the found position
if strip then
- str = lpegmatch(convert_commands_strip,str)
- str = lpegmatch(convert_accents_strip,str)
+ return lpegmatch(convert_accents_strip,lpegmatch(convert_commands_strip,str))
else
- str = lpegmatch(convert_commands,str)
- str = lpegmatch(convert_accents,str)
+ return lpegmatch(convert_accents, lpegmatch(convert_commands, str))
end
end
return str