summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2016-11-01 11:41:49 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-11-01 11:41:49 +0100
commit5a501d72ddc9ab9003746aa46fad3a12046e20ec (patch)
tree961dfe1070db46aa798ec0dc553f19b60f8355c6 /tex/context/base
parentf0bc9c17c5298a3a4645f28a39273f52c27c646a (diff)
downloadcontext-5a501d72ddc9ab9003746aa46fad3a12046e20ec.tar.gz
2016-11-01 10:15:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cldf-ini.lua44
-rw-r--r--tex/context/base/mkiv/cont-fil.mkiv43
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/l-string.lua12
-rw-r--r--tex/context/base/mkiv/l-table.lua11
-rw-r--r--tex/context/base/mkiv/lang-def.mkiv8
-rw-r--r--tex/context/base/mkiv/page-flw.mkiv39
-rw-r--r--tex/context/base/mkiv/publ-dat.lua31
-rw-r--r--tex/context/base/mkiv/publ-tra.lua21
-rw-r--r--tex/context/base/mkiv/scrn-bar.mkvi34
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25670 -> 25644 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin368426 -> 368441 bytes
-rw-r--r--tex/context/base/mkiv/strc-def.mkiv2
-rw-r--r--tex/context/base/mkiv/strc-pag.mkiv2
-rw-r--r--tex/context/base/mkiv/strc-ren.mkiv49
-rw-r--r--tex/context/base/mkiv/strc-sec.mkiv10
-rw-r--r--tex/context/base/mkiv/syst-aux.mkiv7
-rw-r--r--tex/context/base/mkiv/typo-mar.mkiv42
-rw-r--r--tex/context/base/mkiv/util-jsn.lua21
-rw-r--r--tex/context/base/mkiv/util-tab.lua10
23 files changed, 266 insertions, 128 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index ccbf33ef8..3e4ba8a57 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.10.25 09:57}
+\newcontextversion{2016.11.01 10:08}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index a8c8bd00b..47fce6bfe 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.10.25 09:57}
+\edef\contextversion{2016.11.01 10:08}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua
index 3d8671149..66582ae4f 100644
--- a/tex/context/base/mkiv/cldf-ini.lua
+++ b/tex/context/base/mkiv/cldf-ini.lua
@@ -1317,18 +1317,34 @@ do
-- formatted.command([catcodes,]format[,...])
+-- local function formattedflush(parent,c,catcodes,fmt,...)
+-- if type(catcodes) == "number" then
+-- if fmt then
+-- local result
+-- pushcatcodes(catcodes)
+-- result = writer(parent,c,formatters[fmt](...))
+-- popcatcodes()
+-- return result
+-- else
+-- -- no need to change content catcodes
+-- return writer(parent,c)
+-- end
+-- else
+-- return writer(parent,c,formatters[catcodes](fmt,...))
+-- end
+-- end
+
local function formattedflush(parent,c,catcodes,fmt,...)
- if type(catcodes) == "number" then
- if fmt then
- local result
- pushcatcodes(catcodes)
- result = writer(parent,c,formatters[fmt](...))
- popcatcodes()
- return result
- else
- -- no need to change content catcodes
- return writer(parent,c)
- end
+ if not catcodes then
+ return writer(parent,c)
+ elseif not fmt then
+ return writer(parent,c,catcodes)
+ elseif type(catcodes) == "number" then
+ local result
+ pushcatcodes(catcodes)
+ result = writer(parent,c,formatters[fmt](...))
+ popcatcodes()
+ return result
else
return writer(parent,c,formatters[catcodes](fmt,...))
end
@@ -1356,10 +1372,10 @@ do
local function caller(parent,catcodes,fmt,...)
if not catcodes then
-- nothing
+ elseif not fmt then
+ flush(catcodes)
elseif type(catcodes) == "number" then
- if fmt then
- flush(catcodes,formatters[fmt](...))
- end
+ flush(catcodes,formatters[fmt](...))
else
flush(formatters[catcodes](fmt,...))
end
diff --git a/tex/context/base/mkiv/cont-fil.mkiv b/tex/context/base/mkiv/cont-fil.mkiv
index 4e5075b6b..e4a63a30e 100644
--- a/tex/context/base/mkiv/cont-fil.mkiv
+++ b/tex/context/base/mkiv/cont-fil.mkiv
@@ -12,7 +12,7 @@
%C details.
% todo: use full names and remove calls at the tex end (now integrated in
-% lua library code
+% lua library code .. then we can load it at runtime when needed.
\writestatus{loading}{ConTeXt File Synonyms}
@@ -45,21 +45,28 @@
\definefilesynonym [res-log] [res-09]
\definefilesynonym [res-identify] [res-12]
-\definefilesynonym [med-show] [res-50]
+ \definefilesynonym [med-show] [res-50]
\definefilesynonym [pre-general] [pre-00]
-
-\definefilesynonym [pre-original] [pre-01]
-\definefilesynonym [pre-green] [pre-02]
-\definefilesynonym [pre-funny] [pre-03]
-\definefilesynonym [pre-colorful] [pre-04]
-\definefilesynonym [pre-fuzzy] [pre-05]
+\definefilesynonym [pre-01] [present-original]
+\definefilesynonym [pre-original] [present-original]
+\definefilesynonym [pre-02] [present-green]
+\definefilesynonym [pre-green] [present-green]
+\definefilesynonym [pre-03] [present-funny]
+\definefilesynonym [pre-funny] [present-funny]
+\definefilesynonym [pre-04] [present-colorful]
+\definefilesynonym [pre-colorful] [present-colorful]
+\definefilesynonym [pre-05] [present-fuzzy]
+\definefilesynonym [pre-fuzzy] [present-fuzzy]
\definefilesynonym [pre-polish] [pre-06]
\definefilesynonym [pre-spider] [pre-07]
\definefilesynonym [pre-wonder] [pre-08]
-\definefilesynonym [pre-windows] [pre-09]
-\definefilesynonym [pre-grow] [pre-10]
-\definefilesynonym [pre-stack] [pre-11]
+\definefilesynonym [pre-09] [present-windows]
+\definefilesynonym [pre-windows] [present-windows]
+\definefilesynonym [pre-10] [present-grow]
+\definefilesynonym [pre-grow] [present-grow]
+\definefilesynonym [pre-11] [present-stack]
+\definefilesynonym [pre-stack] [present-stack]
\definefilesynonym [pre-arrows] [pre-12]
\definefilesynonym [pre-writing] [pre-13]
\definefilesynonym [pre-split] [pre-14]
@@ -72,7 +79,6 @@
\definefilesynonym [pre-zoom] [pre-21]
\definefilesynonym [pre-cycle] [pre-22]
\definefilesynonym [pre-super] [pre-23]
-
%definefilesynonym [pre-more] [pre-24]
%definefilesynonym [pre-more] [pre-25]
\definefilesynonym [pre-more] [pre-26]
@@ -80,20 +86,17 @@
%definefilesynonym [pre-more] [pre-28]
%definefilesynonym [pre-more] [pre-29]
%definefilesynonym [pre-more] [pre-30]
-
\definefilesynonym [pre-41] [present-tiles]
-\definefilesynonym [pre-62] [present-overlap]
-
\definefilesynonym [pre-60] [present-stepwise]
+\definefilesynonym [pre-stepwise] [present-stepwise]
\definefilesynonym [pre-61] [present-stepper]
+\definefilesynonym [pre-stepper] [present-stepper]
+\definefilesynonym [pre-62] [present-overlap]
\definefilesynonym [pre-69] [present-wobbling]
+\definefilesynonym [pre-punk] [present-punk]
\definefilesynonym [pre-70] [present-punk]
-\definefilesynonym [pre-71] [present-random]
-
-\definefilesynonym [pre-stepwise] [present-stepwise]
-\definefilesynonym [pre-stepper] [present-stepper]
\definefilesynonym [pre-random] [present-random]
-\definefilesynonym [pre-punk] [present-punk]
+\definefilesynonym [pre-71] [present-random]
\definefilesynonym [abr-pseudocaps] [abr-01]
\definefilesynonym [abr-smallcaps] [abr-02]
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index e78789676..f1b595bd9 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.10.25 09:57}
+\newcontextversion{2016.11.01 10:08}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 8f31103a2..d27ac04e8 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.10.25 09:57}
+\edef\contextversion{2016.11.01 10:08}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/l-string.lua b/tex/context/base/mkiv/l-string.lua
index 88297f2e6..be8f397ae 100644
--- a/tex/context/base/mkiv/l-string.lua
+++ b/tex/context/base/mkiv/l-string.lua
@@ -75,19 +75,19 @@ local collapser = patterns.collapser
local longtostring = patterns.longtostring
function string.strip(str)
- return lpegmatch(stripper,str) or ""
+ return str and lpegmatch(stripper,str) or ""
end
function string.fullstrip(str)
- return lpegmatch(fullstripper,str) or ""
+ return str and lpegmatch(fullstripper,str) or ""
end
function string.collapsespaces(str)
- return lpegmatch(collapser,str) or ""
+ return str and lpegmatch(collapser,str) or ""
end
function string.longtostring(str)
- return lpegmatch(longtostring,str) or ""
+ return str and lpegmatch(longtostring,str) or ""
end
-- function string.is_empty(str)
@@ -99,7 +99,7 @@ local pattern = P(" ")^0 * P(-1) -- maybe also newlines
-- patterns.onlyspaces = pattern
function string.is_empty(str)
- if str == "" then
+ if not str or str == "" then
return true
else
return lpegmatch(pattern,str) and true or false
@@ -163,7 +163,7 @@ function string.escapedpattern(str,simple)
end
function string.topattern(str,lowercase,strict)
- if str=="" or type(str) ~= "string" then
+ if str == "" or type(str) ~= "string" then
return ".*"
elseif strict then
str = lpegmatch(pattern_c,str)
diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua
index 498f51833..1cf63db0c 100644
--- a/tex/context/base/mkiv/l-table.lua
+++ b/tex/context/base/mkiv/l-table.lua
@@ -1077,7 +1077,7 @@ function table.count(t)
return n
end
-function table.swapped(t,s) -- hash
+function table.swapped(t,s) -- hash, we need to make sure we don't mess up next
local n = { }
if s then
for k, v in next, s do
@@ -1090,7 +1090,14 @@ function table.swapped(t,s) -- hash
return n
end
-function table.mirrored(t) -- hash
+function table.hashed(t) -- list, add hash to index (save because we are not yet mixed
+ for i=1,#t do
+ t[t[i]] = i
+ end
+ return t
+end
+
+function table.mirrored(t) -- hash, we need to make sure we don't mess up next
local n = { }
for k, v in next, t do
n[v] = k
diff --git a/tex/context/base/mkiv/lang-def.mkiv b/tex/context/base/mkiv/lang-def.mkiv
index 0cda6547c..ef53c13e3 100644
--- a/tex/context/base/mkiv/lang-def.mkiv
+++ b/tex/context/base/mkiv/lang-def.mkiv
@@ -525,10 +525,10 @@
\c!rightsentence=\emdash,
\c!leftsubsentence=\emdash,
\c!rightsubsentence=\emdash,
- \c!leftquote=\greekleftquot,
- \c!rightquote=\greekrightquot,
- \c!leftquotation=\greekleftquot,
- \c!rightquotation=\greekrightquot,
+ \c!leftquote=“,
+ \c!rightquote=”,
+ \c!leftquotation=«,
+ \c!rightquotation=»,
\c!date={\v!day\space\v!month\space\v!year},
\s!patterns=\s!agr] % ok?
diff --git a/tex/context/base/mkiv/page-flw.mkiv b/tex/context/base/mkiv/page-flw.mkiv
index afedc3ee2..688791fe5 100644
--- a/tex/context/base/mkiv/page-flw.mkiv
+++ b/tex/context/base/mkiv/page-flw.mkiv
@@ -141,3 +141,42 @@
\endgroup}
\protect \endinput
+
+% \setuppapersize [A6]
+% \setupbodyfont [pagella, 12pt]
+%
+% \definetextflow [even] [width=\textwidth]
+% \definetextflow [odd] [width=\textwidth]
+%
+% \starttextflow [even] \dorecurse{15}{\input bryson} \stoptextflow
+% \starttextflow [odd] \dorecurse {5}{\input knuth } \stoptextflow
+%
+% \starttext
+%
+% \doloop {
+% \ifodd\realpageno
+% \doiftextflowelse{odd} {
+% \bgroup
+% \vsize\dimexpr\textheight-\strutdp\relax
+% \flushtextflow{odd}
+% \egroup
+% } {
+% \null
+% }
+% \page
+% \else
+% \doiftextflowelse{even} {
+% \bgroup
+% \vsize\dimexpr\textheight-\strutdp\relax
+% \flushtextflow{even}
+% \egroup
+% } {
+% \null
+% }
+% \page
+% \fi
+% \doiftextflowelse{even}\donothing{\doiftextflowelse{odd}\donothing\exitloop}
+% }
+%
+% \stoptext
+
diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua
index 98bff25e6..5fc1031cd 100644
--- a/tex/context/base/mkiv/publ-dat.lua
+++ b/tex/context/base/mkiv/publ-dat.lua
@@ -578,8 +578,18 @@ do
local p_left = (p_whitespace^0 * left) / ""
local p_right = (right * p_whitespace^0) / ""
+ local keyword = C((R("az","AZ","09") + S("@_:-"))^1)
+ local key = C((1-space-equal)^1)
+ local tag = C((1-space-comma)^0)
+ local category = C((1-space-left)^1)
+ local s_quoted = ((escape*single) + collapsed + (1-single))^0
+ local d_quoted = ((escape*double) + collapsed + (1-double))^0
+
+ local reference = P("@{") * C((R("az","AZ","09") + S("_:-"))^1) * P("}")
+ local r_value = reference * Carg(1) / resolve
+
local balanced = P {
- [1] = ((escape * (left+right)) + (collapsed + 1 - (left+right))^1 + V(2))^0,
+ [1] = ((escape * (left+right)) + (collapsed + r_value + 1 - (left+right))^1 + V(2))^0,
[2] = left * V(1) * right,
}
@@ -590,26 +600,22 @@ do
local unbalanced = (left/"") * balanced * (right/"") * P(-1)
- local keyword = C((R("az","AZ","09") + S("@_:-"))^1)
- local key = C((1-space-equal)^1)
- local tag = C((1-space-comma)^0)
- local reference = keyword
- local category = C((1-space-left)^1)
- local s_quoted = ((escape*single) + collapsed + (1-single))^0
- local d_quoted = ((escape*double) + collapsed + (1-double))^0
-
+ local reference = P("@") * C((R("az","AZ","09") + S("_:-"))^1)
local b_value = p_left * balanced * p_right
-- local u_value = p_left * unbalanced * p_right -- get rid of outer { }
-- local s_value = (single/"") * (u_value + s_quoted) * (single/"")
-- local d_value = (double/"") * (u_value + d_quoted) * (double/"")
local s_value = (single/"") * (unbalanced + s_quoted) * (single/"")
local d_value = (double/"") * (unbalanced + d_quoted) * (double/"")
- local r_value = reference * Carg(1) /resolve
+ local r_value = reference * Carg(1) / resolve
local somevalue = d_value + b_value + s_value + r_value
local value = Cs((somevalue * ((spacing * hash * spacing)/"" * somevalue)^0))
- value = value / function(s) return lpegmatch(lpegpatterns.stripper,s) end
+ local stripper = lpegpatterns.stripper
+ value = value / function(s)
+ return lpegmatch(stripper,s)
+ end
local forget = percent^1 * (1-lineending)^0
local spacing = spacing * forget^0 * spacing
@@ -632,6 +638,9 @@ do
-- converttoxml -> dataset.xmldata from dataset.luadata
+ -- author = "al-" # @AHSAI # "," # @SHAYKH # " " # @AHMAD # " Ibn " # @ZAYNIDDIN
+ -- author = {al-@{AHSAI}, @{SHAYKH} @{AHMAD} Ibn @{ZAYNIDDIN}}
+
function publications.loadbibdata(dataset,content,source,kind)
if not source then
report("invalid source for dataset %a",dataset)
diff --git a/tex/context/base/mkiv/publ-tra.lua b/tex/context/base/mkiv/publ-tra.lua
index 12bf7bf63..b3d40be61 100644
--- a/tex/context/base/mkiv/publ-tra.lua
+++ b/tex/context/base/mkiv/publ-tra.lua
@@ -141,8 +141,8 @@ function tracers.showdatasetcompleteness(settings)
ctx_NC()
if indirect then
context("\\darkblue")
- ctx_verbatim(value)
- elseif value then
+ end
+ if value then
ctx_verbatim(value)
end
ctx_NC() ctx_NR()
@@ -153,7 +153,7 @@ function tracers.showdatasetcompleteness(settings)
local function special(done,key,value)
ctx_NC() if not done then ctx_monobold("special") end
ctx_NC() context(key)
- ctx_NC() ctx_verbatim(value)
+ ctx_NC() if value then ctx_verbatim(value) end
ctx_NC() ctx_NR()
return done or true
end
@@ -161,7 +161,7 @@ function tracers.showdatasetcompleteness(settings)
local function extra(done,key,value)
ctx_NC() if not done then ctx_monobold("extra") end
ctx_NC() context(key)
- ctx_NC() ctx_verbatim(value)
+ ctx_NC() if value then ctx_verbatim(value) end
ctx_NC() ctx_NR()
return done or true
end
@@ -348,7 +348,9 @@ function tracers.showdatasetauthors(settings)
ctx_verbatim(i)
end
ctx_NC()
- ctx_verbatim(k)
+ if k then
+ ctx_verbatim(k)
+ end
ctx_EQ()
if type(v) == "table" then
local t = { }
@@ -360,8 +362,9 @@ function tracers.showdatasetauthors(settings)
t[i] = vi
end
end
- ctx_verbatim(concat(t, " | "))
- else
+ v = concat(t, " | ")
+ end
+ if v then
ctx_verbatim(v)
end
ctx_NC()
@@ -376,9 +379,9 @@ function tracers.showdatasetauthors(settings)
end
local function commonrow(key,value)
- ctx_NC() ctx_rlap(function() ctx_verbatim(key) end)
+ ctx_NC() if key then ctx_rlap(function() ctx_verbatim(key) end) end
ctx_NC()
- ctx_EQ() ctx_verbatim(value)
+ ctx_EQ() if value then ctx_verbatim(value) end
ctx_NC() ctx_NR()
end
diff --git a/tex/context/base/mkiv/scrn-bar.mkvi b/tex/context/base/mkiv/scrn-bar.mkvi
index 2f21b0004..efb1a005b 100644
--- a/tex/context/base/mkiv/scrn-bar.mkvi
+++ b/tex/context/base/mkiv/scrn-bar.mkvi
@@ -125,9 +125,10 @@
\def\scrn_bar_buttons_indeed[#settings][#list]%
{\begingroup
- %\let\menuparameter\interactionbarparameter
+ %\let\currentinteractionbar\empty
\setupcurrentinteractionbar[#settings]%
- \d_scrn_bar_width\interactionbarparameter\c!width
+ \d_scrn_bar_width \interactionbarparameter\c!width\relax
+ \d_scrn_bar_distance\interactionbarparameter\c!distance\relax
\ifdim\d_scrn_bar_width=\zeropoint
\d_scrn_bar_width1.5\emwidth
\fi
@@ -157,6 +158,10 @@
\hbox to \scratchdimentwo
{\setnostrut
\startsymbolset[\interactionparameter\c!symbolset]%
+ \setupbuttons
+ [#settings,%
+ \c!height=\the\scratchheight,%
+ \c!width=\the\scratchdimenone]%
\processallactionsinset
[#list]
[ \v!page=>\scrn_bar_goto\v!firstpage
@@ -173,11 +178,7 @@
\endgroup}
\def\scrn_bar_goto#action%
- {\button
- [\c!height=\the\scratchheight,\c!width=\the\scratchdimenone]%
- {\symbol[#action]}% we could expand this one once only
- [#action]%
- \hss}
+ {\button{\symbol[#action]}[#action]\hss}
% todo: this will be \letblackruleparameter\c!width\scratchdimenone (faster)
@@ -346,31 +347,34 @@
\advance\scratchcounterfive \plusone
\ifnum\recurselevel=\firstsubpage\relax \!!doneatrue \fi
\ifnum\recurselevel=\lastsubpage \relax \!!doneatrue \fi
+ \scratchcountersix\therealsubpageno\recurselevel\relax
\c_scrn_bar_mode
\if!!donea
- \ifnum\recurselevel<\realpageno
+ \ifnum\scratchcountersix<\realpageno
\zerocount
- \else\ifnum\recurselevel>\realpageno
+ \else\ifnum\scratchcountersix>\realpageno
\plustwo
\else
\plusfour
\fi\fi
\else
\ifnum\scratchcounterfive=\scratchcountertwo
- \ifnum\recurselevel<\realpageno
+ \ifnum\scratchcountersix<\realpageno
\plusone
- \else\ifnum\recurselevel>\realpageno
+ \else\ifnum\scratchcountersix>\realpageno
\plusthree
\else
\plustwo
\fi\fi
\else
- \plusthree
+ \minusone
\fi
\fi
- \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\scrn_bar_goto_indeed\c_scrn_bar_mode}[page(\therealsubpageno\recurselevel)]}%
- \hss
- \scratchcounterfive\zerocount}%
+ \ifnum\c_scrn_bar_mode<\zerocount\else
+ \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\scrn_bar_goto_indeed\c_scrn_bar_mode}[realpage(\the\scratchcountersix)]}%
+ \hss
+ \scratchcounterfive\zerocount
+ \fi}%
\unskip
\egroup
}\fi}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 3e2ac5f8c..5f58a77d6 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index f98279189..c09d22644 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-def.mkiv b/tex/context/base/mkiv/strc-def.mkiv
index 962c46b48..b2e86c140 100644
--- a/tex/context/base/mkiv/strc-def.mkiv
+++ b/tex/context/base/mkiv/strc-def.mkiv
@@ -193,6 +193,7 @@
\c!header=,
\c!style=\tfc,
\c!distance=.75\emwidth,
+ \c!textdistance=\emwidth plus \emwidth minus .25\emwidth,
\c!before={\blank[2*\v!big]},
\c!after={\blank[2*\v!big]}]
@@ -202,6 +203,7 @@
%\c!indentnext=\v!no,
\c!style=\tfa,
\c!distance=.75\emwidth,
+ \c!textdistance=\emwidth plus \emwidth minus .25\emwidth,
\c!before={\blank[2*\v!big]},
\c!after=\blank]
diff --git a/tex/context/base/mkiv/strc-pag.mkiv b/tex/context/base/mkiv/strc-pag.mkiv
index cf2533c46..21758d671 100644
--- a/tex/context/base/mkiv/strc-pag.mkiv
+++ b/tex/context/base/mkiv/strc-pag.mkiv
@@ -23,7 +23,7 @@
\countdef\realpageno \zerocount \realpageno \plusone
\countdef\userpageno \plusone \userpageno \plusone
-\countdef\subpageno \plustwo \subpageno \zerocount % !
+\countdef\subpageno \plustwo \subpageno \plusone % was \zerocount but that doesn't work well with bytext
\countdef\arrangeno \plusthree \arrangeno \zerocount % !
\countdef\pagenoshift\plusfour \pagenoshift\zerocount % !
\countdef\lastpageno \plusfive \lastpageno \zerocount % !
diff --git a/tex/context/base/mkiv/strc-ren.mkiv b/tex/context/base/mkiv/strc-ren.mkiv
index 6bdd05de9..507cb9921 100644
--- a/tex/context/base/mkiv/strc-ren.mkiv
+++ b/tex/context/base/mkiv/strc-ren.mkiv
@@ -167,18 +167,6 @@
% helpers
-% \defineinmargin [ChapterInMargin] [outer] [normal] [distance=0.3em]
-%
-% \defineheadplacement[MyTest][horizontal]#1#2%
-% {\startlocalheadsetup
-% %\ChapterInMargin{\headhbox{\strut#2}}% proper destination, ref okay
-% \ChapterInMargin{\strut#2}% zero destination, ref okay
-% \stoplocalheadsetup}
-%
-% \setuphead
-% [chapter]
-% [alternative=MyTest]
-
\unexpanded\def\headhbox{\hbox\headreferenceattributes}
\unexpanded\def\headvbox{\vbox\headreferenceattributes}
@@ -354,12 +342,19 @@
\fi
\getheadsyncs
\else
+ % somehow this goes ok even when we push in the margin probably because we gobble pars
+ % in the process of collecting index entries etc
\strut
\flushnotes % new, here since we're in par mode
\unhbox\b_strc_rendering_head
\getheadsyncs
- \hskip\headnumberdistance\s!plus\headnumberdistance\s!minus.25\dimexpr\headnumberdistance\relax
- \strc_sectioning_inject_continuous_signal
+ \ifconditional\headissomewhere
+ % nothing special
+ \else
+ %\hskip\headnumberdistance\s!plus\headnumberdistance\s!minus.25\dimexpr\headnumberdistance\relax
+ \hskip\headtextdistance\relax
+ \strc_sectioning_inject_continuous_signal
+ \fi
\fi
\ifconditional\headisdisplay
\ifvmode
@@ -453,6 +448,7 @@
\newdimen\headwidth
\newdimen\headtextwidth
+\newskip \headtextdistance
\newdimen\headnumberdistance
\newdimen\headnumberwidth
@@ -470,16 +466,22 @@
\let\currentheadrenderingalternative\v!vertical
\fi
\ifx\currentheadrenderingalternative\v!horizontal
- \global\setfalse\headisdisplay % global
+ \global\setfalse\headisdisplay % global
+ \global\setfalse\headissomewhere % global
+ \else\ifx\currentheadrenderingalternative\v!somewhere
+ \global\setfalse\headisdisplay % global
+ \global\settrue \headissomewhere % global
\else
- \global\settrue\headisdisplay % global
- \fi}
+ \global\settrue \headisdisplay % global
+ \global\setfalse\headissomewhere % global
+ \fi\fi}
\unexpanded\def\strc_rendering_initialize_dimensions
- {\headwidth \headparameter\c!width \relax % \zeropoint == unset
- \headnumberwidth \headparameter\c!numberwidth\relax % \zeropoint == unset
- \headnumberdistance\headparameter\c!distance \relax
- \headtextwidth \headparameter\c!textwidth \relax} % \zeropoint == unset
+ {\headwidth \headparameter\c!width \relax % \zeropoint == unset
+ \headnumberwidth \headparameter\c!numberwidth \relax % \zeropoint == unset
+ \headnumberdistance\headparameter\c!distance \relax
+ \headtextdistance \headparameter\c!textdistance\relax
+ \headtextwidth \headparameter\c!textwidth \relax} % \zeropoint == unset
\unexpanded\def\headtextcontent
{\begingroup
@@ -786,4 +788,9 @@
\fi
\stopsetups
+% see typo-mar.mkiv:
+%
+% \defineheadalternative
+% [\v!margintext]
+
\protect \endinput
diff --git a/tex/context/base/mkiv/strc-sec.mkiv b/tex/context/base/mkiv/strc-sec.mkiv
index 657e6c866..51b464eb9 100644
--- a/tex/context/base/mkiv/strc-sec.mkiv
+++ b/tex/context/base/mkiv/strc-sec.mkiv
@@ -345,6 +345,7 @@
%\c!deeptextcommand=,
%\c!default=,
\c!distance=\zeropoint,
+ \c!textdistance=\zeropoint,
\c!textwidth=\zeropoint, % signal too
\c!numberwidth=\zeropoint, % signal too
\c!width=\zeropoint, % signal too
@@ -660,8 +661,9 @@
\newconditional\c_strc_sectioning_empty
\newconditional\c_strc_sectioning_hidden
-\newconditional\headshownumber % public
-\newconditional\headisdisplay % public
+\newconditional\headshownumber % public
+\newconditional\headisdisplay % public
+\newconditional\headissomewhere % public
\setvalue{\??headincrement\v!yes }{\settrue \c_strc_sectioning_increment\settrue \c_strc_sectioning_to_list}
\setvalue{\??headincrement\v!no }{\setfalse\c_strc_sectioning_increment\setfalse\c_strc_sectioning_to_list}
@@ -796,7 +798,7 @@
{\dontleavehmode
\begingroup
\unexpanded\def\\{\space}% messy here, but the default (and needs to be grouped)
- \settrue\headisdisplay % triggers interlinespace checking
+ \global\settrue\headisdisplay % triggers interlinespace checking
\edef\currenthead{#1}%
\strc_rendering_initialize_style_and_color\c!textstyle\c!textcolor
\relax
@@ -807,7 +809,7 @@
\def\strc_sectioning_place_head_number[#1]%
{\dontleavehmode
\begingroup
- \settrue\headisdisplay % triggers interlinespace checking
+ \global\settrue\headisdisplay % triggers interlinespace checking
\edef\currenthead{#1}%
\strc_rendering_initialize_style_and_color\c!numberstyle\c!numbercolor
\relax
diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv
index 96a377595..e81f61807 100644
--- a/tex/context/base/mkiv/syst-aux.mkiv
+++ b/tex/context/base/mkiv/syst-aux.mkiv
@@ -3845,15 +3845,16 @@
\global\expandafter\def\csname\??recurseaction\recursedepth\endcsname##1##2{#4}%
\global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel
\csname\??recursestepwise
+ % we need the x in order to avoid the \relax that tex adds
\ifnum#3>\zerocount
- \ifnum#2<#1\else d\fi
+ \ifnum#2<#1x\else d\fi
\else\ifnum#3<\zerocount
- \ifnum#1<#2\else r\fi
+ \ifnum#1<#2x\else r\fi
\fi\fi
\expandafter\endcsname\normalexpanded{{\number#1}{\number#2}{\number#3}}}
% \expandafter\endcsname\expandafter{\number#1\expandafter}\expandafter{\number#2\expandafter}\expandafter{\number#3}}
-\letvalue{\??recursestepwise }\syst_helpers_stepwise_exit
+\letvalue{\??recursestepwise x}\syst_helpers_stepwise_exit
\letvalue{\??recursestepwise d}\syst_helpers_stepwise_recurse
\letvalue{\??recursestepwise r}\syst_helpers_stepwise_reverse
diff --git a/tex/context/base/mkiv/typo-mar.mkiv b/tex/context/base/mkiv/typo-mar.mkiv
index 013974086..462cc633e 100644
--- a/tex/context/base/mkiv/typo-mar.mkiv
+++ b/tex/context/base/mkiv/typo-mar.mkiv
@@ -439,4 +439,46 @@
% \let\dostophanchoring \dostopanchoring
% \let\dostopvanchoring \dostopanchoring
+%D Here because in strc-ren we are too early:
+
+% % \definemargindata
+% % [margintext:chapter]
+% % [margintext:section]
+% %
+% % \defineheadalternative
+% % [margintext:chapter]
+% % [margintext]
+% % [margintext=margintext:chapter]
+% %
+% % \setuphead
+% % [chapter]
+% % [alternative=margintext:chapter]
+%
+% \setuphead
+% [chapter]
+% [alternative=margintext]
+
+\definemargindata
+ [\v!margintext:\v!section]
+ [\v!left]
+ [\c!margin=\v!margin,
+ \c!width=\leftmarginwidth,
+ \c!align=\v!flushright]
+
+\defineheadalternative
+ [\v!margintext]
+ [\c!alternative=\v!somewhere,
+ \c!margintext=\v!margintext:\v!section,
+ \c!renderingsetup=\??headrenderings:\v!margintext]
+
+\startsetups[\??headrenderings:\v!margintext]
+ \executeifdefined{\headalternativeparameter\c!margintext}\margintext {
+ \ifconditional\headshownumber
+ \headnumbercontent
+ \hskip\headnumberdistance
+ \fi
+ \headtextcontent
+ }
+\stopsetups
+
\protect \endinput
diff --git a/tex/context/base/mkiv/util-jsn.lua b/tex/context/base/mkiv/util-jsn.lua
index bbe25d89d..e835c07d6 100644
--- a/tex/context/base/mkiv/util-jsn.lua
+++ b/tex/context/base/mkiv/util-jsn.lua
@@ -64,18 +64,19 @@ local jnumber = (1-whitespace-rparent-rbrace-comma)^1 / tonumber
local key = jstring
local jsonconverter = { "value",
- object = lbrace * Cf(Ct("") * V("pair") * (comma * V("pair"))^0,rawset) * rbrace,
- pair = Cg(optionalws * key * optionalws * colon * V("value")),
- array = Ct(lparent * V("value") * (comma * V("value"))^0 * rparent),
- value = optionalws * (jstring + V("object") + V("array") + jtrue + jfalse + jnull + jnumber + #rparent) * optionalws,
+ hash = lbrace * Cf(Ct("") * (V("pair") * (comma * V("pair"))^0 + optionalws),rawset) * rbrace,
+ pair = Cg(optionalws * key * optionalws * colon * V("value")),
+ array = Ct(lparent * (V("value") * (comma * V("value"))^0 + optionalws) * rparent),
+-- value = optionalws * (jstring + V("hash") + V("array") + jtrue + jfalse + jnull + jnumber + #rparent) * optionalws,
+ value = optionalws * (jstring + V("hash") + V("array") + jtrue + jfalse + jnull + jnumber) * optionalws,
}
-- local jsonconverter = { "value",
--- object = lbrace * Cf(Ct("") * V("pair") * (comma * V("pair"))^0,rawset) * rbrace,
--- pair = Cg(optionalws * V("string") * optionalws * colon * V("value")),
--- array = Ct(lparent * V("value") * (comma * V("value"))^0 * rparent),
--- string = jstring,
--- value = optionalws * (V("string") + V("object") + V("array") + jtrue + jfalse + jnull + jnumber) * optionalws,
+-- hash = lbrace * Cf(Ct("") * (V("pair") * (comma * V("pair"))^0 + optionalws),rawset) * rbrace,
+-- pair = Cg(optionalws * V("string") * optionalws * colon * V("value")),
+-- array = Ct(lparent * (V("value") * (comma * V("value"))^0 + optionalws) * rparent),
+-- string = jstring,
+-- value = optionalws * (V("string") + V("hash") + V("array") + jtrue + jfalse + jnull + jnumber) * optionalws,
-- }
-- lpeg.print(jsonconverter) -- size 181
@@ -156,3 +157,5 @@ end
-- inspect(tmp)
-- inspect(json.tostring(true))
+
+return json
diff --git a/tex/context/base/mkiv/util-tab.lua b/tex/context/base/mkiv/util-tab.lua
index 0ebe1b5b1..0521a2a4f 100644
--- a/tex/context/base/mkiv/util-tab.lua
+++ b/tex/context/base/mkiv/util-tab.lua
@@ -486,11 +486,11 @@ end
local selfmapper = { __index = function(t,k) t[k] = k return k end }
-function table.twowaymapper(t)
- if not t then
- t = { }
- else
- local zero = rawget(t,0)
+function table.twowaymapper(t) -- takes a 0/1 .. n indexed table and returns
+ if not t then -- it with string-numbers as indices + reverse
+ t = { } -- mapping (all strings) .. used in cvs etc but
+ else -- typically a helper that one forgets about
+ local zero = rawget(t,0) -- so it might move someplace else
for i=zero and 0 or 1,#t do
local ti = t[i] -- t[1] = "one"
if ti then