diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-10-20 21:33:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-10-20 21:33:00 +0200 |
commit | 06c355066a4cf2af674302948c2f3caee06932f2 (patch) | |
tree | 2668141d43dc6ad4e81f672cfaf7a2362f5e846d /tex/context/base/char-tex.lua | |
parent | db84fb28effa91e82c83151168a27c8d85759973 (diff) | |
download | context-06c355066a4cf2af674302948c2f3caee06932f2.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.lua | 12 |
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 |