summaryrefslogtreecommitdiff
path: root/tex/context/base/attr-eff.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/attr-eff.lua')
-rw-r--r--tex/context/base/attr-eff.lua39
1 files changed, 27 insertions, 12 deletions
diff --git a/tex/context/base/attr-eff.lua b/tex/context/base/attr-eff.lua
index 023d1c51b..60e0c08ac 100644
--- a/tex/context/base/attr-eff.lua
+++ b/tex/context/base/attr-eff.lua
@@ -8,7 +8,9 @@ if not modules then modules = { } end modules ['attr-eff'] = {
local format = string.format
-local attributes, nodes = attributes, nodes
+local commands, interfaces = commands, interfaces
+local attributes, nodes, backends, utilities = attributes, nodes, backends, utilities
+local tex = tex
local states = attributes.states
local tasks = nodes.tasks
@@ -17,6 +19,9 @@ local settexattribute = tex.setattribute
local allocate = utilities.storage.allocate
local setmetatableindex = table.setmetatableindex
+local variables = interfaces.variables
+local v_normal = variables.normal
+
attributes.effects = attributes.effects or { }
local effects = attributes.effects
@@ -27,14 +32,14 @@ effects.values = effects.values or { }
effects.registered = effects.registered or { }
effects.attribute = a_effect
-storage.register("attributes/effects/registered", effects.registered, "attributes.effects.registered")
-storage.register("attributes/effects/values", effects.values, "attributes.effects.values")
+local data = effects.data
+local registered = effects.registered
+local values = effects.values
-local template = "%s:%s:%s"
+local template = "%s:%s:%s"
-local data = effects.data
-local registered = effects.registered
-local values = effects.values
+storage.register("attributes/effects/registered", registered, "attributes.effects.registered")
+storage.register("attributes/effects/values", values, "attributes.effects.values")
-- valid effects: normal inner outer both hidden (stretch,rulethickness,effect)
@@ -66,12 +71,22 @@ effects.handler = nodes.installattributehandler {
processor = states.process,
}
-local function register(effect,stretch,rulethickness)
- local stamp = format(template,effect,stretch,rulethickness)
+local function register(specification)
+ local alternative, stretch, rulethickness
+ if specification then
+ alternative = specification.alternative or v_normal
+ stretch = specification.stretch or 0
+ rulethickness = specification.rulethickness or 0
+ else
+ alternative = v_normal
+ stretch = 0
+ rulethickness = 0
+ end
+ local stamp = format(template,alternative,stretch,rulethickness)
local n = registered[stamp]
if not n then
n = #values + 1
- values[n] = { effect, stretch, rulethickness }
+ values[n] = { alternative, stretch, rulethickness }
registered[stamp] = n
end
return n
@@ -88,10 +103,10 @@ effects.enable = enable
local enabled = false
-function commands.triggereffect(effect,stretch,rulethickness)
+function commands.triggereffect(specification)
if not enabled then
enable()
enabled = true
end
- settexattribute(a_effect,register(effect,stretch,rulethickness))
+ settexattribute(a_effect,register(specification))
end