summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/lang-rep.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/lang-rep.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/lang-rep.lua21
1 files changed, 17 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/context/base/lang-rep.lua b/Master/texmf-dist/tex/context/base/lang-rep.lua
index 02eb59f487c..95a5e545aac 100644
--- a/Master/texmf-dist/tex/context/base/lang-rep.lua
+++ b/Master/texmf-dist/tex/context/base/lang-rep.lua
@@ -15,7 +15,7 @@ if not modules then modules = { } end modules ['lang-rep'] = {
-- although (given experiences so far) we don't really need that. After all, each problem
-- is somewhat unique.
-local type = type
+local type, tonumber = type, tonumber
local utfbyte, utfsplit = utf.byte, utf.split
local P, C, U, Cc, Ct, lpegmatch = lpeg.P, lpeg.C, lpeg.patterns.utf8character, lpeg.Cc, lpeg.Ct, lpeg.match
local find = string.find
@@ -56,6 +56,8 @@ local unsetvalue = attributes.unsetvalue
local v_reset = interfaces.variables.reset
+local implement = interfaces.implement
+
local replacements = languages.replacements or { }
languages.replacements = replacements
@@ -75,6 +77,8 @@ table.setmetatableindex(lists,function(lists,name)
return data
end)
+lists[v_reset].attribute = unsetvalue -- so we discard 0
+
-- todo: glue kern
local function add(root,word,replacement)
@@ -260,7 +264,7 @@ end
local enabled = false
-function replacements.set(n) -- number or 'reset'
+function replacements.set(n)
if n == v_reset then
n = unsetvalue
else
@@ -278,5 +282,14 @@ end
-- interface
-commands.setreplacements = replacements.set
-commands.addreplacements = replacements.add
+implement {
+ name = "setreplacements",
+ actions = replacements.set,
+ arguments = "string"
+}
+
+implement {
+ name = "addreplacements",
+ actions = replacements.add,
+ arguments = { "string", "string", "string" }
+}