summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-ins.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-18 22:52:45 +0000
committerKarl Berry <karl@freefriends.org>2015-04-18 22:52:45 +0000
commit16aa5a7c87f18a2483d0d61795899f886781b51c (patch)
tree1d72f00b2a4185425393598402fe055c61d1de58 /Master/texmf-dist/tex/context/base/page-ins.lua
parente68dc4d5506d46bf72823234f902bc76d1f70352 (diff)
context, from www.pragma-ade.com/context/beta/cont-tmf.zip (18apr15)
git-svn-id: svn://tug.org/texlive/trunk@36923 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-ins.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/page-ins.lua54
1 files changed, 38 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-ins.lua b/Master/texmf-dist/tex/context/base/page-ins.lua
index 7f870735d27..235f586c689 100644
--- a/Master/texmf-dist/tex/context/base/page-ins.lua
+++ b/Master/texmf-dist/tex/context/base/page-ins.lua
@@ -4,19 +4,9 @@ if not modules then modules = { } end modules ['page-ins'] = {
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files",
- -- public = {
- -- functions = {
- -- "inserts.define",
- -- "inserts.getdata",
- -- },
- -- commands = {
- -- "defineinsertion",
- -- "inserttionnumber",
- -- }
- -- }
}
--- Maybe we should only register in lua and forget about the tex end.
+local next = next
structures = structures or { }
structures.inserts = structures.inserts or { }
@@ -36,6 +26,9 @@ local v_firstcolumn = variables.firstcolumn
local v_lastcolumn = variables.lastcolumn
local v_text = variables.text
+local context = context
+local implement = interfaces.implement
+
storage.register("structures/inserts/stored", inserts.stored, "structures.inserts.stored")
local data = inserts.data
@@ -49,7 +42,7 @@ end
function inserts.define(name,specification)
specification.name= name
local number = specification.number or 0
- data[name] = specification
+ data[name] = specification
data[number] = specification
-- only needed at runtime as this get stored in a bytecode register
stored[name] = specification
@@ -90,8 +83,37 @@ end
-- interface
-commands.defineinsertion = inserts.define
-commands.setupinsertion = inserts.setup
-commands.setinsertionlocation = inserts.setlocation
-commands.insertionnumber = function(name) context(data[name].number or 0) end
+implement {
+ name = "defineinsertion",
+ actions = inserts.define,
+ arguments = {
+ "string",
+ {
+ { "number", "integer" }
+ }
+ }
+}
+
+implement {
+ name = "setupinsertion",
+ actions = inserts.setup,
+ arguments = {
+ "string",
+ {
+ { "location" }
+ }
+ }
+}
+
+implement {
+ name = "setinsertionlocation",
+ actions = inserts.setlocation,
+ arguments = { "string", "string" }
+}
+
+implement {
+ name = "insertionnumber",
+ actions = function(name) context(data[name].number or 0) end,
+ arguments = "string"
+}