summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-09 15:15:04 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-09 15:15:04 +0100
commit19cbb867e30cd14ade5a9057965fdd76314e0cdb (patch)
treed79d8ddd837d48bad50ed85e29ff12872cbb8ffe
parentaaa042657b0db7d12dd6bfc38513b39eec676663 (diff)
downloadcontext-19cbb867e30cd14ade5a9057965fdd76314e0cdb.tar.gz
2014-11-09 15:07:00
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4388 -> 4390 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/publ-imp-apa.lua6
-rw-r--r--tex/context/base/publ-imp-apa.mkvi18
-rw-r--r--tex/context/base/publ-ini.lua84
-rw-r--r--tex/context/base/publ-ini.mkiv36
-rw-r--r--tex/context/base/publ-tra.lua67
-rw-r--r--tex/context/base/status-files.pdfbin24702 -> 24682 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin333340 -> 343700 bytes
-rw-r--r--tex/context/base/strc-lst.lua30
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
12 files changed, 123 insertions, 124 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 92008447f..2abacf632 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2014.11.08 15:07}
+\newcontextversion{2014.11.09 15:05}
%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/context-version.pdf b/tex/context/base/context-version.pdf
index 4e042b2ad..a67ff0afa 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 33c53cc64..5e17054a8 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2014.11.08 15:07}
+\edef\contextversion{2014.11.09 15:05}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua
index 3ee5a732e..37566cd94 100644
--- a/tex/context/base/publ-imp-apa.lua
+++ b/tex/context/base/publ-imp-apa.lua
@@ -11,7 +11,11 @@ local specification = {
-- derived (combinations of) fields (all share the same default set)
--
virtual = {
- "authoryear", "authoryears", "authornum", "num", "suffix",
+ "authoryear",
+ "authoryears",
+ "authornum",
+ "num",
+ "suffix",
},
--
-- special datatypes
diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi
index 95682a12e..1903b319b 100644
--- a/tex/context/base/publ-imp-apa.mkvi
+++ b/tex/context/base/publ-imp-apa.mkvi
@@ -10,7 +10,7 @@
%C This module is part of the \CONTEXT\ macro||package and is therefore copyrighted
%D by \PRAGMA. See mreadme.pdf for details.
-% Hans: what does the below mean? Just some wrapper (possible tracing and so)
+% Hans: what does the below mean? Just some wrapper (possible tracing and so)
% \loadbtxdefinitionfile[def]
%D Instead of texdefinitions without arguments, we could have used setups but in my
@@ -48,7 +48,7 @@
\c!lastnamesep={,\nobreakspace\textampersand\space},
\c!finalnamesep={,\nobreakspace\textampersand\space},
\c!firstnamesep=\space,
- \c!otherstext={\space\btxlabeltext{\currentbtxalternative:others}},
+ \c!otherstext={\space\btxlabeltext{\currentbtxspecification:others}},
\c!juniorsep=\space,
\c!vonsep=\space,
\c!initialsep=\space, % between initials and lastname
@@ -78,7 +78,7 @@
\c!lastnamesep={,\nobreakspace\textampersand\space},
\c!finalnamesep={\nobreakspace\textampersand\space}, % no comma!
\c!firstnamesep=\space,
- \c!otherstext={\space\btxlabeltext{\currentbtxalternative:others}},
+ \c!otherstext={\space\btxlabeltext{\currentbtxspecification:others}},
\c!juniorsep=\space,
\c!vonsep=\space,
\c!initialsep=\space,
@@ -95,8 +95,8 @@
% \c!setups=btx:cite:initialize,
\c!alternative=num,
\c!pubsep={,\space},
- \c!lastpubsep={\space\btxlabeltext{\currentbtxalternative:and}\space},
- \c!finalpubsep={\space\btxlabeltext{\currentbtxalternative:and}\space},
+ \c!lastpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
+ \c!finalpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
\c!sorttype=,
\c!compress=\v!no,
\c!inbetween=\space,
@@ -120,8 +120,8 @@
\c!pubsep={;\space},
\c!lastpubsep={;\space},
\c!finalpubsep={;\space},
- \c!lastnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space},
- \c!finalnamesep={\space\btxlabeltext{\currentbtxalternative:and}\space}, % no comma!
+ \c!lastnamesep={,\space\btxlabeltext{\currentbtxspecification:and}\space},
+ \c!finalnamesep={\space\btxlabeltext{\currentbtxspecification:and}\space}, % no comma!
\c!authorconversion=\v!name]
\definebtxcitevariant
@@ -132,8 +132,8 @@
\c!pubsep={);\space},
\c!lastpubsep={);\space},
\c!finalpubsep={);\space},
- \c!lastnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space},
- \c!finalnamesep={\space\btxlabeltext{\currentbtxalternative:and}\space}, % no comma!
+ \c!lastnamesep={,\space\btxlabeltext{\currentbtxspecification:and}\space},
+ \c!finalnamesep={\space\btxlabeltext{\currentbtxspecification:and}\space}, % no comma!
\c!authorconversion=\v!name]
% Should the following be loaded by default?
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index 0f41275a0..ea2bf4519 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -147,6 +147,20 @@ local ctx_btxstartsubcite = context.btxstartsubcite
local ctx_btxstopsubcite = context.btxstopsubcite
local ctx_btxlistsetup = context.btxlistsetup
+local registeredcitevariants = publications.registeredcitevariants or allocate()
+local registeredlistvariants = publications.registeredlistvariants or allocate()
+
+storage.register("publications/registeredcitevariants", registeredcitevariants,"publications.registeredcitevariants")
+storage.register("publications/registeredlistvariants", registeredlistvariants,"publications.registeredlistvariants")
+
+function commands.registerbtxcitevariant(name,parent)
+ registeredcitevariants[name] = parent or ""
+end
+
+function commands.registerbtxlistvariant(name,parent)
+ registeredlistvariants[name] = parent or ""
+end
+
local specifications = publications.specifications
local currentspecification = specifications[false]
local currentspecificationfields = currentspecification.fields
@@ -158,6 +172,9 @@ local function setspecification(name)
currentspecification = specifications[name]
currentspecificationfields = currentspecification.fields
currentspecificationcategories = currentspecification.categories
+ if trace then
+ report("setting specification %a",type(name) == "string" and name or "anything")
+ end
end
publications.setspecification = setspecification
@@ -1752,7 +1769,7 @@ publications.citevariants = citevariants
function commands.btxhandlecite(specification)
local dataset = specification.dataset or "" -- standard
local reference = specification.reference
- local variant = specification.variant or "num"
+ local variant = specification.variant or defaultvariant
if not reference or reference == "" then
return
end
@@ -1937,6 +1954,7 @@ local function processcite(presets,specification)
local setter = specification.setter
local compressor = specification.compressor
--
+
local reference = publications.parenttag(dataset,reference)
--
local found, todo, list = findallused(dataset,reference,internal)
@@ -1950,8 +1968,8 @@ local function processcite(presets,specification)
local entry = found[i]
local tag = entry.userdata.btxref
-- we can probably move the test into the flush
- local category = luadata[tag].category
- if currentspecificationfields[category][setup] then
+ -- local category = luadata[tag].category
+ -- if currentspecificationfields[category][setup] then
local internal = entry.references.internal
local data = setter(dataset,tag,entry,internal)
if compress and not compressor then
@@ -1972,9 +1990,9 @@ local function processcite(presets,specification)
else
report("error in cite rendering %a",setup or "?")
end
- else
- report("cite rendering %a is not available for %a",setup,category)
- end
+ -- else
+ -- report("cite rendering %a is not available for %a",setup,category)
+ -- end
end
local lefttext = specification.lefttext
@@ -2089,15 +2107,29 @@ end)
-- todo: just a sort key and then fetch normal by fieldname
--- default
+-- setmetatableindex(citevariants,function(t,k)
+-- local p = registeredcitevariants[k]
+-- local v = p and p ~= k and rawget(t,p) or defaultvariant
+-- t[k] = v
+-- return v
+-- end)
setmetatableindex(citevariants,function(t,k)
- local v = t.default
+ local p = registeredcitevariants[k]
+ local v = nil
+ if p and p ~= "" then
+ v = rawget(t,p)
+ end
+ if not v then
+ p = defaultvariant or "default"
+ v = rawget(t,p)
+ end
+ report_cite("variant %a falls back on %a",k,p)
t[k] = v
return v
end)
-function citevariants.default(presets)
+function citevariants.default(presets) -- no longer used
local variant = presets.variant
processcite(presets,{
setter = setters[variant],
@@ -2123,7 +2155,7 @@ do
function citevariants.entry(presets)
processcite(presets,{
compress = false,
- variant = "entry",
+ -- variant = presets.variant or "entry",
setter = setter,
getter = getter,
})
@@ -2160,7 +2192,7 @@ do
function citevariants.short(presets)
processcite(presets,{
compress = false,
- variant = "short",
+ -- variant = presets.variant or "short",
setter = setter,
getter = getter,
})
@@ -2196,7 +2228,7 @@ do
function citevariants.page(presets)
processcite(presets,{
- variant = "page",
+ -- variant = presets.variant or "page",
setter = setter,
getter = getter,
})
@@ -2225,7 +2257,7 @@ do
function citevariants.num(presets)
processcite(presets,{
- variant = "num",
+ -- variant = presets.variant or "num",
setter = setter,
getter = getter,
})
@@ -2254,7 +2286,7 @@ do
function citevariants.year(presets)
processcite(presets,{
- variant = "year",
+ -- variant = presets.variant or "year",
setter = setter,
getter = getter,
})
@@ -2283,7 +2315,7 @@ do
function citevariants.index(presets)
processcite(presets,{
- variant = "index",
+ -- variant = presets.variant or "index",
setter = setter,
getter = getter,
})
@@ -2291,7 +2323,7 @@ do
function citevariants.serial(presets)
processcite(presets,{
- variant = "serial",
+ -- variant = presets.variant or "serial",
setter = setter,
getter = getter,
})
@@ -2318,7 +2350,7 @@ do
function citevariants.category(presets)
processcite(presets,{
- variant = "serial",
+ -- variant = presets.variant or "serial",
setter = setter,
getter = getter,
})
@@ -2326,7 +2358,7 @@ do
function citevariants.type(presets)
processcite(presets,{
- variant = "type",
+ -- variant = presets.variant or "type",
setter = setter,
getter = getter,
})
@@ -2663,19 +2695,3 @@ function listvariants.page(dataset,block,tag,variant,listindex)
end
end
end
-
--- tracers
-
-local citevariants = tracers.citevariants or allocate()
-local listvariants = tracers.listvariants or allocate()
-
-storage.register("publications/tracers/citevariants", citevariants,"publications.tracers.citevariants")
-storage.register("publications/tracers/listvariants", listvariants,"publications.tracers.listvariants")
-
-function commands.registerbtxcitevariant(name,parent)
- citevariants[name] = parent or ""
-end
-
-function commands.registerbtxlistvariant(name,parent)
- listvariants[name] = parent or ""
-end
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index 1d21a83f9..4c209f6cd 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -126,6 +126,32 @@
\fi
\to \everysetupbtx
+\unexpanded\def\publ_specification_push#1% local, don't override
+ {\pushmacro\currentbtxspecification
+ \edef\currentbtxspecification{#1}%
+ \ctxcommand{setbtxspecification("\currentbtxspecification")}}
+
+\unexpanded\def\publ_specification_pop
+ {\popmacro\currentbtxspecification
+ \ctxcommand{setbtxspecification("\currentbtxspecification")}}
+
+\unexpanded\def\publ_specification_set#1% beware: is global
+ {\edef\currentbtxspecification{#1}%
+ \ctxcommand{setbtxspecification("\currentbtxspecification")}}
+
+\appendtoks
+ \publ_specification_set{\btxparameter\c!specification}%
+\to \everysetupbtx
+
+\appendtoks
+ \publ_specification_set{\btxparameter\c!specification}%
+\to \everyjob
+
+\unexpanded\def\startusingbtxspecification[#1]%
+ {\publ_specification_push{#1}}
+
+\let\stopusingbtxspecification\publ_specification_pop
+
% a dedicated construction mechanism
\installcorenamespace {btxlist}
@@ -729,8 +755,7 @@
{\startbtxrendering[\currentbtxrendering]%
% \fastsetup{\btxrenderingparameter\c!setups}% specific initializations
% \determinelistcharacteristics[\currentbtxrendering]%
- \edef\currentbtxspecification{\btxrenderingparameter\c!specification}%
- \ctxcommand{setbtxspecification("\currentbtxspecification")}%
+ \publ_specification_push{\btxrenderingparameter\c!specification}%
\edef\currentbtxdataset{\btxrenderingparameter\c!dataset}%
\uselanguageparameter\btxdatasetparameter % new
\let\currentlist\s!btx
@@ -768,6 +793,7 @@
% this actually typesets them
\ctxcommand{btxflushlistentries("\currentbtxdataset")}%
\stoppacked
+ \publ_specification_pop
\stopbtxrendering
\global\advance\btxblock\plusone}
@@ -1130,6 +1156,7 @@
\def\publ_cite_handle_variant_indeed[#1]%
{\usebtxcitevariantstyleandcolor\c!style\c!color
\uselanguageparameter\btxdatasetparameter % new
+ \publ_specification_push{\btxcitevariantparameter\c!specification}%
\letbtxcitevariantparameter\c!alternative\currentbtxcitevariant
\btxcitevariantparameter\v!left
\ctxcommand{btxhandlecite{%
@@ -1147,6 +1174,7 @@
}}%
\btxcitevariantparameter\v!right
\ctxcommand{flushmarked()}%
+ \publ_specification_pop
\endgroup}
\unexpanded\def\btxcitation
@@ -1263,10 +1291,10 @@
\unexpanded\def\btxhandleciteentry
{\dontleavehmode
\begingroup
- \edef\currentbtxspecification{\btxcitevariantparameter\c!specification}%
- \ctxcommand{setbtxspecification("\currentbtxspecification")}%
+ \publ_specification_push{\btxcitevariantparameter\c!specification}%
\btxcitereference
\btx_entry_inject
+ \publ_specification_pop
\endgroup}
\startsetups \s!btx:\s!cite:entry
diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua
index f0b113295..ae5161569 100644
--- a/tex/context/base/publ-tra.lua
+++ b/tex/context/base/publ-tra.lua
@@ -35,32 +35,32 @@ function tracers.showdatasetfields(settings)
local kind = settings.kind
local fielddata = kind and specifications[kind] or specifications.apa
local categories = fielddata.categories
- local fieldspecs = fielddata.fields
ctx_starttabulate { "|lT|lT|pT|" }
ctx_NC() ctx_bold("tag")
ctx_NC() ctx_bold("category")
ctx_NC() ctx_bold("fields")
ctx_NC() ctx_NR()
ctx_FL()
- for k, v in sortedhash(luadata) do
- local category = v.category
- local fields = fieldspecs[category] or { }
- ctx_NC() context(k)
+ for tag, entry in sortedhash(luadata) do
+ local category = entry.category
+ local catedata = categories[category]
+ local fields = catedata and catedata.fields or { }
+ ctx_NC() context(tag)
ctx_NC() context(category)
ctx_NC() -- grouping around colors needed
- for k, v in sortedhash(v) do
- if privates[k] then
+ for key, value in sortedhash(entry) do
+ if privates[key] then
-- skip
- elseif specials[k] then
- context("{\\darkblue %s} ",k)
+ elseif specials[key] then
+ context("{\\darkblue %s} ",key)
else
- local f = fields[k]
- if f == "required" then
- context("{\\darkgreen %s} ",k)
- elseif f == "optional" then
- context("{\\darkyellow %s} ",k)
+ local kind = fields[key]
+ if kind == "required" then
+ context("{\\darkgreen %s} ",key)
+ elseif kind == "optional" then
+ context("{\\darkyellow %s} ",key)
else
- context("%s ",k)
+ context("%s ",key)
end
end
end
@@ -77,7 +77,6 @@ function tracers.showdatasetcompleteness(settings)
local kind = settings.kind
local fielddata = kind and specifications[kind] or specifications.apa
local categories = fielddata.categories
- local fieldspecs = fielddata.fields
local lpegmatch = lpeg.match
local texescape = lpeg.patterns.texescape
@@ -164,7 +163,6 @@ function tracers.showdatasetcompleteness(settings)
local r = requiredfields[i]
local r = sets[r] or r
if type(r) == "table" then
- -- this has to be done differently now
local okay = false
for i=1,#r do
local ri = r[i]
@@ -195,7 +193,6 @@ function tracers.showdatasetcompleteness(settings)
local o = optionalfields[i]
local o = sets[o] or o
if type(o) == "table" then
- -- this has to be done differently now
for i=1,#o do
local oi = o[i]
if rawget(entry,oi) then
@@ -239,36 +236,12 @@ function tracers.showfields(settings)
local kind = settings.kind
local fielddata = kind and specifications[kind] or specifications.apa
local categories = fielddata.categories
- local fieldspecs = fielddata.fields
local validfields = { }
- local function makevalid(list,sets)
- for i=1,#list do
- local li = list[i]
- if sets and sets[li] then
- -- ignore
- elseif type(li) == "table" then
- for i=1,#li do
- validfields[li[i]] = true
- end
- elseif li then
- validfields[li] = true
- else
- -- report("fatal error in showfields")
- end
- end
- end
- for category, fields in next, categories do
- local sets = fields.sets
+ for category, data in next, categories do
+ local sets = data.sets
+ local fields = data.fields
for name, list in next, fields do
- if list == sets then
- for k, v in next, list do
- makevalid(v,sets)
- end
- elseif list then
- makevalid(list,sets)
- else
- -- can be false
- end
+ validfields[name] = true
end
end
local s_categories = sortedkeys(categories)
@@ -296,7 +269,7 @@ function tracers.showfields(settings)
ctx_bold(field)
for j=1,#s_categories do
ctx_NC()
- local kind = fieldspecs[s_categories[j]][field]
+ local kind = categories[s_categories[j]].fields[field]
if kind == "required" then
context("\\darkgreen*")
elseif kind == "optional" then
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 8e5bf1a8a..2db224df5 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 8b75ed454..70984a4ea 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua
index bdbbf9c4f..c7fbf51b7 100644
--- a/tex/context/base/strc-lst.lua
+++ b/tex/context/base/strc-lst.lua
@@ -628,37 +628,12 @@ filters[v_previous] = function(specification)
end
filters[v_local] = function(specification)
- local nested = nesting[#nesting]
- local criterium = nested and nested.name
- if nested and criterium then
- -- nested = nested
- -- criterium = nested.name
- elseif autosectiondepth(specification.numbers) == 0 then
- nested = false
- criterium = v_all
- else
- nested = false
- criterium = v_current
- end
- return filtercollected {
- names = specification.names,
- criterium = criterium,
- reference = nested.number,
- collected = specification.collected,
- forced = specification.forced,
- nested = nested,
- sortorder = specification.sortorder,
- }
-end
-
-filters[v_local] = function(specification)
local numbers = specification.numbers
local nested = nesting[#nesting]
if nested then
return filtercollected {
names = specification.names,
criterium = nested.name,
- reference = nested.number,
collected = specification.collected,
forced = specification.forced,
nested = nested,
@@ -711,6 +686,7 @@ filters[v_default] = function(specification) -- is named
local numbers = specification.numbers
local sections = sections.collected
local reference = specification.reference
+ local nested = specification.nested
--
if reference then
reference = tonumber(reference)
@@ -724,7 +700,9 @@ filters[v_default] = function(specification) -- is named
if parent then
pnumbers = parent.numberdata.numbers or pnumbers -- so local as well as nested
pblock = parent.references.block or pblock
- report_lists("filtering by block %a and section %a",pblock,criterium)
+ if trace_lists then
+ report_lists("filtering by block %a and section %a",pblock,criterium)
+ end
end
--
for i=1,#collected do
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 2472cb5f0..c075c8c68 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 11/08/14 15:07:31
+-- merge date : 11/09/14 15:05:06
do -- begin closure to overcome local limits and interference