diff options
Diffstat (limited to 'tex/context/base/mkxl/mlib-scn.lmt')
-rw-r--r-- | tex/context/base/mkxl/mlib-scn.lmt | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tex/context/base/mkxl/mlib-scn.lmt b/tex/context/base/mkxl/mlib-scn.lmt index 0ed211dd3..ed56e113d 100644 --- a/tex/context/base/mkxl/mlib-scn.lmt +++ b/tex/context/base/mkxl/mlib-scn.lmt @@ -28,7 +28,7 @@ if not modules then modules = { } end modules ['mlib-scn'] = { local type, next, rawget, getmetatable, tonumber = type, next, rawget, getmetatable, tonumber local byte, gmatch = string.byte, string.gmatch -local insert, remove = table.insert, table.remove +local insert, remove, combine = table.insert, table.remove, table.combine local mplib = mplib local metapost = metapost @@ -291,6 +291,27 @@ local function getparameters() namespaces[namespace] = parameters end +local function mergeparameters() + local namespace = scanstring() + local parameters = get_parameters() + local target = namespaces[namespace] + if target then + combine(target,parameters) + else + -- same as below + local presets = presets[namespace] + local passed = passed[namespace] + if passed then + if presets then + setmetatableindex(passed,presets) + end + setmetatableindex(parameters,passed) + elseif presets then + setmetatableindex(parameters,presets) + end + end +end + local function applyparameters() local saved = namespaces local namespace = scanstring() @@ -755,6 +776,7 @@ local registertokens = metapost.registertokens registerdirect("getparameters", getparameters) -- nothing registertokens("applyparameters", applyparameters) -- action : todo "token" +registerdirect("mergeparameters", mergeparameters) -- nothing registerdirect("presetparameters", presetparameters) -- nothing registerdirect("hasparameter", hasparameter) -- boolean registerdirect("hasoption", hasoption) -- boolean |