summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-07-02 16:09:16 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-07-02 16:09:16 +0200
commit847821faaecf92833f1e1564e1ef9377758d4d45 (patch)
tree7a033668d823e231478c055daeb47c4582883059 /tex/context/base
parent052a096e160508ddbbbfcbf1522eb8ddbfc3b1cd (diff)
downloadcontext-847821faaecf92833f1e1564e1ef9377758d4d45.tar.gz
2018-07-02 14:46: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/back-exp.lua20
-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/font-chk.lua2
-rw-r--r--tex/context/base/mkiv/font-prv.lua2
-rw-r--r--tex/context/base/mkiv/grph-rul.lua54
-rw-r--r--tex/context/base/mkiv/math-ini.mkiv4
-rw-r--r--tex/context/base/mkiv/meta-fnt.lua19
-rw-r--r--tex/context/base/mkiv/meta-imp-mat.mkiv38
-rw-r--r--tex/context/base/mkiv/meta-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/mlib-ctx.lua3
-rw-r--r--tex/context/base/mkiv/mlib-lua.lua64
-rw-r--r--tex/context/base/mkiv/mlib-pdf.lua63
-rw-r--r--tex/context/base/mkiv/mlib-pps.lua153
-rw-r--r--tex/context/base/mkiv/mlib-run.lua179
-rw-r--r--tex/context/base/mkiv/mult-prm.lua3
-rw-r--r--tex/context/base/mkiv/mult-prm.mkiv1
-rw-r--r--tex/context/base/mkiv/node-tra.lua1
-rw-r--r--tex/context/base/mkiv/page-mul.mkiv2
-rw-r--r--tex/context/base/mkiv/publ-aut.lua12
-rw-r--r--tex/context/base/mkiv/publ-dat.lua24
-rw-r--r--tex/context/base/mkiv/publ-ini.lua17
-rw-r--r--tex/context/base/mkiv/publ-ini.mkiv16
-rw-r--r--tex/context/base/mkiv/spac-ali.mkiv78
-rw-r--r--tex/context/base/mkiv/spac-ver.mkiv59
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26062 -> 26009 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin260515 -> 261982 bytes
-rw-r--r--tex/context/base/mkiv/strc-reg.lua62
-rw-r--r--tex/context/base/mkiv/strc-reg.mkiv14
-rw-r--r--tex/context/base/mkiv/strc-sec.mkiv1
-rw-r--r--tex/context/base/mkiv/strc-tag.mkiv3
-rw-r--r--tex/context/base/mkiv/supp-box.mkiv8
-rw-r--r--tex/context/base/mkiv/supp-dir.mkiv21
-rw-r--r--tex/context/base/mkiv/typo-dir.mkiv4
36 files changed, 613 insertions, 324 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 129b5df8c..a04c2385f 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{2018.06.25 12:21}
+\newcontextversion{2018.07.02 14:39}
%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 dce51a9cb..cae8a99d9 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{2018.06.25 12:21}
+\edef\contextversion{2018.07.02 14:39}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 8f6470870..693ec0118 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -554,6 +554,8 @@ do
local fields = { "title", "subtitle", "author", "keywords", "url", "version" }
+ local ignoredelements = false
+
local function checkdocument(root)
local data = root.data
if data then
@@ -580,6 +582,9 @@ do
elseif tg == "ignore" then
di.element = ""
checkdocument(di)
+ elseif ignoredelements and ignoredelements[tg] then
+ di.element = ""
+ checkdocument(di)
else
checkdocument(di) -- new, else no noexport handling
end
@@ -609,6 +614,20 @@ do
checkdocument(di)
end
+ implement {
+ name = "ignoretagsinexport",
+ actions = function(list)
+ for tag in string.gmatch(list,"[a-z]+") do
+ if ignoredelements then
+ ignoredelements[tag] = true
+ else
+ ignoredelements = { [tag] = true }
+ end
+ end
+ end,
+ arguments = "string"
+ }
+
end
do
@@ -3871,7 +3890,6 @@ implement {
actions = structurestags.initializeexport,
}
-
implement {
name = "settagitemgroup",
actions = structurestags.setitemgroup,
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index f9318e0fb..2a3392732 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{2018.06.25 12:21}
+\newcontextversion{2018.07.02 14:39}
%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 7ad7586c8..dc3bc164b 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -42,7 +42,7 @@
%D has to match \type {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.06.25 12:21}
+\edef\contextversion{2018.07.02 14:39}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-chk.lua b/tex/context/base/mkiv/font-chk.lua
index 5bd85fe66..03bbf2ea3 100644
--- a/tex/context/base/mkiv/font-chk.lua
+++ b/tex/context/base/mkiv/font-chk.lua
@@ -143,7 +143,7 @@ local mapping = allocate { -- this is just an experiment to illustrate some prin
table.setmetatableindex(mapping,
function(t,k)
- v = "placeholder unknown gray"
+ local v = "placeholder unknown gray"
t[k] = v
return v
end
diff --git a/tex/context/base/mkiv/font-prv.lua b/tex/context/base/mkiv/font-prv.lua
index fef1f3618..4c4948edc 100644
--- a/tex/context/base/mkiv/font-prv.lua
+++ b/tex/context/base/mkiv/font-prv.lua
@@ -29,7 +29,7 @@ end
-- use these privates for mechanisms like alignments-on-character and such
local sharedprivates = setmetatableindex(function(t,k)
- v = currentprivate
+ local v = currentprivate
if currentprivate < maximumprivate then
currentprivate = currentprivate + 1
else
diff --git a/tex/context/base/mkiv/grph-rul.lua b/tex/context/base/mkiv/grph-rul.lua
index 8daf80779..2cb2729bd 100644
--- a/tex/context/base/mkiv/grph-rul.lua
+++ b/tex/context/base/mkiv/grph-rul.lua
@@ -97,18 +97,18 @@ def RuleColor = %color% enddef ;
ruleactions.mp = function(p,h,v,i,n)
local name = p.name or "fake:rest"
local code = (predefined[name] or predefined["fake:rest"]) {
- data = p.data or "",
- width = p.width * bpfactor,
- height = p.height * bpfactor,
- depth = p.depth * bpfactor,
- factor = (p.factor or 0) * bpfactor, -- needs checking
- offset = p.offset or 0,
- line = (p.line or 65536) * bpfactor,
- color = mpcolor(p.ma,p.ca,p.ta),
- option = p.option or "",
- direction = p.direction or "TLT",
- h = h * bpfactor,
- v = v * bpfactor,
+ data = p.data or "",
+ width = p.width * bpfactor,
+ height = p.height * bpfactor,
+ depth = p.depth * bpfactor,
+ factor = (p.factor or 0) * bpfactor, -- needs checking
+ offset = p.offset or 0,
+ line = (p.line or 65536) * bpfactor,
+ color = mpcolor(p.ma,p.ca,p.ta),
+ option = p.option or "",
+ direction = p.direction or "TLT",
+ h = h * bpfactor,
+ v = v * bpfactor,
}
if not initialized then
initialized = true
@@ -133,14 +133,28 @@ do
local f_rectangle = formatters["%.6F w %.6F %.6F %.6F %.6F re %s"]
local f_baselined = formatters["%.6F w %.6F %.6F %.6F %.6F re s %.6F %.6F m %.6F %.6F l s"]
local f_dashlined = formatters["%.6F w %.6F %.6F %.6F %.6F re s [%.6F %.6F] 2 d %.6F %.6F m %.6F %.6F l s"]
- local f_radtangle = formatters[ [[
- %.6F w %.6F %.6F m
- %.6F %.6F l %.6F %.6F %.6F %.6F y
- %.6F %.6F l %.6F %.6F %.6F %.6F y
- %.6F %.6F l %.6F %.6F %.6F %.6F y
- %.6F %.6F l %.6F %.6F %.6F %.6F y
- h %s
- ]] ]
+ local f_radtangle = formatters[
+ [[%.6F w %.6F %.6F m
+%.6F %.6F l %.6F %.6F %.6F %.6F y
+%.6F %.6F l %.6F %.6F %.6F %.6F y
+%.6F %.6F l %.6F %.6F %.6F %.6F y
+%.6F %.6F l %.6F %.6F %.6F %.6F y
+h %s]]
+ ]
+
+ directives.register("metapost.stripzeros",function() -- confusing name but ok
+ f_rectangle = formatters["%.6N w %.6N %.6N %.6N %.6N re %s"]
+ f_baselined = formatters["%.6N w %.6N %.6N %.6N %.6N re s %.6N %.6N m %.6N %.6N l s"]
+ f_dashlined = formatters["%.6N w %.6N %.6N %.6N %.6N re s [%.6N %.6N] 2 d %.6N %.6N m %.6N %.6N l s"]
+ f_radtangle = formatters[
+[[%.6N w %.6N %.6N m
+%.6N %.6N l %.6N %.6N %.6N %.6N y
+%.6N %.6N l %.6N %.6N %.6N %.6N y
+%.6N %.6N l %.6N %.6N %.6N %.6N y
+%.6N %.6N l %.6N %.6N %.6N %.6N y
+h %s]]
+ ]
+ end)
ruleactions.fill = function(p,h,v,i,n)
local l = (p.line or 65536)*bpfactor
diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv
index 4115a13c4..e84d6efaa 100644
--- a/tex/context/base/mkiv/math-ini.mkiv
+++ b/tex/context/base/mkiv/math-ini.mkiv
@@ -126,6 +126,8 @@
\definesystemattribute[displaymath] [public]
+\mathflattenmode 31
+
\appendtoks
\attribute\mathmodeattribute\plusone
\to \everydisplay
@@ -1333,7 +1335,7 @@
\to \everyswitchmathematics
\unexpanded\def\math_basics_synchronize_direction
- {\mathdir T\ifconditional\c_math_right_to_left R\else L\fi T}
+ {\mathdirection\ifconditional\c_math_right_to_left\plusone\else\zerocount\fi}
% Not \everymathematics as it comes too late and I'm not in the mood for a mixed mode
% kludge now (should be a property of beginmath nodes and passed to callbacks).
diff --git a/tex/context/base/mkiv/meta-fnt.lua b/tex/context/base/mkiv/meta-fnt.lua
index d061c926a..e1d8d86eb 100644
--- a/tex/context/base/mkiv/meta-fnt.lua
+++ b/tex/context/base/mkiv/meta-fnt.lua
@@ -108,19 +108,20 @@ local function process(mpxformat,name,instances,scalefactor)
for i=1,instances do
characters = { }
descriptions = { }
- metapost.process(
- mpxformat,
- {
+ metapost.process {
+ mpx = mpxformat,
+ -- trialrun = false,
+ flusher = flusher,
+ -- multipass = false,
+ -- isextrapass = false,
+ askedfig = "all",
+ -- incontext = false,
+ data = {
formatters["randomseed := %s ;"](i*10),
formatters["charscale := %s ;"](scalefactor),
data,
},
- false,
- flusher,
- false,
- false,
- "all"
- )
+ }
lists[i] = {
characters = characters,
descriptions = descriptions,
diff --git a/tex/context/base/mkiv/meta-imp-mat.mkiv b/tex/context/base/mkiv/meta-imp-mat.mkiv
index 19a5ba385..495864a9e 100644
--- a/tex/context/base/mkiv/meta-imp-mat.mkiv
+++ b/tex/context/base/mkiv/meta-imp-mat.mkiv
@@ -15,8 +15,16 @@
%
% / for cambria
-\startMPextensions
+%D We need this for Alan, who nests math in \METAPOST:
+
+\unprotect
+
+\setupmathstackers
+ [\c!mp=minifun::math:stacker:\number\scratchunicode]
+\protect
+
+\startMPextensions
vardef math_stacker_bracket_shape(expr delta, rotate) =
image (
draw
@@ -129,55 +137,55 @@
enddef ;
\stopMPextensions
-\startuniqueMPgraphic{math:stacker:\number"FE3B4}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"FE3B4}{axis,ex,em}
math_stacker_draw_accent(math_stacker_bracket_shape(OverlayHeight,false)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"FE3B5}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"FE3B5}{axis,ex,em}
math_stacker_draw_accent(math_stacker_bracket_shape(OverlayDepth,true)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"FE3DC}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"FE3DC}{axis,ex,em}
math_stacker_draw_accent(math_stacker_parent_shape(OverlayHeight,false)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"FE3DD}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"FE3DD}{axis,ex,em}
math_stacker_draw_accent(math_stacker_parent_shape(OverlayDepth,true)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"FE3DE}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"FE3DE}{axis,ex,em}
math_stacker_draw_accent(math_stacker_brace_shape(OverlayHeight,false)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"FE3DF}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"FE3DF}{axis,ex,em}
math_stacker_draw_accent(math_stacker_brace_shape(OverlayDepth,true)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"FE33E}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"FE33E}{axis,ex,em}
math_stacker_draw_accent(math_stacker_bar_shape(false)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"FE33F}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"FE33F}{axis,ex,em}
math_stacker_draw_accent(math_stacker_bar_shape(true)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"2190}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"2190}{axis,ex,em}
math_stacker_draw_arrow(math_stacker_arrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em},false)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"2192}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"2192}{axis,ex,em}
math_stacker_draw_arrow(math_stacker_arrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em},true)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"2194}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"2194}{axis,ex,em}
math_stacker_draw_arrow(math_stacker_leftrightarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em},false)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"27F7}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"27F7}{axis,ex,em}
math_stacker_draw_arrow(math_stacker_leftrightarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em},false)) ;
\stopuniqueMPgraphic
-\startuniqueMPgraphic{math:stacker:\number"21C4}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:stacker:\number"21C4}{axis,ex,em}
math_stacker_draw_arrow(math_stacker_rightoverleftarrow_shape(\MPvar{axis},\MPvar{ex},\MPvar{em},false)) ;
\stopuniqueMPgraphic
@@ -193,7 +201,7 @@
enddef ;
\stopMPextensions
-\startuniqueMPgraphic{math:radical:default}{axis,ex,em}
+\startuniqueMPgraphic{minifun::math:radical:default}{axis,ex,em}
draw
math_radical_simple(OverlayWidth,OverlayHeight,OverlayDepth,OverlayOffset)
withpen pencircle xscaled (2OverlayLineWidth) yscaled (3OverlayLineWidth/4) rotated 30
diff --git a/tex/context/base/mkiv/meta-ini.mkiv b/tex/context/base/mkiv/meta-ini.mkiv
index 63e9542b8..2c7576c32 100644
--- a/tex/context/base/mkiv/meta-ini.mkiv
+++ b/tex/context/base/mkiv/meta-ini.mkiv
@@ -211,7 +211,7 @@
\def\currentMPformat {\currentMPinstance}
\defineMPinstance[metafun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
-\defineMPinstance[minifun] [\s!format=minifun]
+\defineMPinstance[minifun] [\s!format=minifun,\s!extensions=\v!yes,\s!initializations=\v!yes]
\defineMPinstance[extrafun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes]
\defineMPinstance[lessfun] [\s!format=metafun]
\defineMPinstance[doublefun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!double]
diff --git a/tex/context/base/mkiv/mlib-ctx.lua b/tex/context/base/mkiv/mlib-ctx.lua
index 74601cc8c..99ef6c813 100644
--- a/tex/context/base/mkiv/mlib-ctx.lua
+++ b/tex/context/base/mkiv/mlib-ctx.lua
@@ -190,9 +190,6 @@ function metapost.startgraphic(t)
if not t.method then
t.method = metapost.defaultmethod
end
- if not t.definitions then
- t.definitions = ""
- end
t.data = { }
return t
end
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua
index eca17b751..5d0ab1ab6 100644
--- a/tex/context/base/mkiv/mlib-lua.lua
+++ b/tex/context/base/mkiv/mlib-lua.lua
@@ -255,7 +255,7 @@ local function mppath(f2,f6,t,connector,cycle)
local ti = t[i]
n = n + 1 ; buffer[n] = connector
n = n + 1 ;
- if #ti == 6 then
+ if #ti == 6 and (i < tn or cycle) then
local tn = t[i+1] or t[1]
buffer[n] = f6(ti[1],ti[2],ti[5],ti[6],tn[3],tn[4])
else
@@ -491,17 +491,24 @@ do
local get_numeric = mplib.get_numeric
local get_string = mplib.get_string
local get_boolean = mplib.get_boolean
+ local get_path = mplib.get_path
local get_number = get_numeric
- local currentmpx = nil
- local stack = { }
- local getters = { }
+ local set_path = mplib.set_path
+
+ local currentmpx = nil
+ local stack = { }
+ local getters = { }
+ local setters = { }
getters.numeric = function(s) return get_numeric(currentmpx,s) end
getters.string = function(s) return get_string (currentmpx,s) end
getters.boolean = function(s) return get_boolean(currentmpx,s) end
+ getters.path = function(s) return get_path (currentmpx,s) end
getters.number = mp.numeric
+ setters.path = function(s,t) return set_path(currentmpx,s,t) end
+
function metapost.pushscriptrunner(mpx)
insert(stack,mpx)
currentmpx = mpx
@@ -512,6 +519,7 @@ do
end
mp.get = getters
+ mp.set = setters
end
@@ -840,3 +848,51 @@ do
end
end
+
+do
+
+ local mpnumeric = mp.numeric
+ local mppair = mp.pair
+ local mpgetpath = mp.get.path
+
+ local p = nil
+ local n = 0
+
+ function mp.mfun_path_length(name)
+ p = mp.get.path(name)
+ n = p and #p or 0
+ mpnumeric(n)
+ end
+
+ function mp.mfun_path_point(i)
+ if i > 0 and i <= n then
+ local pi = p[i]
+ mppair(pi[1],pi[2])
+ end
+ end
+
+ function mp.mfun_path_left(i)
+ if i > 0 and i <= n then
+ local pi = p[i]
+ mppair(pi[5],pi[6])
+ end
+ end
+
+ function mp.mfun_path_right(i)
+ if i > 0 and i <= n then
+ local pn
+ if i == 1 then
+ pn = p[2] or p[1]
+ else
+ pn = p[i+1] or p[1]
+ end
+ mppair(pn[3],pn[4])
+ end
+ end
+
+ function mp.mfun_path_reset()
+ p = nil
+ n = 0
+ end
+
+end
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index ce4fd8817..b461e11e4 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -115,14 +115,19 @@ local function getobjects(result,figure,index)
end
end
-function metapost.convert(result, trialrun, flusher, multipass, askedfig, incontext)
+function metapost.convert(specification,result)
+ local trialrun = specification.trialrun
+ local flusher = specification.flusher
+ local multipass = specification.multipass
+ local askedfig = specification.askedfig
+ local incontext = specification.incontext
if trialrun then
local multipassindeed = metapost.parse(result,askedfig)
if multipass and not multipassindeed and metapost.optimize then
if save_table then
table.save(save_table,metapost.totable(result,1)) -- direct
end
- metapost.flush(result,flusher,askedfig,incontext) -- saves a run
+ metapost.flush(specification,result)
else
return false
end
@@ -130,7 +135,7 @@ function metapost.convert(result, trialrun, flusher, multipass, askedfig, incont
if save_table then
table.save(save_table,metapost.totable(result,1)) -- direct
end
- metapost.flush(result,flusher,askedfig,incontext)
+ metapost.flush(specification,result)
end
return true -- done
end
@@ -416,9 +421,12 @@ local function nocomment() end
metapost.comment = nocomment
-function metapost.flush(result,flusher,askedfig,incontext)
+function metapost.flush(specification,result)
if result then
- local figures = result.fig
+ local flusher = specification.flusher
+ local askedfig = specification.askedfig
+ local incontext = specification.incontext
+ local figures = result.fig
if figures then
flusher = flusher or pdfflusher
local resetplugins = metapost.resetplugins or ignore -- before figure
@@ -708,27 +716,36 @@ end
-- tracing:
-local result = { }
-
-local flusher = {
- startfigure = function()
- result = { }
- context.startnointerference()
- end,
- flushfigure = function(literals)
- local n = #result
- for i=1,#literals do
- result[n+i] = literals[i]
+do
+
+ local result = { }
+
+ local flusher = {
+ startfigure = function()
+ result = { }
+ context.startnointerference()
+ end,
+ flushfigure = function(literals)
+ local n = #result
+ for i=1,#literals do
+ result[n+i] = literals[i]
+ end
+ end,
+ stopfigure = function()
+ context.stopnointerference()
end
- end,
- stopfigure = function()
- context.stopnointerference()
+ }
+
+ local specification = {
+ flusher = flusher,
+ -- incontext = true,
+ }
+
+ function metapost.pdfliterals(result)
+ metapost.flush(specification,result)
+ return result
end
-}
-function metapost.pdfliterals(result)
- metapost.flush(result,flusher)
- return result
end
function metapost.totable(result,askedfig)
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua
index 6c2dfe4cd..5681edfd1 100644
--- a/tex/context/base/mkiv/mlib-pps.lua
+++ b/tex/context/base/mkiv/mlib-pps.lua
@@ -622,7 +622,7 @@ end
-- maybe we can latelua the texts some day
-local processmetapost = metapost.process
+local runmetapost = metapost.run
local function checkaskedfig(askedfig) -- return askedfig, wrappit
if not askedfig then
@@ -646,37 +646,42 @@ local function extrapass()
report_metapost("second run of job %s, asked figure %a",top.nofruns,top.askedfig)
end
metapost.preparetextextsdata()
- processmetapost(top.mpx, {
- top.wrappit and do_begin_fig or "",
- no_trial_run,
- top.initializations,
- do_safeguard,
- top.data,
- top.wrappit and do_end_fig or "",
- }, false, nil, false, true, top.askedfig)
+ runmetapost {
+ mpx = top.mpx,
+ isextrapass = true,
+ askedfig = top.askedfig,
+ incontext = true,
+ data = {
+ top.wrappit and do_begin_fig or "",
+ no_trial_run,
+ top.initializations,
+ do_safeguard,
+ top.data,
+ top.wrappit and do_end_fig or "",
+ },
+ }
end
-function metapost.graphic_base_pass(specification) -- name will change (see mlib-ctx.lua)
- local top = startjob(true,"base")
- --
+-- This one is called from the \TEX\ end so the specification is different
+-- from the specification to metapost,run cum suis! The definitions and
+-- extension used to be handled here but are now delegated to the format
+-- initializers because we need to accumulate them for nested instances (a
+-- side effect of going single pass).
+
+function metapost.graphic_base_pass(specification)
+ local top = startjob(true,"base")
local mpx = specification.mpx -- mandate
local data = specification.data or ""
- local definitions = specification.definitions or ""
- -- local extensions = metapost.getextensions(specification.instance,specification.useextensions)
- local extensions = specification.extensions or ""
local inclusions = specification.inclusions or ""
local initializations = specification.initializations or ""
- local askedfig = specification.figure -- no default else no wrapper
+ local askedfig,
+ wrappit = checkaskedfig(specification.figure)
+ nofruns = nofruns + 1
+ top.askedfig = askedfig
+ top.wrappit = wrappit
+ top.nofruns = nofruns
metapost.namespace = specification.namespace or ""
--
- local askedfig, wrappit = checkaskedfig(askedfig)
- --
- nofruns = nofruns + 1
- --
- top.askedfig = askedfig
- top.wrappit = wrappit
- top.nofruns = nofruns
- --
local done_1, done_2, done_3, forced_1, forced_2, forced_3
if checking_enabled then
data, done_1, forced_1 = checktexts(data)
@@ -691,12 +696,12 @@ function metapost.graphic_base_pass(specification) -- name will change (see mlib
inclusions, done_3, forced_3 = checktexts(inclusions)
end
end
- top.intermediate = false
- top.multipass = false -- no needed here
- top.mpx = mpx
- top.data = data
- top.initializations = initializations
- local method = metapost.method
+ top.intermediate = false
+ top.multipass = false -- no needed here
+ top.mpx = mpx
+ top.data = data
+ top.initializations = initializations
+ local method = metapost.method
if trace_runs then
if method == 1 then
report_metapost("forcing two runs due to library configuration")
@@ -716,56 +721,78 @@ function metapost.graphic_base_pass(specification) -- name will change (see mlib
if trace_runs then
report_metapost("first run of job %s, asked figure %a",nofruns,askedfig)
end
- -- first true means: trialrun, second true means: avoid extra run if no multipass
- local flushed = processmetapost(mpx, {
- definitions,
- extensions,
- inclusions,
- wrappit and do_begin_fig or "",
- do_first_run,
- do_trial_run,
- initializations,
- do_safeguard,
- data,
- wrappit and do_end_fig or "",
- }, true, nil, not (forced_1 or forced_2 or forced_3), false, askedfig, true)
+ local flushed = runmetapost {
+ mpx = mpx,
+ trialrun = true,
+ multipass = not (forced_1 or forced_2 or forced_3),
+ askedfig = askedfig,
+ incontext = true,
+ data = {
+ inclusions,
+ wrappit and do_begin_fig or "",
+ do_first_run,
+ do_trial_run,
+ initializations,
+ do_safeguard,
+ data,
+ wrappit and do_end_fig or "",
+ },
+ }
if top.intermediate then
for _, action in next, metapost.intermediate.actions do
action()
end
end
if not flushed or not metapost.optimize then
- -- tricky, we can only ask once for objects and therefore
- -- we really need a second run when not optimized
- -- context.MPLIBextrapass(askedfig)
+ -- This is tricky as we can only ask for objects once and therefore
+ -- we really need a second run when we're not optimized.
context(extrapass)
end
else
if trace_runs then
report_metapost("running job %s, asked figure %a",nofruns,askedfig)
end
- processmetapost(mpx, {
- definitions,
- extensions,
- inclusions,
- wrappit and do_begin_fig or "",
- do_first_run,
- no_trial_run,
- initializations,
- do_safeguard,
- data,
- wrappit and do_end_fig or "",
- }, false, nil, false, false, askedfig, true)
+ runmetapost {
+ mpx = mpx,
+ askedfig = askedfig,
+ incontext = true,
+ data = {
+ inclusions,
+ wrappit and do_begin_fig or "",
+ do_first_run,
+ no_trial_run,
+ initializations,
+ do_safeguard,
+ data,
+ wrappit and do_end_fig or "",
+ },
+ }
end
context(stopjob)
end
--- we overload metapost.process here
+local function oldschool(mpx, data, trialrun, flusher, multipass, isextrapass, askedfig, incontext)
+ metapost.process {
+ mpx = mpx,
+ trialrun = trialrun,
+ flusher = flusher,
+ multipass = multipass,
+ isextrapass = isextrapass,
+ askedfig = askedfig,
+ useplugins = incontext,
+ incontext = incontext,
+ data = data,
+ }
+end
-function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass, askedfig, plugmode) -- overloads
- startjob(plugmode,"process")
- processmetapost(mpx, data, trialrun, flusher, multipass, isextrapass, askedfig)
- stopjob()
+function metapost.process(specification,...)
+ if type(specification) ~= "table" then
+ oldschool(specification,...)
+ else
+ startjob(specification.incontext or specification.useplugins,"process")
+ runmetapost(specification)
+ stopjob()
+ end
end
local start = [[\starttext]]
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua
index 9369e9db0..6aa433627 100644
--- a/tex/context/base/mkiv/mlib-run.lua
+++ b/tex/context/base/mkiv/mlib-run.lua
@@ -279,14 +279,42 @@ function metapost.unload(mpx)
stoptiming(mplib)
end
+-- The flatten hack is needed because the library currently barks on \n\n and the
+-- collapse because mp cannot handle snippets due to grouping issues.
+
+local function flatten(source,target)
+ for i=1,#source do
+ local d = source[i]
+ if type(d) == "table" then
+ flatten(d,target)
+ elseif d and d ~= "" then
+ target[#target+1] = d
+ end
+ end
+ return target
+end
+
+local function prepareddata(data,collapse)
+ if data and data ~= "" then
+ if type(data) == "table" then
+ data = flatten(data,{ })
+ if collapse then
+ data = #data > 1 and concat(data,"\n") or data[1]
+ end
+ end
+ return data
+ end
+end
+
metapost.use_one_pass = LUATEXFUNCTIONALITY >= 6789 -- for a while
metapost.defaultformat = "metafun"
metapost.defaultinstance = "metafun"
metapost.defaultmethod = "default"
-local mpxformats = { }
-local nofformats = 0
+local mpxformats = { }
+local nofformats = 0
+local mpxpreambles = { }
function metapost.pushformat(specification,f,m) -- was: instance, name, method
if type(specification) ~= "table" then
@@ -296,9 +324,12 @@ function metapost.pushformat(specification,f,m) -- was: instance, name, method
method = m,
}
end
- local instance = specification.instance
- local format = specification.format
- local method = specification.method
+ local instance = specification.instance
+ local format = specification.format
+ local method = specification.method
+ local definitions = specification.definitions
+ local extensions = specification.extensions
+ local preamble = nil
if not instance or instance == "" then
instance = metapost.defaultinstance
specification.instance = instance
@@ -311,13 +342,35 @@ function metapost.pushformat(specification,f,m) -- was: instance, name, method
method = metapost.defaultmethod
specification.method = method
end
+ if definitions and definitions ~= "" then
+ preamble = definitions
+ end
+ if extensions and extensions ~= "" then
+ if preamble then
+ preamble = preamble .. "\n" .. extensions
+ else
+ preamble = extensions
+ end
+ end
nofformats = nofformats + 1
- instance = instance .. ":" .. nofformats
- local mpx = mpxformats[instance]
+ local usedinstance = instance .. ":" .. nofformats
+ local mpx = mpxformats[usedinstance]
+ local mpp = mpxpreambles[instance] or ""
+ if preamble then
+ preamble = prepareddata(preamble,true)
+ mpp = mpp .. "\n" .. preamble
+ mpxpreambles[instance] = mpp
+ end
if not mpx then
- report_metapost("initializing instance %a using format %a and method %a",instance,format,method)
+ report_metapost("initializing instance %a using format %a and method %a",usedinstance,format,method)
mpx = metapost.checkformat(format,method)
- mpxformats[instance] = mpx
+ mpxformats[usedinstance] = mpx
+ if mpp ~= "" then
+ preamble = mpp
+ end
+ end
+ if preamble then
+ mpx:execute(preamble)
end
specification.mpx = mpx
return mpx
@@ -391,7 +444,41 @@ do
end
-function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass, askedfig, incontext)
+
+if not metapost.process then
+
+ function metapost.process(specification)
+ metapost.run(specification)
+ end
+
+end
+
+-- run, process, convert and flush all work with a specification with the
+-- following (often optional) fields
+--
+-- mpx string or mp object
+-- data string or table of strings
+-- trialrun boolean
+-- flusher table with flush methods
+-- multipass boolean
+-- isextrapass boolean
+-- askedfig string ("all" etc) or number
+-- incontext boolean
+-- plugmode boolean
+
+local function makebeginbanner(specification)
+ return formatters
+ ["%% begin graphic: n=%s, trialrun=%l, multipass=%l, isextrapass=%l\n\n"]
+ (metapost.n, specification.trialrun, specification.multipass, specification.isextrapass)
+end
+
+local function makeendbanner(specification)
+ return "\n% end graphic\n\n"
+end
+
+function metapost.run(specification)
+ local mpx = specification.mpx
+ local data = specification.data
local converted = false
local result = { }
local mpxdone = type(mpx) == "string"
@@ -414,39 +501,12 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
}
mp_tra[mpx] = tra
end
- local banner = formatters["%% begin graphic: n=%s, trialrun=%s, multipass=%s, isextrapass=%s\n\n"](
- metapost.n, tostring(trialrun), tostring(multipass), tostring(isextrapass))
+ local banner = makebeginbanner(specification)
tra.inp:write(banner)
tra.log:write(banner)
end
- if type(data) == "table" then
- -- this hack is needed because the library currently barks on \n\n
- -- eventually we can text for "" in the next loop
- local n = 0
- local nofsnippets = #data
- for i=1,nofsnippets do
- local d = data[i]
- if d ~= "" then
- n = n + 1
- data[n] = d
- end
- end
- for i=nofsnippets,n+1,-1 do
- data[i] = nil
- end
- -- and this one because mp cannot handle snippets due to grouping issues
- if metapost.collapse then
- if #data > 1 then
- data = concat(data,"\n")
- else
- data = data[1]
- end
- end
- -- end of hacks
- end
-
+ local data = prepareddata(data,metapost.collapse)
local function process(d,i)
- -- d = string.gsub(d,"\r","")
if d then
if trace_graphics then
if i then
@@ -458,7 +518,7 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
end
end
starttiming(metapost.exectime)
- result = mpx:execute(d) -- some day we wil use a coroutine with textexts
+ result = mpx:execute(d)
stoptiming(metapost.exectime)
if trace_graphics and result then
local str = result.log or result.error
@@ -475,7 +535,7 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
end
end
if result.fig then
- converted = metapost.convert(result, trialrun, flusher, multipass, askedfig, incontext)
+ converted = metapost.convert(specification,result)
end
end
elseif i then
@@ -489,7 +549,6 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
if trace_tracingall then
mpx:execute("tracingall;")
end
- -- table.insert(data,2,"")
for i=1,#data do
process(data[i],i)
end
@@ -500,7 +559,7 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
process(data)
end
if trace_graphics then
- local banner = "\n% end graphic\n\n"
+ local banner = makeendbanner(specification)
tra.inp:write(banner)
tra.log:write(banner)
end
@@ -513,8 +572,12 @@ function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass,
return converted, result
end
-function metapost.convert()
- report_metapost('warning: no converter set')
+if not metapost.convert then
+
+ function metapost.convert()
+ report_metapost('warning: no converter set')
+ end
+
end
-- handy
@@ -582,7 +645,7 @@ end
-- goodie
-function metapost.quickanddirty(mpxformat,data,plugmode)
+function metapost.quickanddirty(mpxformat,data,incontext)
if not data then
mpxformat = "metafun"
data = mpxformat
@@ -602,7 +665,14 @@ function metapost.quickanddirty(mpxformat,data,plugmode)
end
}
local data = formatters["; beginfig(1) ;\n %s\n ; endfig ;"](data)
- metapost.process(mpxformat, { data }, false, flusher, false, false, "all", plugmode)
+ metapost.process {
+ mpx = mpxformat,
+ flusher = flusher,
+ askedfig = "all",
+ useplugins = incontext,
+ incontext = incontext,
+ data = { data },
+ }
if code then
return {
bbox = bbox or { 0, 0, 0, 0 },
@@ -637,7 +707,6 @@ do
local width = 0
local height = 0
local depth = 0
- local mpx = false
local flusher = {
startfigure = function(n,llx,lly,urx,ury)
@@ -655,13 +724,17 @@ do
end
}
- function metapost.simple(format,code) -- even less than metapost.quickcanddirty
+ function metapost.simple(format,code) -- even less than metapost.quickcanddirty
local mpx = metapost.pushformat { } -- takes defaults
-- metapost.setoutercolor(2)
- metapost.process(mpx,
- { "beginfig(1);", code, "endfig;" },
- false, flusher, false, false, 1, true -- last true is plugmode !
- )
+ metapost.process {
+ mpx = mpx,
+ flusher = flusher,
+ askedfig = 1,
+ useplugins = false,
+ incontext = false,
+ data = { "beginfig(1);", code, "endfig;" },
+ }
metapost.popformat()
if result then
local stream = concat(result," ")
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 3aa265b8d..dd19e40b8 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -243,6 +243,7 @@ return {
"dvifeedback",
"dvivariable",
"efcode",
+ "endlocalcontrol",
"etoksapp",
"etokspre",
"exceptionpenalty",
@@ -447,6 +448,7 @@ return {
"pdfnormaldeviate",
"pdfobj",
"pdfobjcompresslevel",
+ "pdfomitcidset",
"pdfoutline",
"pdfoutput",
"pdfpageattr",
@@ -463,6 +465,7 @@ return {
"pdfprotrudechars",
"pdfpxdimen",
"pdfrandomseed",
+ "pdfrecompress",
"pdfrefobj",
"pdfrefxform",
"pdfrefximage",
diff --git a/tex/context/base/mkiv/mult-prm.mkiv b/tex/context/base/mkiv/mult-prm.mkiv
index d6131bc38..3480cded5 100644
--- a/tex/context/base/mkiv/mult-prm.mkiv
+++ b/tex/context/base/mkiv/mult-prm.mkiv
@@ -68,6 +68,7 @@
"pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate",
"pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr",
"pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage",
+ "pdfomitcidset",
},
aleph = { -- we don't bother
"Alephminorversion", "Alephrevision", "Alephversion",
diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua
index 2e985d1e4..077506e46 100644
--- a/tex/context/base/mkiv/node-tra.lua
+++ b/tex/context/base/mkiv/node-tra.lua
@@ -456,7 +456,6 @@ local function numbertodimen(d,unit,fmt)
end
return formatters[fmt](d*dimenfactors[unit],unit)
elseif not unit or unit == "pt" then
-print(d,unit,fmt,f_pt(d))
return f_pt(d)
else
return f_un(d*dimenfactors[unit],unit)
diff --git a/tex/context/base/mkiv/page-mul.mkiv b/tex/context/base/mkiv/page-mul.mkiv
index a855a3d02..bea7f188d 100644
--- a/tex/context/base/mkiv/page-mul.mkiv
+++ b/tex/context/base/mkiv/page-mul.mkiv
@@ -480,7 +480,7 @@
\page_mul_calculate_column_result_dimensions
\overlaycolumnfootnotes
\setbox\columnpagebox\vpack % \vbox
- {\hpack \ifconditional\c_page_mul_reverse dir TRT \fi to \makeupwidth
+ {\hpack \ifconditional\c_page_mul_reverse bdir \plusone \fi to \makeupwidth
{\hskip\ifconditional\c_page_mul_reverse\d_page_mul_rightskip\else\d_page_mul_leftskip\fi\relax
\dohandleallcolumns
{\finishcolumnbox
diff --git a/tex/context/base/mkiv/publ-aut.lua b/tex/context/base/mkiv/publ-aut.lua
index be0c771a3..9ff078119 100644
--- a/tex/context/base/mkiv/publ-aut.lua
+++ b/tex/context/base/mkiv/publ-aut.lua
@@ -16,6 +16,7 @@ local lpeg = lpeg
local type, next, tostring, tonumber = type, next, tostring, tonumber
local concat, sortedhash = table.concat, table.sortedhash
local utfsub = utf.sub
+local find = string.find
local formatters = string.formatters
local P, S, C, V, Cs, Ct, Cg, Cf, Cc = lpeg.P, lpeg.S, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Ct, lpeg.Cg, lpeg.Cf, lpeg.Cc
@@ -38,6 +39,8 @@ local chardata = characters.data
local trace_hashing = false trackers.register("publications.authorhash", function(v) trace_hashing = v end)
+local expand_authors = false directives.register("publications.prerollauthor", function(v) expand_authors = v end)
+
local report = logs.reporter("publications","authors")
local report_cite = logs.reporter("publications","cite")
@@ -123,6 +126,8 @@ end
local authormap = allocate()
publications.authormap = authormap
+local prerollcmdstring = publications.prerollcmdstring
+
local function splitauthor(author,justsplit)
local detail, remapped
if not justsplit then
@@ -142,6 +147,9 @@ local function splitauthor(author,justsplit)
end
local author = remapped or author
local firstnames, vons, surnames, initials, juniors, options
+ if expand_authors and find(author,"\\btxcmd") then
+ author = prerollcmdstring(author)
+ end
local split = lpegmatch(commasplitter,author)
local n = #split
detail = {
@@ -825,8 +833,10 @@ local p_clean = Cs ( (
+ lpeg.patterns.utf8character
)^1)
+-- Probabbly more robust is a two pass approach.
+
authorhashers.short = function(authors)
- -- a short is a real dumb hardcodes kind of tag and we only support
+ -- a short is a real dumb hardcoded kind of tag and we only support
-- this one because some users might expect it, not because it makes
-- sense
if type(authors) == "table" then
diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua
index c0682613a..570e0a0b0 100644
--- a/tex/context/base/mkiv/publ-dat.lua
+++ b/tex/context/base/mkiv/publ-dat.lua
@@ -443,7 +443,7 @@ do
----- command = P("\\") * (Carg(1) * C(R("az","AZ")^1) * space^0 / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
local command = P("\\") * (Carg(1) * C(csletter^1) * space^0 / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
local whatever = P("\\") * P(" ")^1 / " "
- + P("\\") * ( P("hbox") + P("raise") ) -- bah
+ ----- + P("\\") * ( P("hbox") + P("raise") ) -- bah -- no longer
local somemath = P("$") * ((1-P("$"))^1) * P("$") -- let's not assume nested math
----- character = lpegpatterns.utf8character
local any = P(1)
@@ -644,16 +644,17 @@ do
local somevalue = d_value + b_value + s_value + r_value + n_value + e_value
local value = Cs((somevalue * ((spacing * hash * spacing)/"" * somevalue)^0))
- local stripper = lpegpatterns.stripper
- value = value / function(s) return lpegmatch(stripper,s) end
+ local stripper = lpegpatterns.collapser
+ local stripped = value / function(s) return lpegmatch(stripper,s) end
local forget = percent^1 * (1-lineending)^0
local spacing = spacing * forget^0 * spacing
- local assignment = spacing * key * spacing * equal * spacing * value * spacing
+ local replacement= spacing * key * spacing * equal * spacing * value * spacing
+ local assignment = spacing * key * spacing * equal * spacing * stripped * spacing
local definition = category * spacing * left * spacing * tag * spacing * comma * Ct((assignment * comma^0)^0) * spacing * right * Carg(1) / do_definition
local crapword = C((1-space-left)^1)
- local shortcut = Cmt(crapword,function(_,p,s) return lower(s) == "string" and p end) * spacing * left * ((assignment * Carg(1))/do_shortcut * comma^0)^0 * spacing * right
+ local shortcut = Cmt(crapword,function(_,p,s) return lower(s) == "string" and p end) * spacing * left * ((replacement * Carg(1))/do_shortcut * comma^0)^0 * spacing * right
local comment = Cmt(crapword,function(_,p,s) return lower(s) == "comment" and p end) * spacing * lpegpatterns.argument * Carg(1) / do_comment
local casecrap = #S("sScC") * (shortcut + comment)
@@ -1253,4 +1254,17 @@ do
end
+do
+
+ implement {
+ name = "btxshortcut",
+ arguments = "2 strings",
+ actions = function(instance,key)
+ local d = publications.datasets[instance]
+ context(d and d.shortcuts[key] or "?")
+ end,
+ }
+
+end
+
-- inspect(publications.load { filename = "e:/tmp/oeps.bib" })
diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua
index 58a1d8f5e..d58152bfc 100644
--- a/tex/context/base/mkiv/publ-ini.lua
+++ b/tex/context/base/mkiv/publ-ini.lua
@@ -3456,3 +3456,20 @@ do
}
end
+
+do
+
+ local btxstring = ""
+
+ implement {
+ name = "btxcmdstring",
+ actions = function() context(btxstring) end,
+ }
+
+ function publications.prerollcmdstring(str)
+ btxstring = str or ""
+ tex.runtoks("t_btx_cmd")
+ return nodes.toutf(tex.getbox("b_btx_cmd").list) or str
+ end
+
+end
diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv
index 587341355..39e9308e9 100644
--- a/tex/context/base/mkiv/publ-ini.mkiv
+++ b/tex/context/base/mkiv/publ-ini.mkiv
@@ -334,6 +334,11 @@
\expandafter\publ_command_nop
\fi{#1}}
+\newtoks\t_btx_cmd
+\newbox \b_btx_cmd
+
+\t_btx_cmd{\global\setbox\b_btx_cmd\hpack{\clf_btxcmdstring}}
+
\let\btxcmd\btxcommand
\def\publ_command_yes#1%
@@ -1997,4 +2002,15 @@
\fetchruntimecommand \showbtxfields \f!publ_tra
\fetchruntimecommand \showbtxtables \f!publ_tra
+%D Some potential crap:
+%D
+%D Because I consider this bad data management and a weird mix of languages only one
+%D accessor is provided.
+
+\unexpanded\def\btxshortcut
+ {\dosingleempty\publ_shortcut}
+
+\def\publ_shortcut[#1]#2%
+ {\clf_btxshortcut{\iffirstargument#1\else\s!default\fi}{#2}}
+
\protect
diff --git a/tex/context/base/mkiv/spac-ali.mkiv b/tex/context/base/mkiv/spac-ali.mkiv
index ac24cb43c..ee4cfa8bc 100644
--- a/tex/context/base/mkiv/spac-ali.mkiv
+++ b/tex/context/base/mkiv/spac-ali.mkiv
@@ -64,6 +64,9 @@
%D We will not use bodydir and pagedir so we disable them. That way we get
%D normal hyperlink support. We back on it (too hard to fake \type {\the}).
+\chardef\directionlefttoright\zerocount
+\chardef\directionrighttoleft\plusone
+
\unexpanded\def\syst_fatal_dir_error#1%
{\writestatus{fatal error}{\string#1\space is forbidden}%
\wait}
@@ -71,6 +74,9 @@
\def\pagedir {\syst_fatal_dir_error\pagedir} \let\normalpagedir\pagedir
\def\bodydir {\syst_fatal_dir_error\bodydir} \let\normalbodydir\bodydir
+\def\pagedirection{\syst_fatal_dir_error\pagedirection} \let\normalpagedirection\pagedirection
+\def\bodydirection{\syst_fatal_dir_error\bodydirection} \let\normalbodydirection\bodydirection
+
% This will become a more advanced layout controller soon:
\newconditional\layoutlefttoright \settrue\layoutlefttoright
@@ -94,14 +100,14 @@
\unexpanded\def\spac_directions_lefttoright_vmode
{\settrue\displaylefttoright
\settrue\inlinelefttoright
- \textdir TLT\relax
- \pardir TLT\relax}
+ \textdirection\directionlefttoright
+ \pardirection \directionlefttoright}
\unexpanded\def\spac_directions_righttoleft_vmode
{\setfalse\displaylefttoright
\setfalse\inlinelefttoright
- \textdir TRT\relax
- \pardir TRT\relax}
+ \textdirection\directionrighttoleft
+ \pardirection \directionrighttoleft}
% % keep this as reference
%
@@ -136,11 +142,11 @@
% \setfalse\inlinelefttoright}
\unexpanded\def\spac_directions_lefttoright_hmode
- {\linedir TLT\relax % linedir keeps subtype of skip
+ {\linedirection\directionlefttoright % linedir keeps subtype of skip
\settrue\inlinelefttoright}
\unexpanded\def\spac_directions_righttoleft_hmode
- {\linedir TRT\relax % linedir keeps subtype of skip
+ {\linedirection\directionrighttoleft % linedir keeps subtype of skip
\setfalse\inlinelefttoright}
% \def\currentdirectionparameters
@@ -167,16 +173,17 @@
\def\spac_directions_synchronize_lr
{\settrue\inlinelefttoright
- \textdir TLT\relax
- \pardir TLT\relax}
+ \textdirection\directionlefttoright
+ \pardirection \directionlefttoright}
\def\spac_directions_synchronize_rl
{\setfalse\inlinelefttoright
- \textdir TRT\relax
- \pardir TRT\relax}
+ \textdirection\directionrighttoleft
+ \pardirection \directionrighttoleft}
\unexpanded\def\synchronizeinlinedirection
- {\textdir T\ifconditional\inlinelefttoright L\else R\fi T\relax}
+ {% why not \linedirection here
+ \textdirection\ifconditional\inlinelefttoright\directionlefttoright\else\directionrighttoleft\fi}
\unexpanded\def\checkedlefttoright
{\ifvmode
@@ -210,49 +217,20 @@
\unexpanded\def\usebidiparameter#1%
{\begincsname\??bidi#1\c!bidi\endcsname}
-% maybe some day:
-%
-% \newcount\postdirpenalty % \zerocount
-% \newcount\predirpenalty % \zerocount
-%
-% \def\spac_directions_post_break
-% {\ifhmode
-% \removeunwantedspaces
-% \penalty\postdirpenalty
-% \fi}
-%
-% \def\spac_directions_pre_break
-% {\ifhmode
-% \penalty\predirpenalty
-% \ignorespaces
-% \fi}
-%
-% \unexpanded\def\spac_directions_lefttoright_hmode
-% {\settrue\inlinelefttoright
-% \textdir TLT\relax
-% \aftergroup\spac_directions_post_break
-% \spac_directions_pre_break}
-%
-% \unexpanded\def\spac_directions_righttoleft_hmode
-% {\textdir TRT\relax
-% \setfalse\inlinelefttoright
-% \aftergroup\spac_directions_post_break
-% \spac_directions_pre_break}
-
\unexpanded\def\showdirections
{\dontleavehmode
- \begingroup\infofont\textdir TLT[\space
- layout:\ifconditional \layoutlefttoright l2r\else r2l\fi\space
- display:\ifconditional\displaylefttoright l2r\else r2l\fi\space
- inline:\ifconditional \inlinelefttoright l2r\else r2l\fi\space
+ \begingroup\infofont\textdirection\directionlefttoright[\space
+ layout: \ifconditional\layoutlefttoright l2r\else r2l\fi\space
+ display: \ifconditional\displaylefttoright l2r\else r2l\fi\space
+ inline: \ifconditional\inlinelefttoright l2r\else r2l\fi\space
]\endgroup}
-\unexpanded\def\righttolefthbox#1#{\hbox dir TRT #1\bgroup\righttoleft\let\next} \let\rtlhbox\righttolefthbox
-\unexpanded\def\lefttorighthbox#1#{\hbox dir TLT #1\bgroup\lefttoright\let\next} \let\ltrhbox\lefttorighthbox
-\unexpanded\def\righttoleftvbox#1#{\vbox dir TRT #1\bgroup\righttoleft\let\next} \let\rtlvbox\righttoleftvbox
-\unexpanded\def\lefttorightvbox#1#{\vbox dir TLT #1\bgroup\lefttoright\let\next} \let\ltrvbox\lefttorightvbox
-\unexpanded\def\righttoleftvtop#1#{\vtop dir TRT #1\bgroup\righttoleft\let\next} \let\rtlvtop\righttoleftvtop
-\unexpanded\def\lefttorightvtop#1#{\vtop dir TLT #1\bgroup\lefttoright\let\next} \let\ltrvtop\lefttorightvtop
+\unexpanded\def\righttolefthbox#1#{\hbox bdir\plusone #1\bgroup\righttoleft\let\next} \let\rtlhbox\righttolefthbox
+\unexpanded\def\lefttorighthbox#1#{\hbox bdir\zerocount#1\bgroup\lefttoright\let\next} \let\ltrhbox\lefttorighthbox
+\unexpanded\def\righttoleftvbox#1#{\vbox bdir\plusone #1\bgroup\righttoleft\let\next} \let\rtlvbox\righttoleftvbox
+\unexpanded\def\lefttorightvbox#1#{\vbox bdir\zerocount#1\bgroup\lefttoright\let\next} \let\ltrvbox\lefttorightvbox
+\unexpanded\def\righttoleftvtop#1#{\vtop bdir\plusone #1\bgroup\righttoleft\let\next} \let\rtlvtop\righttoleftvtop
+\unexpanded\def\lefttorightvtop#1#{\vtop bdir\zerocount#1\bgroup\lefttoright\let\next} \let\ltrvtop\lefttorightvtop
\unexpanded\def\autodirhbox#1#{\hbox#1\bgroup\synchronizeinlinedirection\let\next}
\unexpanded\def\autodirvbox#1#{\vbox#1\bgroup\synchronizeinlinedirection\let\next} % maybe also pardir or maybe just a \vbox
diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv
index cb08fa14a..d67cb4faf 100644
--- a/tex/context/base/mkiv/spac-ver.mkiv
+++ b/tex/context/base/mkiv/spac-ver.mkiv
@@ -2091,8 +2091,56 @@
\def\spac_vspacing_nop_ignore
{\ifmmode\else\par\fi}
+% \unexpanded\def\directvspacing#1%
+% {\par\clf_vspacing{#1}}
+%
+%
+% \def\directdefaultvspacing
+% {\ifinpagebody % somewhat weird
+% \clf_vspacing{\currentvspacing}%
+% \else\ifconditional\c_spac_packed_blank
+% \clf_vspacing{\currentvspacing}%
+% \fi\fi}
+%
+% \unexpanded\def\useblankparameter#1% faster local variant
+% {\edef\m_spac_blank_asked{#1\c!blank}%
+% \ifx\m_spac_blank_asked\empty\else
+% \clf_vspacing{\m_spac_blank_asked}
+% \fi}
+
+\installcorenamespace{vspacing}
+
\unexpanded\def\directvspacing#1%
- {\par\clf_vspacing{#1}}
+ {\par
+ \ifcsname\??vspacing#1\endcsname
+ \lastnamedcs
+ \else
+ \spac_vspacing_yes_preset{#1}%
+ \fi}
+
+\def\spac_vspacing_yes_preset#1%
+ {\setxvalue{\??vspacing#1}{\clf_vspacing{#1}}%
+ %\writestatus{}{}%
+ %\writestatus{#1}{\expandafter\meaning\csname\??vspacing#1\endcsname}%
+ %\writestatus{}{}%
+ \csname\??vspacing#1\endcsname}
+
+\def\spac_vspacing_yes_indeed[#1]%
+ {\ifmmode\else
+ \directvspacing{#1}%
+ \fi}
+
+\def\spac_vspacing_nop_indeed
+ {\ifmmode\else
+ \directvspacing\currentvspacing
+ \fi}
+
+\def\directdefaultvspacing
+ {\ifinpagebody % somewhat weird
+ \directvspacing\currentvspacing
+ \else\ifconditional\c_spac_packed_blank
+ \directvspacing\currentvspacing
+ \fi\fi}
\def\directcheckedvspacing
{\ifinpagebody % somewhat weird
@@ -2103,17 +2151,10 @@
\doubleexpandafter\gobbleoneargument
\fi\fi}
-\def\directdefaultvspacing
- {\ifinpagebody % somewhat weird
- \clf_vspacing{\currentvspacing}%
- \else\ifconditional\c_spac_packed_blank
- \clf_vspacing{\currentvspacing}%
- \fi\fi}
-
\unexpanded\def\useblankparameter#1% faster local variant
{\edef\m_spac_blank_asked{#1\c!blank}%
\ifx\m_spac_blank_asked\empty\else
- \clf_vspacing{\m_spac_blank_asked}
+ \directvspacing\m_spac_blank_asked
\fi}
% handy (and faster):
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index e4f2dce10..95eed4d50 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 68df79f1a..757509873 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-reg.lua b/tex/context/base/mkiv/strc-reg.lua
index b51106e6a..919290c8f 100644
--- a/tex/context/base/mkiv/strc-reg.lua
+++ b/tex/context/base/mkiv/strc-reg.lua
@@ -38,6 +38,7 @@ local texgetcount = tex.getcount
local variables = interfaces.variables
local v_forward = variables.forward
local v_all = variables.all
+local v_no = variables.no
local v_yes = variables.yes
local v_packed = variables.packed
local v_current = variables.current
@@ -451,23 +452,6 @@ local tagged = { }
local function preprocessentries(rawdata)
local entries = rawdata.entries
if entries then
- --
- -- local e = entries[1] or ""
- -- local k = entries[2] or ""
- -- local et, kt, entryproc, pageproc
- -- if type(e) == "table" then
- -- et = e
- -- else
- -- entryproc, e = splitprocessor(e)
- -- et = lpegmatch(entrysplitter,e)
- -- end
- -- if type(k) == "table" then
- -- kt = k
- -- else
- -- pageproc, k = splitprocessor(k)
- -- kt = lpegmatch(entrysplitter,k)
- -- end
- --
local processors = rawdata.processors
local et = entries.entries
local kt = entries.keys
@@ -738,7 +722,7 @@ local seeindex = 0
-- meerdere loops, seewords, dan words, anders seewords
-local function crosslinkseewords(result) -- all words
+local function crosslinkseewords(result,check) -- all words
-- collect all seewords
local seewords = { }
for i=1,#result do
@@ -782,28 +766,17 @@ local function crosslinkseewords(result) -- all words
local seeparent = seeparents[text]
if seeparent then
local seeindex = seewords[text]
--- local s, ns, d, w, l = { }, 0, data.split, seeparent.split, data.list
--- -- trick: we influence sorting by adding fake subentries
--- for i=1,#d do
--- ns = ns + 1
--- s[ns] = d[i] -- parent
--- end
--- for i=1,#w do
--- ns = ns + 1
--- s[ns] = w[i] -- see
--- end
--- data.split = s
--- -- we also register a fake extra list entry so that the
--- -- collapser works okay
--- l[#l+1] = { text, "" }
data.references.seeindex = seeindex
if trace_registers then
report_registers("see crosslink %03i: %s",seeindex,text)
end
seeword.valid = true
- else
- report_registers("invalid crosslink : %s",text)
+ elseif check then
+ report_registers("invalid crosslink : %s, %s",text,"ignored")
seeword.valid = false
+ else
+ report_registers("invalid crosslink : %s, %s",text,"passed")
+ seeword.valid = true
end
end
end
@@ -827,7 +800,7 @@ local function removeemptyentries(result)
end
end
-function registers.prepare(data)
+function registers.prepare(data,options)
-- data has 'list' table
local strip = sorters.strip
local splitter = sorters.splitters.utf
@@ -839,10 +812,10 @@ function registers.prepare(data)
local split = { }
local list = entry.list
if list then
-if entry.seeword then
- -- we can have multiple seewords, only two levels supported
- list[#list+1] = { seeprefix .. strip(entry.seeword.text) }
-end
+ if entry.seeword then
+ -- we can have multiple seewords, only two levels supported
+ list[#list+1] = { seeprefix .. strip(entry.seeword.text) }
+ end
for l=1,#list do
local ll = list[l]
local word = ll[1]
@@ -856,7 +829,7 @@ end
entry.split = split
end
removeemptyentries(result)
- crosslinkseewords(result)
+ crosslinkseewords(result,options.check ~= v_no)
end
end
@@ -1315,10 +1288,10 @@ function registers.flush(data,options,prefixspec,pagespec)
local function case_4()
local t, nt = { }, 0
while true do
-if entry.seeword and entry.seeword.valid then
- nt = nt + 1
- t[nt] = entry
-end
+ if entry.seeword and entry.seeword.valid then
+ nt = nt + 1
+ t[nt] = entry
+ end
if d == #data then
break
else
@@ -1402,6 +1375,7 @@ implement {
{ "numberorder" },
{ "compress" },
{ "criterium" },
+ { "check" },
{ "pagenumber", "boolean" },
},
{
diff --git a/tex/context/base/mkiv/strc-reg.mkiv b/tex/context/base/mkiv/strc-reg.mkiv
index e5adf5e2f..3f8331745 100644
--- a/tex/context/base/mkiv/strc-reg.mkiv
+++ b/tex/context/base/mkiv/strc-reg.mkiv
@@ -83,6 +83,7 @@
\c!pagestyle=\v!slanted,
\c!indicator=\v!yes,
\c!criterium=\v!all,
+ \c!check=\v!yes, % check for weird see usage
%\c!command=,
\c!referencing=\v!on,
\c!location=\v!middle,
@@ -600,6 +601,7 @@
language {\registerparameter\s!language}%
method {\registerparameter\c!method}%
numberorder {\registerparameter\c!numberorder}%
+ check {\registerparameter\c!check}%
compress {\registerparameter\c!compress}%
criterium {\registerparameter\c!criterium}%
pagenumber \ifx\registerpageseparatorsymbol\empty false\else true\fi
@@ -877,11 +879,15 @@
% \fi}
\unexpanded\def\withregisterpagecommand#1#2#3#4%
- {\def\currentregisterpageindex{#2}%
- \iflocation
- \strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]%
+ {\ifcase#3\relax
+ {\tt [entry\space not\space flushed]}%
\else
- \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}%
+ \def\currentregisterpageindex{#2}%
+ \iflocation
+ \strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]%
+ \else
+ \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}%
+ \fi
\fi}
\unexpanded\def\registeronepage#1#2#3#4% #1:processor content
diff --git a/tex/context/base/mkiv/strc-sec.mkiv b/tex/context/base/mkiv/strc-sec.mkiv
index 82c6d7ea7..e00ee24d0 100644
--- a/tex/context/base/mkiv/strc-sec.mkiv
+++ b/tex/context/base/mkiv/strc-sec.mkiv
@@ -112,6 +112,7 @@
\def\strc_sectioning_autobookmark#1%
{\begingroup
+ % \settrialtypesetting
\the\everypreroll
\nodestostring\tempstring{#1}%
\globallet\currentstructurebookmark\tempstring
diff --git a/tex/context/base/mkiv/strc-tag.mkiv b/tex/context/base/mkiv/strc-tag.mkiv
index f69d75a59..4f7449b93 100644
--- a/tex/context/base/mkiv/strc-tag.mkiv
+++ b/tex/context/base/mkiv/strc-tag.mkiv
@@ -180,6 +180,9 @@
\unexpanded\def\strc_tags_set_aspect_nop#1#2{}
\unexpanded\def\strc_tags_set_aspect_yes#1#2{\clf_settagaspect{#1}{#2}} % todo: ignore when no export / also \let
+\unexpanded\def\ignoretagsinexport[#1]%
+ {\clf_ignoretagsinexport{#1}}
+
\installcorenamespace{tagging}
\installsetuponlycommandhandler \??tagging {tagging}
diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv
index c78a83fd3..f0178f41b 100644
--- a/tex/context/base/mkiv/supp-box.mkiv
+++ b/tex/context/base/mkiv/supp-box.mkiv
@@ -2748,10 +2748,10 @@
\let\naturalvtop \normalvtop
\let\naturalvcenter\normalvtop
-\unexpanded\def\naturalhbox {\hbox dir TLT}
-\unexpanded\def\naturalvbox {\vbox dir TLT}
-\unexpanded\def\naturalhpack {\hpack dir TLT}
-\unexpanded\def\naturalvpack {\vpack dir TLT}
+\unexpanded\def\naturalhbox {\hbox bdir\directionlefttoright}
+\unexpanded\def\naturalvbox {\vbox bdir\directionlefttoright}
+\unexpanded\def\naturalhpack {\hpack bdir\directionlefttoright}
+\unexpanded\def\naturalvpack {\vpack bdir\directionlefttoright}
%D \macros
%D {vcenter}
diff --git a/tex/context/base/mkiv/supp-dir.mkiv b/tex/context/base/mkiv/supp-dir.mkiv
index 42a0aa37c..dfde3d753 100644
--- a/tex/context/base/mkiv/supp-dir.mkiv
+++ b/tex/context/base/mkiv/supp-dir.mkiv
@@ -30,7 +30,17 @@
% \ifnum\thetextdir=0 L\else R\fi \textdir TRT \ifnum\thetextdir=0 L\else R\fi
\unexpanded\def\showdirsinmargin
- {\inleft{\normalexpanded{\noexpand\hbox dir TLT{\ttxx[\the\pardir,\the\textdir]}}}}
+ {\inleft{\normalexpanded{\noexpand\hbox bdir\directionlefttoright{\ttxx[\the\pardir,\the\textdir]}}}}
+
+% this will become:
+
+% \def\syst_direction_string#1{\ifnum#1=\plusone r2l\else l2r\fi}
+%
+% \unexpanded\def\showdirsinmargin
+% {\inleft{\normalexpanded{\noexpand\hbox bdir\directionlefttoright
+% {\ttxx[\syst_direction_string\pardirection,\syst_direction_string\textdirection]}}}}
+
+% will become obsolete:
\bgroup
\catcode`L=\othercatcode \gdef\istltdir#1#2#3{\if#2L0\else1\fi}
@@ -43,8 +53,11 @@
\def\istltpardir {\expandafter\istltdir\the\pardir }
\def\istrtpardir {\expandafter\istrtdir\the\pardir }
-% \ifcase\istlttextdir Y\else N\fi
-% \ifcase\istltpardir Y\else N\fi
-% \ifcase\istltdir TRT\relax Y\else N\fi
+% in 1.10 but obsolete helpers anyway
+
+% \def\istlttextdir{\ifnum\textdirection=\plusone \zerocount\else \plusone \fi}
+% \def\istrttextdir{\ifnum\textdirection=\plusone \plusone \else \zerocount\fi}
+% \def\istltpardir {\ifnum\pardirection =\plusone \zerocount\else \plusone \fi}
+% \def\istrtpardir {\ifnum\pardirection =\plusone \plusone \else \zerocount\fi}
\protect \endinput
diff --git a/tex/context/base/mkiv/typo-dir.mkiv b/tex/context/base/mkiv/typo-dir.mkiv
index d92c93793..d7d3b178d 100644
--- a/tex/context/base/mkiv/typo-dir.mkiv
+++ b/tex/context/base/mkiv/typo-dir.mkiv
@@ -104,8 +104,8 @@
\unexpanded\edef\bidilro{\normalUchar"202D}
\unexpanded\edef\bidirlo{\normalUchar"202E}
-\unexpanded\def\dirlre{\ifcase\directionsbidimode\or\bidilre\or\textdir TLT\fi}
-\unexpanded\def\dirrle{\ifcase\directionsbidimode\or\bidirle\or\textdir TRT\fi}
+\unexpanded\def\dirlre{\ifcase\directionsbidimode\or\bidilre\or\textdirection\directionlefttoright\fi}
+\unexpanded\def\dirrle{\ifcase\directionsbidimode\or\bidirle\or\textdirection\directionrighttoleft\fi}
\unexpanded\def\dirlro{\ifcase\directionsbidimode\or\bidilro\or\setdirection[3]\fi}
\unexpanded\def\dirrlo{\ifcase\directionsbidimode\or\bidirlo\or\setdirection[4]\fi}