diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-07-24 17:15:33 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-07-24 17:15:33 +0200 |
commit | 07ac7b09a67d45e2dc971efc584f7f9ae7207669 (patch) | |
tree | 754f397eb01b467350ac04d61882be0388554a3c /tex/context/base/mkiv/spac-par.lmt | |
parent | e853a2d8be8fc29f524a8a77edf216cb93c80606 (diff) | |
download | context-07ac7b09a67d45e2dc971efc584f7f9ae7207669.tar.gz |
2020-07-24 15:18:00
Diffstat (limited to 'tex/context/base/mkiv/spac-par.lmt')
-rw-r--r-- | tex/context/base/mkiv/spac-par.lmt | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/spac-par.lmt b/tex/context/base/mkiv/spac-par.lmt new file mode 100644 index 000000000..ed5b735ec --- /dev/null +++ b/tex/context/base/mkiv/spac-par.lmt @@ -0,0 +1,70 @@ +if not modules then modules = { } end modules ['spac-par'] = { + version = 1.001, + comment = "companion to spac-par.mkxl", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local context = context +local implement = interfaces.implement + +local collected = utilities.storage.allocate() +local tobesaved = utilities.storage.allocate() + +local jobparwrappers = { + collected = collected, + tobesaved = tobesaved, +} + +job.parwrappers = jobparwrappers + +local function initializer() + tobesaved = jobparwrappers.tobesaved + collected = jobparwrappers.collected +end + +job.register('job.parwrappers.collected', tobesaved, initializer) + +implement { + name = "newparwrapper", + arguments = "string", + actions = function(id) + local t = tobesaved[id] + if t then + t[#t+1] = 0 + else + tobesaved[id] = { 0 } + end + end +} + +implement { + name = "setparwrapper", + arguments = "string", + actions = function(id) + local t = tobesaved[id] + local n = #t + t[n] = t[n] + 1 + end +} + +implement { + name = "getparwrapper", + arguments = "string", + public = true, + actions = function(id) + local t = tobesaved[id] + context(t and t[#t] or 0) + end +} + +implement { + name = "lastparwrapper", + arguments = "string", + public = true, + actions = function(id) + local t = collected and collected[id] + context(t and t[#t] or 0) + end +} |