diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-05-16 00:15:04 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-05-16 00:15:04 +0200 |
commit | b55577d0998160c0174e250b542016ecd6ca9056 (patch) | |
tree | 27093212d5ca3e6ffe4ae434c3ec094233ed37ba /tex/context/base/attr-eff.lua | |
parent | 624cbb5da392e9403984dd1cf368c0d408b1c2a8 (diff) | |
download | context-b55577d0998160c0174e250b542016ecd6ca9056.tar.gz |
2015-05-15 23:06:00
Diffstat (limited to 'tex/context/base/attr-eff.lua')
-rw-r--r-- | tex/context/base/attr-eff.lua | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/tex/context/base/attr-eff.lua b/tex/context/base/attr-eff.lua index b187b64c7..ff41e12de 100644 --- a/tex/context/base/attr-eff.lua +++ b/tex/context/base/attr-eff.lua @@ -6,7 +6,6 @@ if not modules then modules = { } end modules ['attr-eff'] = { license = "see context related readme files" } -local commands, interfaces = commands, interfaces local attributes, nodes, backends, utilities = attributes, nodes, backends, utilities local tex = tex @@ -18,6 +17,9 @@ local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex local formatters = string.formatters +local interfaces = interfaces +local implement = interfaces.implement + local variables = interfaces.variables local v_normal = variables.normal @@ -91,8 +93,13 @@ local function register(specification) return n end +local enabled = false + local function enable() - tasks.enableaction("shipouts","attributes.effects.handler") + if not enabled then + tasks.enableaction("shipouts","attributes.effects.handler") + enabled = true + end end effects.register = register @@ -100,12 +107,28 @@ effects.enable = enable -- interface -local enabled = false +implement { + name = "seteffect", + actions = function(specification) + if not enabled then + enable() + end + texsetattribute(a_effect,register(specification)) + end, + arguments = { + { + { "alternative", "string" }, + { "stretch", "integer" }, + { "rulethickness", "dimen" } + } + } +} -function commands.triggereffect(specification) - if not enabled then - enable() - enabled = true +implement { + name = "reseteffect", + actions = function() + if enabled then + texsetattribute(a_effect,register()) + end end - texsetattribute(a_effect,register(specification)) -end +} |