diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/attr-eff.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/attr-eff.lua | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/context/base/attr-eff.lua b/Master/texmf-dist/tex/context/base/attr-eff.lua index 023d1c51b53..4dce5419abc 100644 --- a/Master/texmf-dist/tex/context/base/attr-eff.lua +++ b/Master/texmf-dist/tex/context/base/attr-eff.lua @@ -6,9 +6,9 @@ if not modules then modules = { } end modules ['attr-eff'] = { license = "see context related readme files" } -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 @@ -16,6 +16,10 @@ local nodeinjections = backends.nodeinjections local settexattribute = tex.setattribute local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex +local formatters = string.formatters + +local variables = interfaces.variables +local v_normal = variables.normal attributes.effects = attributes.effects or { } local effects = attributes.effects @@ -27,14 +31,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 f_stamp = formatters["%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 +70,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 = f_stamp(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 +102,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 |