summaryrefslogtreecommitdiff
path: root/tex/context/base/page-run.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/page-run.mkiv')
-rw-r--r--tex/context/base/page-run.mkiv26
1 files changed, 21 insertions, 5 deletions
diff --git a/tex/context/base/page-run.mkiv b/tex/context/base/page-run.mkiv
index dabf37252..1f2551ebc 100644
--- a/tex/context/base/page-run.mkiv
+++ b/tex/context/base/page-run.mkiv
@@ -79,13 +79,27 @@ local function todimen(name,unit,fmt)
return number.todimen(tex.dimen[name],unit,fmt)
end
-function commands.showlayoutvariables(options)
-
- if options == "" then
+local function checkedoptions(options)
+ if type(options) == "table" then
+ return options
+ elseif not options or options == "" then
options = "pt,cm"
end
+ options = utilities.parsers.settings_to_hash(options)
+ local n = 4
+ for k, v in table.sortedhash(options) do
+ local m = tonumber(k)
+ if m then
+ n = m
+ end
+ end
+ options.n = n
+ return options
+end
+
+function commands.showlayoutvariables(options)
- local options = utilities.parsers.settings_to_hash(options)
+ options = checkedoptions(options)
local dimensions = { "pt", "bp", "cm", "mm", "dd", "cc", "pc", "nd", "nc", "sp", "in" }
@@ -215,6 +229,8 @@ end
function commands.showlayout(options)
+ options = checkedoptions(options)
+
if tex.count.textlevel == 0 then
commands.showlayoutvariables(options)
@@ -225,7 +241,7 @@ function commands.showlayout(options)
context.bgroup()
context.showframe()
context.setuplayout { marking = interfaces.variables.on }
- for i=1,4 do
+ for i=1,(options.n or 4) do
commands.showlayoutvariables(options)
context.page()
end