diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/cldf-int.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/cldf-int.lua | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/cldf-int.lua b/Master/texmf-dist/tex/context/base/mkiv/cldf-int.lua index 2743e49243b..a97eadf35ef 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/cldf-int.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/cldf-int.lua @@ -26,7 +26,7 @@ local trace_define = false trackers.register("context.define", function(v) tr interfaces = interfaces or { } -_clmh_ = utilities.parsers.settings_to_array +_clmh_ = utilities.parsers.settings_to_hash _clma_ = utilities.parsers.settings_to_array local starters, stoppers, macros, stack = { }, { }, { }, { } @@ -66,6 +66,8 @@ _clmn_ = tonumber local estart = interfaces.elements.start local estop = interfaces.elements.stop +-- this is a bit old definition ... needs to be modernized + function interfaces.definecommand(name,specification) -- name is optional if type(name) == "table" then specification = name @@ -172,51 +174,51 @@ function interfaces.tolist(t) return concat(r,", ") end ---~ \startluacode ---~ function test(opt_1, opt_2, arg_1) ---~ context.startnarrower() ---~ context("options 1: %s",interfaces.tolist(opt_1)) ---~ context.par() ---~ context("options 2: %s",interfaces.tolist(opt_2)) ---~ context.par() ---~ context("argument 1: %s",arg_1) ---~ context.stopnarrower() ---~ end - ---~ interfaces.definecommand { ---~ name = "test", ---~ arguments = { ---~ { "option", "list" }, ---~ { "option", "hash" }, ---~ { "content", "string" }, ---~ }, ---~ macro = test, ---~ } ---~ \stopluacode - ---~ test: \test[1][a=3]{whatever} - ---~ \startluacode ---~ local function startmore(opt_1) ---~ context.startnarrower() ---~ context("start more, options: %s",interfaces.tolist(opt_1)) ---~ context.startnarrower() ---~ end - ---~ local function stopmore(opt_1) ---~ context.stopnarrower() ---~ context("stop more, options: %s",interfaces.tolist(opt_1)) ---~ context.stopnarrower() ---~ end - ---~ interfaces.definecommand ( "more", { ---~ environment = true, ---~ arguments = { ---~ { "option", "list" }, ---~ }, ---~ starter = startmore, ---~ stopper = stopmore, ---~ } ) ---~ \stopluacode - ---~ more: \startmore[1] one \startmore[2] two \stopmore one \stopmore +-- \startluacode +-- function test(opt_1, opt_2, arg_1) +-- context.startnarrower() +-- context("options 1: %s",interfaces.tolist(opt_1)) +-- context.par() +-- context("options 2: %s",interfaces.tolist(opt_2)) +-- context.par() +-- context("argument 1: %s",arg_1) +-- context.stopnarrower() +-- end +-- +-- interfaces.definecommand { +-- name = "test", +-- arguments = { +-- { "option", "list" }, +-- { "option", "hash" }, +-- { "content", "string" }, +-- }, +-- macro = test, +-- } +-- \stopluacode +-- +-- test: \test[1][a=3]{whatever} +-- +-- \startluacode +-- local function startmore(opt_1) +-- context.startnarrower() +-- context("start more, options: %s",interfaces.tolist(opt_1)) +-- context.startnarrower() +-- end +-- +-- local function stopmore(opt_1) +-- context.stopnarrower() +-- context("stop more, options: %s",interfaces.tolist(opt_1)) +-- context.stopnarrower() +-- end +-- +-- interfaces.definecommand ( "more", { +-- environment = true, +-- arguments = { +-- { "option", "list" }, +-- }, +-- starter = startmore, +-- stopper = stopmore, +-- } ) +-- \stopluacode +-- +-- more: \startmore[1] one \startmore[2] two \stopmore one \stopmore |