summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/trac-ctx.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-08 00:43:40 +0000
committerKarl Berry <karl@freefriends.org>2013-04-08 00:43:40 +0000
commit824f7b0903de8ad7f6ee3d7656005e4c59155e06 (patch)
treeabfc8673ef9916f3ab7074e811207384c301492b /Master/texmf-dist/tex/context/base/trac-ctx.lua
parent689aefb0727676ed3cddf331337b4be226495e72 (diff)
context import for TL13, from www.pragma-ade.com/context/beta/cont-tmf.zip
git-svn-id: svn://tug.org/texlive/trunk@29731 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/trac-ctx.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/trac-ctx.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/trac-ctx.lua b/Master/texmf-dist/tex/context/base/trac-ctx.lua
new file mode 100644
index 00000000000..706e7a2447a
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/trac-ctx.lua
@@ -0,0 +1,48 @@
+if not modules then modules = { } end modules ['trac-ctx'] = {
+ version = 1.001,
+ comment = "companion to trac-ctx.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local commands = commands
+local context = context
+local register = trackers.register
+
+local textrackers = tex.trackers or { }
+local texdirectives = tex.directives or { }
+
+tex.trackers = textrackers
+tex.directives = texdirectives
+
+storage.register("tex/trackers", textrackers, "tex.trackers")
+storage.register("tex/directives",texdirectives,"tex.directives")
+
+local function doit(category,tag,v)
+ local tt = category[tag]
+ if tt then
+ context.unprotect()
+ context(v and tt[1] or tt[2]) -- could be one call
+ context.protect()
+ end
+end
+
+local function initialize(category,register)
+ for tag, commands in next, category do
+ register(tag, function(v) doit(category,tag,v) end) -- todo: v,tag in caller
+ end
+end
+
+local function install(category,register,tag,enable,disable)
+ category[tag] = { enable, disable }
+ register(tag, function(v) doit(category,tag,v) end) -- todo: v,tag in caller
+end
+
+function commands.initializetextrackers () initialize(textrackers ,trackers .register ) end
+function commands.initializetexdirectives() initialize(texdirectives,directives.register) end
+
+-- commands.install(tag,enable,disable):
+
+function commands.installtextracker (...) install(textrackers ,trackers .register,...) end
+function commands.installtexdirective(...) install(texdirectives,directives.register,...) end