summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-08-10 11:36:42 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-08-10 11:36:42 +0200
commit9b0040ddf1cae9296e155906bdb639377aacb7f4 (patch)
tree4ca33e01c3123233cf85c47189e6418fc614f575 /tex/context/base
parent35268d29183ddf3b28ecc224ee7c8edfa7673fb2 (diff)
downloadcontext-9b0040ddf1cae9296e155906bdb639377aacb7f4.tar.gz
2017-08-10 10:51: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/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-ini.mkvi12
-rw-r--r--tex/context/base/mkiv/font-ots.lua257
-rw-r--r--tex/context/base/mkiv/lxml-ini.lua2
-rw-r--r--tex/context/base/mkiv/lxml-tex.lua140
-rw-r--r--tex/context/base/mkiv/lxml-xml.lua4
-rw-r--r--tex/context/base/mkiv/publ-imp-aps.mkvi18
-rw-r--r--tex/context/base/mkiv/publ-imp-cite.mkvi79
-rw-r--r--tex/context/base/mkiv/publ-ini.lua46
-rw-r--r--tex/context/base/mkiv/publ-ini.mkiv32
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25758 -> 25745 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin425919 -> 425934 bytes
15 files changed, 323 insertions, 275 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 1782f0905..8c6744735 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{2017.08.09 15:35}
+\newcontextversion{2017.08.10 10:46}
%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 36313bf62..cb169808a 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{2017.08.09 15:35}
+\edef\contextversion{2017.08.10 10:46}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index e518a7094..59ff7e2ee 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{2017.08.09 15:35}
+\newcontextversion{2017.08.10 10:46}
%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 f6367f228..40444815d 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.08.09 15:35}
+\edef\contextversion{2017.08.10 10:46}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi
index 2697dff2e..c0121c18b 100644
--- a/tex/context/base/mkiv/font-ini.mkvi
+++ b/tex/context/base/mkiv/font-ini.mkvi
@@ -2713,6 +2713,18 @@
\def\saveddefinedfontid {\number\fontid\font}
\def\saveddefinedfontname{\fontname\font}
+%D Ugly helper:
+
+\unexpanded\def\saverunningstyleandcolor
+ {\unexpanded\edef\restorerunningstyleandcolor
+ {\setfontid \number\fontid\font
+ \attribute\colormodelattribute \the\attribute\colormodelattribute
+ \attribute\colorattribute \the\attribute\colorattribute
+ \attribute\transparencyattribute\the\attribute\transparencyattribute
+ \relax}}
+
+\let\restorerunningstyleandcolor\relax
+
%D Handy for defining additional glyphs:
\let\getprivateglyphslot\clf_getprivateglyphslot % kind of private macro
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 43585552b..d8754da32 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -4062,11 +4062,13 @@ otf.handlers = handlers
local setspacekerns = nodes.injections.setspacekerns if not setspacekerns then os.exit() end
+local tag = "kern" -- maybe some day a merge
+
if fontfeatures then
function handlers.trigger_space_kerns(head,dataset,sequence,initialrl,font,attr)
local features = fontfeatures[font]
- local enabled = features and features.spacekern and features.kern
+ local enabled = features and features.spacekern and features[tag]
if enabled then
setspacekerns(font,sequence)
end
@@ -4078,7 +4080,7 @@ else -- generic (no hashes)
function handlers.trigger_space_kerns(head,dataset,sequence,initialrl,font,attr)
local shared = fontdata[font].shared
local features = shared and shared.features
- local enabled = features and features.spacekern and features.kern
+ local enabled = features and features.spacekern and features[tag]
if enabled then
setspacekerns(font,sequence)
end
@@ -4087,22 +4089,62 @@ else -- generic (no hashes)
end
+-- There are fonts out there that change the space but we don't do that kind of
+-- things in TeX.
+
local function hasspacekerns(data)
- local sequences = data.resources.sequences
- for i=1,#sequences do
- local sequence = sequences[i]
- local steps = sequence.steps
- if steps and sequence.features.kern then
- for i=1,#steps do
- local coverage = steps[i].coverage
- if not coverage then
- -- maybe an issue, can't happen
- elseif coverage[32] then
- return true
- else
- for k, v in next, coverage do
- if v[32] then
- return true
+ local resources = data.resources
+ local sequences = resources.sequences
+ local validgpos = resources.features.gpos
+ if validgpos and sequences then
+ for i=1,#sequences do
+ local sequence = sequences[i]
+ local steps = sequence.steps
+ if steps and sequence.features[tag] then
+ local kind = sequence.type
+ if kind == "gpos_pair" or kind == "gpos_single" then
+ for i=1,#steps do
+ local step = steps[i]
+ local coverage = step.coverage
+ local rules = step.rules
+ if rules then
+ -- not now: analyze (simple) rules
+ elseif not coverage then
+ -- nothing to do
+ elseif kind == "gpos_single" then
+ -- maybe a message that we ignore
+ elseif kind == "gpos_pair" then
+ local format = step.format
+ if format == "move" or format == "kern" then
+ local kerns = coverage[32]
+ if kerns then
+ return true
+ end
+ for k, v in next, coverage do
+ if v[32] then
+ return true
+ end
+ end
+ elseif format == "pair" then
+ local kerns = coverage[32]
+ if kerns then
+ for k, v in next, kerns do
+ local one = v[1]
+ if one and one ~= true then
+ return true
+ end
+ end
+ end
+ for k, v in next, coverage do
+ local kern = v[32]
+ if kern then
+ local one = kern[1]
+ if one and one ~= true then
+ return true
+ end
+ end
+ end
+ end
end
end
end
@@ -4119,115 +4161,120 @@ otf.readers.registerextender {
end
}
--- we merge the lookups but we still honor the language / script
-
local function spaceinitializer(tfmdata,value) -- attr
local resources = tfmdata.resources
local spacekerns = resources and resources.spacekerns
- local properties = tfmdata.properties
if value and spacekerns == nil then
+ local rawdata = tfmdata.shared and tfmdata.shared.rawdata
+ local properties = rawdata.properties
if properties and properties.hasspacekerns then
local sequences = resources.sequences
- local left = { }
- local right = { }
- local last = 0
- local feat = nil
- for i=1,#sequences do
- local sequence = sequences[i]
- local steps = sequence.steps
- if steps then
- local kern = sequence.features.kern
- if kern then
- if feat then
- for script, languages in next, kern do
- local f = feat[script]
- if f then
- for l in next, languages do
- f[l] = true
- end
- else
- feat[script] = languages
- end
- end
- else
- feat = kern
- end
- for i=1,#steps do
- local step = steps[i]
- local coverage = step.coverage
- local rules = step.rules
- local format = step.format
- if rules then
- -- not now: analyze (simple) rules
- elseif coverage then
- -- what to do if we have no [1] but only [2]
- local single = format == "gpos_single"
- local kerns = coverage[32]
- if kerns then
- for k, v in next, kerns do
- if type(v) ~= "table" then
- right[k] = v
- elseif single then
- right[k] = v[3]
- else
- local one = v[1]
- if one and one ~= true then
- right[k] = one[3]
+ local validgpos = resources.features.gpos
+ if validgpos and sequences then
+ local left = { }
+ local right = { }
+ local last = 0
+ local feat = nil
+ for i=1,#sequences do
+ local sequence = sequences[i]
+ local steps = sequence.steps
+ if steps then
+ -- we don't support space kerns in other features
+ local kern = sequence.features[tag]
+ if kern then
+ local kind = sequence.type
+ if kind == "gpos_pair" or kind == "gpos_single" then
+ if feat then
+ for script, languages in next, kern do
+ local f = feat[script]
+ if f then
+ for l in next, languages do
+ f[l] = true
end
+ else
+ feat[script] = languages
end
end
+ else
+ feat = kern
end
- for k, v in next, coverage do
- local kern = v[32]
- if kern then
- if type(kern) ~= "table" then
- left[k] = kern
- elseif single then
- left[k] = kern[3]
- else
- local one = kern[1]
- if one and one ~= true then
- left[k] = one[3]
+ for i=1,#steps do
+ local step = steps[i]
+ local coverage = step.coverage
+ local rules = step.rules
+ if rules then
+ -- not now: analyze (simple) rules
+ elseif not coverage then
+ -- nothng to do
+ elseif kind == "gpos_single" then
+ -- makes no sense in TeX
+ elseif kind == "gpos_pair" then
+ local format = step.format
+ if format == "move" or format == "kern" then
+ local kerns = coverage[32]
+ if kerns then
+ for k, v in next, kerns do
+ right[k] = v
+ end
+ end
+ for k, v in next, coverage do
+ local kern = v[32]
+ if kern then
+ left[k] = kern
+ end
+ end
+ elseif format == "pair" then
+ local kerns = coverage[32]
+ if kerns then
+ for k, v in next, kerns do
+ local one = v[1]
+ if one and one ~= true then
+ right[k] = one[3]
+ end
+ end
+ end
+ for k, v in next, coverage do
+ local kern = v[32]
+ if kern then
+ local one = kern[1]
+ if one and one ~= true then
+ left[k] = one[3]
+ end
+ end
end
end
end
end
- else
- -- can't happen
+ last = i
end
+ else
+ -- no steps ... needed for old one ... we could use the basekerns
+ -- instead
end
- last = i
end
- else
- -- no steps ... needed for old one ... we could use the basekerns
- -- instead
end
- end
- left = next(left) and left or false
- right = next(right) and right or false
- if left or right then
- spacekerns = {
- left = left,
- right = right,
- }
- if last > 0 then
- local triggersequence = {
- -- no steps, see (!!)
- features = { kern = feat or { dflt = { dflt = true, } } },
- flags = noflags,
- name = "trigger_space_kerns",
- order = { "kern" },
- type = "trigger_space_kerns",
- left = left,
- right = right,
+ left = next(left) and left or false
+ right = next(right) and right or false
+ if left or right then
+ spacekerns = {
+ left = left,
+ right = right,
}
- insert(sequences,last,triggersequence)
+ if last > 0 then
+ local triggersequence = {
+ -- no steps, see (!!)
+ features = { [tag] = feat or { dflt = { dflt = true, } } },
+ flags = noflags,
+ name = "trigger_space_kerns",
+ order = { tag },
+ type = "trigger_space_kerns",
+ left = left,
+ right = right,
+ }
+ insert(sequences,last,triggersequence)
+ end
end
- else
- spacekerns = false
end
- else
- spacekerns = false
end
resources.spacekerns = spacekerns
end
diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua
index 86d113f7c..09a13eb5c 100644
--- a/tex/context/base/mkiv/lxml-ini.lua
+++ b/tex/context/base/mkiv/lxml-ini.lua
@@ -110,7 +110,7 @@ implement { name = "xmlpure", actions = lxml.pure, arg
implement { name = "xmlflushtext", actions = lxml.text, arguments = "string" }
implement { name = "xmlflushpure", actions = lxml.pure, arguments = "string" }
implement { name = "xmltobuffer", actions = lxml.tobuffer, arguments = { "string", "string", "string" } }
-implement { name = "xmltobufferverbose", actions = lxml.tobuffer, arguments = { "string", "string", "string", true } }
+implement { name = "xmltobufferverbose", actions = lxml.tobuffer, arguments = { "string", "string", "string", true, true } }
implement { name = "xmltobuffertextonly", actions = lxml.tobuffer, arguments = { "string", "string", "string", false } }
implement { name = "xmltofile", actions = lxml.tofile, arguments = { "string", "string", "string" } }
implement { name = "xmltoparameters", actions = lxml.toparameters, arguments = "string" }
diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua
index f23919801..cfebee650 100644
--- a/tex/context/base/mkiv/lxml-tex.lua
+++ b/tex/context/base/mkiv/lxml-tex.lua
@@ -26,71 +26,72 @@ local basename, dirname, joinfile = file.basename, file.dirname, file.join
lxml = lxml or { }
local lxml = lxml
-local catcodenumbers = catcodes.numbers
-local ctxcatcodes = catcodenumbers.ctxcatcodes -- todo: use different method
-local notcatcodes = catcodenumbers.notcatcodes -- todo: use different method
-
-local commands = commands
-local context = context
-local contextsprint = context.sprint -- with catcodes (here we use fast variants, but with option for tracing)
-
-local synctex = luatex.synctex
-
-local implement = interfaces.implement
-
-local xmlelements = xml.elements
-local xmlcollected = xml.collected
-local xmlsetproperty = xml.setproperty
-local xmlwithelements = xml.withelements
-local xmlserialize = xml.serialize
-local xmlcollect = xml.collect
-local xmltext = xml.text
-local xmltostring = xml.tostring
-local xmlapplylpath = xml.applylpath
-local xmlunspecialized = xml.unspecialized
-local xmldespecialized = xml.despecialized -- nicer in expanded xml
-local xmlprivatetoken = xml.privatetoken
-local xmlstripelement = xml.stripelement
-local xmlinclusion = xml.inclusion
-local xmlinclusions = xml.inclusions
-local xmlbadinclusions = xml.badinclusions
-local xmlcontent = xml.content
-local xmllastmatch = xml.lastmatch
-local xmlpushmatch = xml.pushmatch
-local xmlpopmatch = xml.popmatch
-local xmlstring = xml.string
+local catcodenumbers = catcodes.numbers
+local ctxcatcodes = catcodenumbers.ctxcatcodes -- todo: use different method
+local notcatcodes = catcodenumbers.notcatcodes -- todo: use different method
+
+local commands = commands
+local context = context
+local contextsprint = context.sprint -- with catcodes (here we use fast variants, but with option for tracing)
+
+local synctex = luatex.synctex
+
+local implement = interfaces.implement
+
+local xmlelements = xml.elements
+local xmlcollected = xml.collected
+local xmlsetproperty = xml.setproperty
+local xmlwithelements = xml.withelements
+local xmlserialize = xml.serialize
+local xmlcollect = xml.collect
+local xmltext = xml.text
+local xmltostring = xml.tostring
+local xmlapplylpath = xml.applylpath
+local xmlunspecialized = xml.unspecialized
+local xmldespecialized = xml.despecialized -- nicer in expanded xml
+local xmlprivatetoken = xml.privatetoken
+local xmlstripelement = xml.stripelement
+local xmlinclusion = xml.inclusion
+local xmlinclusions = xml.inclusions
+local xmlbadinclusions = xml.badinclusions
+local xmlcontent = xml.content
+local xmllastmatch = xml.lastmatch
+local xmlpushmatch = xml.pushmatch
+local xmlpopmatch = xml.popmatch
+local xmlstring = xml.string
+local xmlserializetotext = xml.serializetotext
+
+local variables = interfaces and interfaces.variables or { }
+
+local settings_to_hash = utilities.parsers.settings_to_hash
+local settings_to_set = utilities.parsers.settings_to_set
+local options_to_hash = utilities.parsers.options_to_hash
+local options_to_array = utilities.parsers.options_to_array
+
+local insertbeforevalue = utilities.tables.insertbeforevalue
+local insertaftervalue = utilities.tables.insertaftervalue
+
+local resolveprefix = resolvers.resolve
+
+local starttiming = statistics.starttiming
+local stoptiming = statistics.stoptiming
+
+local trace_setups = false trackers.register("lxml.setups", function(v) trace_setups = v end)
+local trace_loading = false trackers.register("lxml.loading", function(v) trace_loading = v end)
+local trace_access = false trackers.register("lxml.access", function(v) trace_access = v end)
+local trace_comments = false trackers.register("lxml.comments", function(v) trace_comments = v end)
+local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end)
+local trace_selectors = false trackers.register("lxml.selectors",function(v) trace_selectors = v end)
+
+local report_lxml = logs.reporter("lxml","tex")
+local report_xml = logs.reporter("xml","tex")
+
+local forceraw = false
+
+local p_texescape = patterns.texescape
directives.enable("xml.path.keeplastmatch")
-local variables = interfaces and interfaces.variables or { }
-
-local settings_to_hash = utilities.parsers.settings_to_hash
-local settings_to_set = utilities.parsers.settings_to_set
-local options_to_hash = utilities.parsers.options_to_hash
-local options_to_array = utilities.parsers.options_to_array
-
-local insertbeforevalue = utilities.tables.insertbeforevalue
-local insertaftervalue = utilities.tables.insertaftervalue
-
-local resolveprefix = resolvers.resolve
-
-local starttiming = statistics.starttiming
-local stoptiming = statistics.stoptiming
-
-local trace_setups = false trackers.register("lxml.setups", function(v) trace_setups = v end)
-local trace_loading = false trackers.register("lxml.loading", function(v) trace_loading = v end)
-local trace_access = false trackers.register("lxml.access", function(v) trace_access = v end)
-local trace_comments = false trackers.register("lxml.comments", function(v) trace_comments = v end)
-local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end)
-local trace_selectors = false trackers.register("lxml.selectors",function(v) trace_selectors = v end)
-
-local report_lxml = logs.reporter("lxml","tex")
-local report_xml = logs.reporter("xml","tex")
-
-local forceraw = false
-
-local p_texescape = patterns.texescape
-
-- tex entities
lxml.entities = lxml.entities or { }
@@ -2237,17 +2238,23 @@ end
texfinalizers.upperall = xmlfinalizers.upperall
texfinalizers.lowerall = xmlfinalizers.lowerall
-function lxml.tobuffer(id,pattern,name,unescaped)
+function lxml.tobuffer(id,pattern,name,unescaped,contentonly)
local collected = xmlapplylpath(getid(id),pattern)
if collected then
+ local collected = collected[1]
if unescaped == true then
- collected = xmlcontent(collected[1]) -- expanded entities !
+ -- expanded entities !
+ if contentonly then
+ collected = xmlserializetotext(collected.dt)
+ else
+ collected = xmlcontent(collected)
+ end
elseif unescaped == false then
local t = { }
- xmlstring(collected[1],function(s) t[#t+1] = s end)
+ xmlstring(collected,function(s) t[#t+1] = s end)
collected = concat(t)
else
- collected = tostring(collected[1])
+ collected = tostring(collected)
end
buffers.assign(name,collected)
else
@@ -2255,6 +2262,7 @@ function lxml.tobuffer(id,pattern,name,unescaped)
end
end
+
-- relatively new:
local permitted = nil
diff --git a/tex/context/base/mkiv/lxml-xml.lua b/tex/context/base/mkiv/lxml-xml.lua
index 6ec353310..62564337c 100644
--- a/tex/context/base/mkiv/lxml-xml.lua
+++ b/tex/context/base/mkiv/lxml-xml.lua
@@ -162,6 +162,10 @@ local function xmltotext(root)
end
end
+function xml.serializetotext(root)
+ return root and xmlserialize(root,xmltexthandler) or ""
+end
+
--
local function text(collected) -- hybrid
diff --git a/tex/context/base/mkiv/publ-imp-aps.mkvi b/tex/context/base/mkiv/publ-imp-aps.mkvi
index 4b810672e..90d418ca0 100644
--- a/tex/context/base/mkiv/publ-imp-aps.mkvi
+++ b/tex/context/base/mkiv/publ-imp-aps.mkvi
@@ -1036,20 +1036,14 @@
\texdefinition{btx:aps:author}
\texdefinition{btx:aps:title}
\btxdoif {organization} {
- \btxspace
- \btxflush{organization}
- \btxcomma
+ \doifnot {\btxfoundname{author}} {organization} {
+ \btxspace
+ \btxflush{organization}
+ \btxcomma
+ }
}
- \btxdoifelse {howpublished} {
+ \btxdoif {howpublished} {
\texdefinition{btx:aps:doi-url} {\btxspace\btxflush{howpublished}}
- } {
- \btxdoifelse {doi} {
- \texdefinition{btx:aps:doi-url} {\btxspace\btxflush{doi}}
- } {
- \btxdoif {url} {
- \texdefinition{btx:aps:doi-url} {\btxspace\btxflush{url}}
- }
- }
}
\btxleftparenthesis
\texdefinition{btx:aps:year}
diff --git a/tex/context/base/mkiv/publ-imp-cite.mkvi b/tex/context/base/mkiv/publ-imp-cite.mkvi
index be23326b8..a9b681d33 100644
--- a/tex/context/base/mkiv/publ-imp-cite.mkvi
+++ b/tex/context/base/mkiv/publ-imp-cite.mkvi
@@ -62,23 +62,25 @@
\stopsetups
\startsetups btx:cite:lefttext
- \ifx\currentbtxlefttext\empty
- \else
- \setbtxparameterset{\s!cite}{lefttext}
- \btxparameter\c!left
- \currentbtxlefttext
- \btxparameter\c!right
+ \ifx\currentbtxlefttext\empty \else
+ \startbtxrunningstyleandcolor
+ \setbtxparameterset{\s!cite}{lefttext}
+ \btxparameter\c!left
+ \currentbtxlefttext
+ \btxparameter\c!right
+ \stopbtxrunningstyleandcolor
\fi
\stopsetups
\startsetups btx:cite:righttext
- \ifx\currentbtxrighttext\empty
- \else
- \setbtxparameterset{\s!cite}{righttext}
- \btxparameter\c!left
- \currentbtxrighttext
- \btxparameter\c!right
- \fi
+ \ifx\currentbtxrighttext\empty \else
+ \startbtxrunningstyleandcolor
+ \setbtxparameterset{\s!cite}{righttext}
+ \btxparameter\c!left
+ \currentbtxrighttext
+ \btxparameter\c!right
+ \stopbtxrunningstyleandcolor
+ \fi
\stopsetups
\startsetups btx:cite:invalid
@@ -93,37 +95,8 @@
% when we have an author-year combination, the first and seconds is not
% fields data but something more complex (that itself calls for a setup)
-% \startsetups btx:cite:normal
-% \texdefinition{\s!btx:\s!cite:concat}
-% \currentbtxlefttext
-% \ifx\currentbtxfirst\empty
-% \fastsetup{\s!btx:\s!cite:\s!empty}
-% \else
-% \texdefinition {\s!btx:\s!cite:inject} {
-% \btxcitereference
-% \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
-% \currentbtxfirst
-% }
-% }
-% \ifx\currentbtxsecond\empty
-% \btxflushsuffix
-% \else
-% \btxparameter\c!inbetween
-% \texdefinition {\s!btx:\s!cite:inject} {
-% \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
-% \currentbtxsecond
-% }
-% }
-% % quite likely an error
-% \btxflushsuffix
-% \fi
-% \fi
-% \currentbtxrighttext
-% \stopsetups
-
\startsetups btx:cite:normal
\texdefinition{\s!btx:\s!cite:concat}
- %\currentbtxlefttext
\fastsetup{\s!btx:\s!cite:lefttext}
\ifx\currentbtxfirst\empty
\fastsetup{\s!btx:\s!cite:\s!empty}
@@ -136,21 +109,6 @@
}
}
\else
- % \texdefinition {\s!btx:\s!cite:inject} {
- % \btxcitereference
- % \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
- % \currentbtxfirst
- % }
- % }
- % \btxparameter\c!inbetween
- % \texdefinition {\s!btx:\s!cite:inject} {
- % \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
- % \currentbtxsecond
- % }
- % }
- % \btxflushsuffix
- %
- % probably better:
\texdefinition {\s!btx:\s!cite:inject} {
\btxcitereference
\btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] {
@@ -161,13 +119,11 @@
}
}
\fi\fi
- %\currentbtxrighttext
\fastsetup{\s!btx:\s!cite:righttext}
\stopsetups
\startsetups btx:cite:range
\texdefinition{\s!btx:\s!cite:concat}
- %\currentbtxlefttext
\fastsetup{\s!btx:\s!cite:lefttext}
\ifx\currentbtxfirst\empty
\fastsetup{\s!btx:\s!cite:\s!empty}
@@ -184,7 +140,6 @@
}
}
\fi
- %\currentbtxrighttext
\fastsetup{\s!btx:\s!cite:righttext}
\stopsetups
@@ -192,7 +147,6 @@
\startsetups btx:cite:listelement
\texdefinition{\s!btx:\s!cite:concat}
- %\currentbtxlefttext
\fastsetup{\s!btx:\s!cite:lefttext}
\ifx\currentbtxfirst\empty
\fastsetup{\s!btx:\s!cite:\s!empty}
@@ -202,16 +156,13 @@
\currentbtxfirst
}
\fi
- %\currentbtxrighttext
\fastsetup{\s!btx:\s!cite:righttext}
\stopsetups
\startsetups \s!btx:\s!cite:entry
\texdefinition{\s!btx:\s!cite:concat}
- %\currentbtxlefttext
\fastsetup{\s!btx:\s!cite:lefttext}
\btxhandleciteentry
- %\currentbtxrighttext
\fastsetup{\s!btx:\s!cite:righttext}
\stopsetups
diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua
index 57aaa2bbf..3c0b1678c 100644
--- a/tex/context/base/mkiv/publ-ini.lua
+++ b/tex/context/base/mkiv/publ-ini.lua
@@ -121,10 +121,6 @@ local ctx_btxsetnumber = context.btxsetnumber
local ctx_btxsetlanguage = context.btxsetlanguage
local ctx_btxsetcombis = context.btxsetcombis
local ctx_btxsetcategory = context.btxsetcategory
-local ctx_btxcitesetup = context.btxcitesetup
-local ctx_btxsubcitesetup = context.btxsubcitesetup
-local ctx_btxnumberingsetup = context.btxnumberingsetup
-local ctx_btxpagesetup = context.btxpagesetup
local ctx_btxsetfirst = context.btxsetfirst
local ctx_btxsetsecond = context.btxsetsecond
local ctx_btxsetsuffix = context.btxsetsuffix
@@ -134,12 +130,30 @@ local ctx_btxsetrighttext = context.btxsetrighttext
local ctx_btxsetbefore = context.btxsetbefore
local ctx_btxsetafter = context.btxsetafter
local ctx_btxsetbacklink = context.btxsetbacklink
-local ctx_btxsetcount = context.btxsetcount
-local ctx_btxsetconcat = context.btxsetconcat
-local ctx_btxsetfirstpage = context.btxsetfirstpage
-local ctx_btxsetlastpage = context.btxsetlastpage
local ctx_btxsetfirstinternal = context.btxsetfirstinternal
local ctx_btxsetlastinternal = context.btxsetlastinternal
+
+-- local ctx_btxsetdataset = function(s) setmacro("currentbtxdataset", s) end -- context.btxsetdataset
+-- local ctx_btxsettag = function(s) setmacro("currentbtxtag", s) end -- context.btxsettag
+-- local ctx_btxsetnumber = function(s) setmacro("currentbtxnumber", s) end -- context.btxsetnumber
+-- local ctx_btxsetlanguage = function(s) setmacro("currentbtxlanguage", s) end -- context.btxsetlanguage
+-- local ctx_btxsetcombis = function(s) setmacro("currentbtxcombis", s) end -- context.btxsetcombis
+-- local ctx_btxsetcategory = function(s) setmacro("currentbtxcategory", s) end -- context.btxsetcategory
+-- local ctx_btxsetfirst = function(s) setmacro("currentbtxfirst", s) end -- context.btxsetfirst
+-- local ctx_btxsetsecond = function(s) setmacro("currentbtxsecond", s) end -- context.btxsetsecond
+-- local ctx_btxsetsuffix = function(s) setmacro("currentbtxsuffix", s) end -- context.btxsetsuffix
+-- local ctx_btxsetinternal = function(s) setmacro("currentbtxinternal", s) end -- context.btxsetinternal
+-- local ctx_btxsetlefttext = function(s) setmacro("currentbtxlefttext", s) end -- context.btxsetlefttext
+-- local ctx_btxsetrighttext = function(s) setmacro("currentbtxrighttext", s) end -- context.btxsetrighttext
+-- local ctx_btxsetbefore = function(s) setmacro("currentbtxbefore", s) end -- context.btxsetbefore
+-- local ctx_btxsetafter = function(s) setmacro("currentbtxafter", s) end -- context.btxsetafter
+-- local ctx_btxsetbacklink = function(s) setmacro("currentbtxbacklink", s) end -- context.btxsetbacklink
+-- local ctx_btxsetfirstinternal = function(s) setmacro("currentbtxfirstinternal", s) end -- context.btxsetfirstinternal
+-- local ctx_btxsetlastinternal = function(s) setmacro("currentbtxlastinternal", s) end -- context.btxsetlastinternal
+
+local ctx_btxsetfirstpage = context.btxsetfirstpage
+local ctx_btxsetlastpage = context.btxsetlastpage
+
local ctx_btxstartcite = context.btxstartcite
local ctx_btxstopcite = context.btxstopcite
local ctx_btxstartciteauthor = context.btxstartciteauthor
@@ -150,12 +164,22 @@ local ctx_btxstartlistentry = context.btxstartlistentry
local ctx_btxstoplistentry = context.btxstoplistentry
local ctx_btxstartcombientry = context.btxstartcombientry
local ctx_btxstopcombientry = context.btxstopcombientry
-local ctx_btxlistsetup = context.btxlistsetup
+
local ctx_btxflushauthor = context.btxflushauthor
+
local ctx_btxsetnoflistentries = context.btxsetnoflistentries
local ctx_btxsetcurrentlistentry = context.btxsetcurrentlistentry
local ctx_btxsetcurrentlistindex = context.btxsetcurrentlistindex
+local ctx_btxsetcount = context.btxsetcount
+local ctx_btxsetconcat = context.btxsetconcat
+
+local ctx_btxcitesetup = context.btxcitesetup
+local ctx_btxsubcitesetup = context.btxsubcitesetup
+local ctx_btxnumberingsetup = context.btxnumberingsetup
+local ctx_btxpagesetup = context.btxpagesetup
+local ctx_btxlistsetup = context.btxlistsetup
+
local trialtypesetting = context.trialtypesetting
languages.data = languages.data or { }
@@ -2453,7 +2477,7 @@ do
for i=1,#source do
local entry = source[i]
local current = entry.sortkey -- so we need a sortkey !
- if type(sortkey) == "number" then
+ if type(current) == "number" then
if entry.suffix then
if not first then
first, last, firstr, lastr = current, current, entry, entry
@@ -3099,8 +3123,6 @@ do
local partialinteractive = false
local function authorgetter(first,last,key,specification) -- only first
- -- ctx_btxsetfirst(first.author) -- unformatted
- -- ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower)
if first.type == "author" then
ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower)
else
diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv
index a1c76464a..5e467177b 100644
--- a/tex/context/base/mkiv/publ-ini.mkiv
+++ b/tex/context/base/mkiv/publ-ini.mkiv
@@ -428,13 +428,15 @@
\let\currentbtxlanguage \empty \unexpanded\def\btxsetlanguage {\def\currentbtxlanguage}
\let\currentbtxtag \empty \unexpanded\def\btxsettag {\def\currentbtxtag}
\let\currentbtxnumber \empty \unexpanded\def\btxsetnumber {\def\currentbtxnumber}
-\let\currentbtxauthorvariant\v!normal \unexpanded\def\btxsetauthorvariant{\def\currentbtxauthorvariant}
+\let\currentbtxfirstinternal\empty \unexpanded\def\btxsetfirstinternal{\def\currentbtxfirstinternal}
+\let\currentbtxlastinternal \empty \unexpanded\def\btxsetlastinternal {\def\currentbtxlastinternal}
-\let\currentbtxfirstnames \empty \unexpanded\def\btxsetfirstnames{\let\currentbtxfirstnames\currentbtxfirstnames_indeed}
-\let\currentbtxinitials \empty \unexpanded\def\btxsetinitials {\let\currentbtxinitials \currentbtxinitials_indeed }
-\let\currentbtxjuniors \empty \unexpanded\def\btxsetjuniors {\let\currentbtxjuniors \currentbtxjuniors_indeed }
-\let\currentbtxsurnames \empty \unexpanded\def\btxsetsurnames {\let\currentbtxsurnames \currentbtxsurnames_indeed }
-\let\currentbtxvons \empty \unexpanded\def\btxsetvons {\let\currentbtxvons \currentbtxvons_indeed }
+\let\currentbtxauthorvariant\v!normal \unexpanded\def\btxsetauthorvariant{\def\currentbtxauthorvariant}
+\let\currentbtxfirstnames \empty \unexpanded\def\btxsetfirstnames {\let\currentbtxfirstnames\currentbtxfirstnames_indeed}
+\let\currentbtxinitials \empty \unexpanded\def\btxsetinitials {\let\currentbtxinitials \currentbtxinitials_indeed }
+\let\currentbtxjuniors \empty \unexpanded\def\btxsetjuniors {\let\currentbtxjuniors \currentbtxjuniors_indeed }
+\let\currentbtxsurnames \empty \unexpanded\def\btxsetsurnames {\let\currentbtxsurnames \currentbtxsurnames_indeed }
+\let\currentbtxvons \empty \unexpanded\def\btxsetvons {\let\currentbtxvons \currentbtxvons_indeed }
\newconstant\currentbtxoverflow \unexpanded\def\btxsetoverflow #1{\currentbtxoverflow #1\relax}
\newconstant\currentbtxconcat \unexpanded\def\btxsetconcat #1{\currentbtxconcat #1\relax}
@@ -449,10 +451,8 @@
\unexpanded\def\currentbtxsurnames_indeed {\clf_btxcurrentsurnames \numexpr\currentbtxauthorindex\relax}
\unexpanded\def\currentbtxvons_indeed {\clf_btxcurrentvons \numexpr\currentbtxauthorindex\relax}
-\let\currentbtxfirstpage \empty \unexpanded\def\btxsetfirstpage #1{\def\currentbtxfirstpage{\btx_page_number{#1}}}
-\let\currentbtxlastpage \empty \unexpanded\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}}
-\let\currentbtxfirstinternal\empty \unexpanded\def\btxsetfirstinternal {\def\currentbtxfirstinternal}
-\let\currentbtxlastinternal \empty \unexpanded\def\btxsetlastinternal {\def\currentbtxlastinternal}
+\let\currentbtxfirstpage \empty \unexpanded\def\btxsetfirstpage#1{\def\currentbtxfirstpage{\btx_page_number{#1}}}
+\let\currentbtxlastpage \empty \unexpanded\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}}
\def\currentbtxauthorvariant{normal}
@@ -917,7 +917,7 @@
\unexpanded\def\btx_reference_indeed
{\begingroup
- % redundantm will go away:
+ % redundant will go away:
\setbtxparameterset{\c!list:\s!numbering}\currentbtxnumbering
%
\ifx\currentbtxnumbering\empty
@@ -1336,6 +1336,7 @@
\def\publ_cite_handle_variant_indeed[#1]%
{\letbtxparameter\c!alternative\currentbtxcitealternative
\edef\currentbtxreference{#1}%
+ \saverunningstyleandcolor
\usebtxstyleandcolor\c!style\c!color
\uselanguageparameter\btxdatasetparameter % new
\btxparameter\c!left
@@ -1557,6 +1558,7 @@
\unexpanded\def\btxstartsubcite#1%
{\begingroup
\btx_reset_cite % todo: limited set
+ % \saverunningstyleandcolor % let's see when Alan needs it
\def\currentbtxcitealternative{#1}%
\setbtxparameterset\s!cite\currentbtxcitealternative
\usebtxstyleandcolor\c!style\c!color
@@ -1789,6 +1791,14 @@
\unexpanded\def\btxusecommand[#1]#2% using #2 permits space after []
{\namedbtxparameter{#1}\c!command{#2}}
+\unexpanded\def\startbtxrunningstyleandcolor
+ {\dontleavehmode
+ \begingroup
+ \restorerunningstyleandcolor}
+
+\unexpanded\def\stopbtxrunningstyleandcolor
+ {\endgroup}
+
%D Defaults:
\setupbtxrendering
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index e820737c7..078a735e5 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 76ebe0c1b..8477f929b 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ