summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-11 13:15:03 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-11 13:15:03 +0100
commitd26cacc03e700db6a15cefab13fe3b007c416325 (patch)
treea10e89e804f6656e890ebc606f32353e3501aa4d /tex
parent09dd6fdf23ca0bdd27007f0420bc30d841eb5ab0 (diff)
downloadcontext-d26cacc03e700db6a15cefab13fe3b007c416325.tar.gz
2014-11-11 12:14:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4385 -> 4377 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/publ-aut.lua21
-rw-r--r--tex/context/base/publ-dat.lua55
-rw-r--r--tex/context/base/publ-imp-apa.lua27
-rw-r--r--tex/context/base/publ-imp-apa.mkvi2
-rw-r--r--tex/context/base/publ-ini.lua111
-rw-r--r--tex/context/base/publ-tra.lua26
-rw-r--r--tex/context/base/publ-tra.mkiv6
-rw-r--r--tex/context/base/status-files.pdfbin24700 -> 24717 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin343985 -> 342244 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
13 files changed, 166 insertions, 88 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 7bd25304b..e3ce4e077 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.10 23:13}
+\newcontextversion{2014.11.11 12:12}
%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 056f96946..2391c5443 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 efa0a7383..179709972 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.10 23:13}
+\edef\contextversion{2014.11.11 12:12}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua
index 971dee45e..7eef49f72 100644
--- a/tex/context/base/publ-aut.lua
+++ b/tex/context/base/publ-aut.lua
@@ -13,9 +13,6 @@ end
local lpeg = lpeg
-local context = context
-local chardata = characters.data
-
local type, next, tostring = type, next, tostring
local concat = table.concat
local utfchar = utf.char
@@ -23,16 +20,15 @@ local formatters = string.formatters
local P, C, V, Cs, Ct, lpegmatch, lpegpatterns = lpeg.P, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Ct, lpeg.match, lpeg.patterns
-local publications = publications or { }
-
-local datasets = publications.datasets or { }
-publications.datasets = datasets
+local context = context
+local commands = commands
+local publications = publications
-local writers = publications.writers or { }
-publications.writers = writers
+local datasets = publications.datasets
+local writers = publications.writers
+local authors = publications.authors
-local authors = publications.authors or { }
-publications.authors = authors
+local chardata = characters.data
local report = logs.reporter("publications","authors")
@@ -460,8 +456,7 @@ local function writer(key,snippets)
return concat(snippets," ",1,s)
end
-writers.author = writer
-writers.editor = editor
+writers.author = writer
local default = { "author" }
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index 834fdc10c..0026c2c1f 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -48,6 +48,8 @@ local trace_duplicates = true trackers.register("publications.duplicates", fu
local report = logs.reporter("publications")
local report_duplicates = logs.reporter("publications","duplicates")
+local allocate = utilities.storage.allocate
+
publications = publications or { }
local publications = publications
@@ -57,6 +59,9 @@ publications.datasets = datasets
local writers = publications.writers or { }
publications.writers = writers
+local authors = publications.authors or { }
+publications.authors = authors
+
local tables = publications.tables or { }
publications.tables = tables
@@ -68,13 +73,13 @@ publicationsstats.nofdefinitions = 0
publicationsstats.nofshortcuts = 0
publicationsstats.nofdatasets = 0
-local privates = {
+local privates = allocate {
category = true,
tag = true,
index = true,
}
-local specials = {
+local specials = allocate {
key = true,
crossref = true,
keywords = true,
@@ -95,7 +100,7 @@ local v_all = interfaces and interfaces.variables.all or "all"
local xmlplaceholder = "<?xml version='1.0' standalone='yes'?>\n<bibtex></bibtex>"
-local defaultshortcuts = {
+local defaultshortcuts = allocate {
jan = "1",
feb = "2",
mar = "3",
@@ -115,7 +120,7 @@ local separator = space * "+" * space
local l_splitter = lpeg.tsplitat(separator)
local d_splitter = lpeg.splitat (separator)
-local implicitfields = {
+local implicits = allocate {
category = "implicit",
tag = "implicit",
key = "implicit",
@@ -124,14 +129,14 @@ local implicitfields = {
crossref = "implicit",
}
-local types = {
+local origins = allocate {
"optional",
"extra",
"required",
"virtual",
}
-local virtuals = {
+local virtuals = allocate {
"authoryear",
"authoryears",
"authornum",
@@ -139,6 +144,17 @@ local virtuals = {
"suffix",
}
+local defaulttypes = allocate {
+ author = "author",
+ editor = "author",
+ publisher = "author",
+}
+
+tables.implicits = implicits
+tables.origins = origins
+tables.virtuals = virtuals
+tables.types = defaulttypes
+
local unknownfield = function(t,k)
local v = "extra"
t[k] = v
@@ -151,11 +167,18 @@ local unknowncategory = function(t,k)
optional = false,
virtual = false,
fields = setmetatableindex(unknownfield),
+ types = defaulttypes,
}
t[k] = v
return v
end
+local unknowntype = function(t,k)
+ local v = "string"
+ t[k] = v
+ return v
+end
+
local default = {
name = name,
version = "1.00",
@@ -163,18 +186,19 @@ local default = {
author = "anonymous",
copyright = "no one",
categories = setmetatableindex(unknowncategory),
+ types = setmetatableindex(defaulttypes,unknowntype),
}
+-- maybe at some point we can han da handlers table with per field
+-- a found, fetch, ... method
+
local function checkfield(specification,category,data)
- local list = setmetatableindex({},implicitfields)
+ local list = setmetatableindex({},implicits)
data.fields = list
data.category = category
local sets = data.sets or { }
- if data.virtual == nil then -- so false is valid
- data.virtual = specification.virtual
- end
- for i=1,#types do
- local t = types[i]
+ for i=1,#origins do
+ local t = origins[i]
local d = data[t]
if d then
for i=1,#d do
@@ -218,6 +242,13 @@ local specifications = setmetatableindex(function(t,name)
end
setmetatableindex(categories,unknowncategory)
--
+ local types = specification.types
+ if not types then
+ types = defaulttypes
+ specification.types = types
+ end
+ setmetatableindex(types,unknowntype)
+ --
local fields = setmetatableindex(unknownfield)
specification.fields = fields
--
diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua
index 7e0d06121..3ee67f6d1 100644
--- a/tex/context/base/publ-imp-apa.lua
+++ b/tex/context/base/publ-imp-apa.lua
@@ -199,7 +199,7 @@ categories.booklet = {
"subtitle", "type", "file",
"address",
"howpublished",
- "note",
+ "note", "isbn",
},
}
@@ -207,11 +207,11 @@ categories.booklet = {
categories.incollection = {
sets = {
- author = { "author", "editor", "publisher" },
+ author = { "author", "editor", "publisher", "title" },
},
required = {
"author",
- "title", "booktitle",
+ "booktitle",
"year",
},
optional = {
@@ -220,23 +220,25 @@ categories.incollection = {
"volume", "number", "series",
"chapter", "pages",
"address",
- "note", "isbn",
+ "note", "isbn"
},
}
-- the proceedings of a conference.
categories.proceedings = {
+ sets = {
+ author = { "editor", "publisher", "title" },
+ },
required = {
- "title",
+ "author",
"year"
},
optional = {
- "editor",
"subtitle", "file",
"volume", "number", "series", "pages",
"month",
- "address", "publisher", "organization",
+ "address", "organization",
"note", "isbn"
},
}
@@ -400,13 +402,16 @@ categories.other = {
-- if all else fails to match:
categories.literal = {
+ sets = {
+ author = { "key" },
+ },
required = {
- "key",
+ "author",
"text"
},
- optional = {
- -- whatever comes up
- },
+ -- optional = {
+ -- -- whatever comes up
+ -- },
virtual = false,
}
diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi
index ef148e657..e6055bd35 100644
--- a/tex/context/base/publ-imp-apa.mkvi
+++ b/tex/context/base/publ-imp-apa.mkvi
@@ -363,7 +363,6 @@
% we make the authoryear active, pointing to the citation
\texdefinition{btx:apa:inject} {\s!internal(\currentbtxinternal)}
{
-<\btxfoundname{author},\btxfoundtype{author}>
\doifelse {\btxfoundname{author}} {editor} {
\texdefinition{btx:apa:editor-or-editors}
} {
@@ -661,6 +660,7 @@
\stoptexdefinition
% #author is author, editor, organization, howpublished or assignee
+
\starttexdefinition btx:apa:wherefrom-publisher-author-is- #author
\btxdoifelse {country} {
\btxspace
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index 054e20d37..188995b0a 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -146,6 +146,7 @@ local ctx_btxstopciteauthor = context.btxstopciteauthor
local ctx_btxstartsubcite = context.btxstartsubcite
local ctx_btxstopsubcite = context.btxstopsubcite
local ctx_btxlistsetup = context.btxlistsetup
+local ctx_btxflushauthor = context.btxflushauthor
local registeredcitevariants = publications.registeredcitevariants or allocate()
local registeredlistvariants = publications.registeredlistvariants or allocate()
@@ -698,11 +699,6 @@ local function shortsorter(a,b)
return a[4] < b[4]
end
-local authorkeys = {
- "author",
- "editor",
-}
-
function publications.enhance(dataset) -- for the moment split runs (maybe publications.enhancers)
statistics.starttiming(publications)
if type(dataset) == "string" then
@@ -714,12 +710,20 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi
local luadata = dataset.luadata
local details = dataset.details
local ordered = dataset.ordered
- -- authors: todo, get authorkeys from current specification (so we need to redo when that spec changes)
+ local types = currentspecification.types -- or { author = "author", editor = "author" }
+ local authors = { }
+ --
+ for k, v in next, types do
+ if v == "author" then
+ authors[#authors+1] = k
+ end
+ end
+ --
for tag, entry in next, luadata do
local detail = { }
details[tag] = detail
- for i=1,#authorkeys do
- local key = authorkeys[i]
+ for i=1,#authors do
+ local key = authors[i]
local value = entry[key]
if value then
detail[key] = splitauthorstring(value)
@@ -900,6 +904,32 @@ end
do
+ local typesetters = { }
+ publications.typesetters = typesetters
+
+ local function defaulttypesetter(field,value,manipulator)
+ if value and value ~= "" then
+ value = tostring(value)
+ context(manipulator and applymanipulation(manipulator,value) or value)
+ end
+ end
+
+ setmetatableindex(typesetters,function(t,k)
+ local v = defaulttypesetter
+ t[k] = v
+ return v
+ end)
+
+ function typesetters.string(field,value,manipulator)
+ if value and value ~= "" then
+ context(manipulator and applymanipulation(manipulator,value) or value)
+ end
+ end
+
+ function typesetters.author(field,value,manipulator)
+ ctx_btxflushauthor(field)
+ end
+
-- if there is no specification then we're in trouble but there is
-- always a default anyway
--
@@ -921,7 +951,6 @@ do
return false
end
local kind = fields[field]
- -- if ignoredfields and kind == "optional" and ignoredfields[field] then
if ignoredfields and ignoredfields[field] then
return false
else
@@ -932,44 +961,31 @@ do
end
local function found(dataset,tag,field,valid,fields)
- local details = nil
- local function check_f(field)
- local value = fields[field]
- if type(value) == "string" then
- return value
- end
- end
- local function check_d(field)
- local value = details[field]
- if type(value) == "string" then
- return value
- end
- end
if valid == true then
-- local fields = dataset.luadata[tag]
- local okay = check_f(field)
+ local okay = fields[field]
if okay then
- return okay
+ return field, okay
end
- details = dataset.details[tag]
- local okay = check_d(field)
+ local details = dataset.details[tag]
+ local okay = details[field]
if okay then
- return okay
+ return field, okay
end
elseif valid then
-- local fields = dataset.luadata[tag]
for i=1,#valid do
local field = valid[i]
- local okay = check_f(field)
+ local okay = fields[field]
if okay then
- return okay
+ return field, okay
end
end
- details = dataset.details[tag]
+ local details = dataset.details[tag]
for i=1,#valid do
- local okay = check_d(field)
+ local okay = details[field]
if okay then
- return okay
+ return field, okay
end
end
end
@@ -987,10 +1003,6 @@ do
end
local fields = catspec.fields
if fields then
- local kind = (not check or data[field]) and fields[field]
- if kind then
- return what and kind or field
- end
local sets = catspec.sets
if sets then
local set = sets[field]
@@ -1014,6 +1026,10 @@ do
end
end
end
+ local kind = (not check or data[field]) and fields[field]
+ if kind then
+ return what and kind or field
+ end
end
end
end
@@ -1034,9 +1050,9 @@ do
local category = fields.category
local valid = permitted(category,field)
if valid then
- local okay = found(dataset,tag,field,valid,fields)
- if okay then
- context(manipulator and applymanipulation(manipulator,okay) or okay)
+ local name, value = found(dataset,tag,field,valid,fields)
+ if value then
+ typesetters[currentspecification.types[name]](field,value,manipulator)
else
report("%s %s %a in category %a for tag %a in dataset %a","unknown","entry",field,category,tag,name)
end
@@ -1060,8 +1076,8 @@ do
if permitted(category,field) then
local manipulator, field = splitmanipulation(field)
local value = fields[field]
- if type(value) == "string" then
- context(manipulator and applymanipulation(manipulator,value) or value)
+ if value then
+ typesetters[currentspecification.types[field]](field,value,manipulator)
else
report("%s %s %a in category %a for tag %a in dataset %a","unknown","field",field,category,tag,name)
end
@@ -1087,8 +1103,8 @@ do
if permitted(category,field) then
local manipulator, field = splitmanipulation(field)
local value = details[field]
- if type(value) == "string" then
- context(manipulator and applymanipulation(manipulator,value) or value)
+ if value then
+ typesetters[currentspecification.types[field]](field,value,manipulator)
else
report("%s %s %a in category %a for tag %a in dataset %a","unknown","detail",field,category,tag,name)
end
@@ -1114,7 +1130,8 @@ do
local category = fields.category
local valid = permitted(category,field)
if valid then
- return found(dataset,tag,field,valid,fields)
+ local value, field = found(dataset,tag,field,valid,fields)
+ return value and value ~= ""
end
end
end
@@ -1444,10 +1461,10 @@ local function byspec(dataset,list,method) -- todo: yearsuffix
local a, b = lpegmatch(splitspec,f[i])
if b then
if a == "detail" or a == "entry" then
- local w = writers[b]
+ local t = currentspecification.types[b]
+ local w = t and writers[t]
if w then
- -- r[#r+1] = formatters["(%s.%s and writers[%q](%s.%s,snippets))"](a,b,b,a,b)
- r[#r+1] = formatters["(%s.%s and writers[%q](%s.%s))"](a,b,b,a,b)
+ r[#r+1] = formatters["(%s.%s and writers[%q](%s.%s))"](a,b,t,a,b)
else
r[#r+1] = formatters["%s.%s"](a,b,a,b)
end
diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua
index a6141c769..09dab888a 100644
--- a/tex/context/base/publ-tra.lua
+++ b/tex/context/base/publ-tra.lua
@@ -19,7 +19,7 @@ local specifications = publications.specifications
local context = context
local ctx_NC, ctx_NR, ctx_HL, ctx_FL, ctx_ML, ctx_LL = context.NC, context.NR, context.HL, context.FL, context.ML, context.LL
-local ctx_bold, ctx_monobold, ctx_rotate, ctx_llap = context.bold, context.formatted.monobold, context.rotate, context.llap
+local ctx_bold, ctx_monobold, ctx_rotate, ctx_llap, ctx_rlap = context.bold, context.formatted.monobold, context.rotate, context.llap, context.rlap
local ctx_starttabulate, ctx_stoptabulate = context.starttabulate, context.stoptabulate
local privates = publications.tables.privates
@@ -283,6 +283,30 @@ function tracers.showfields(settings)
ctx_stoptabulate()
end
+function tracers.showtables(settings)
+ for name, list in sortedhash(publications.tables) do
+ ctx_starttabulate { "|Tl|Tl|" }
+ ctx_FL()
+ ctx_NC()
+ ctx_rlap(function() ctx_bold(name) end)
+ ctx_NC()
+ ctx_NC()
+ ctx_NR()
+ ctx_FL()
+ for k, v in sortedhash(list) do
+ ctx_NC()
+ context(k)
+ ctx_NC()
+ context(tostring(v))
+ ctx_NC()
+ ctx_NR()
+ end
+ ctx_LL()
+ ctx_stoptabulate()
+ end
+end
+
commands.showbtxdatasetfields = tracers.showdatasetfields
commands.showbtxdatasetcompleteness = tracers.showdatasetcompleteness
commands.showbtxfields = tracers.showfields
+commands.showbtxtables = tracers.showtables
diff --git a/tex/context/base/publ-tra.mkiv b/tex/context/base/publ-tra.mkiv
index 566992a01..6f4167d83 100644
--- a/tex/context/base/publ-tra.mkiv
+++ b/tex/context/base/publ-tra.mkiv
@@ -23,6 +23,7 @@
\unexpanded\def\showbtxdatasetfields {\dosingleempty\publ_show_dataset_fields}
\unexpanded\def\showbtxdatasetcompleteness{\dosingleempty\publ_show_dataset_completeness}
\unexpanded\def\showbtxfields {\dosingleempty\publ_show_fields}
+\unexpanded\def\showbtxtables {\dosingleempty\publ_show_tables}
\def\publ_show_dataset_whatever#1[#2]%
{\begingroup
@@ -61,6 +62,11 @@
% \publ_specification_pop
\endgroup}
+\def\publ_show_tables[#1]%
+ {\begingroup
+ \ctxcommand{showbtxtables{}}%
+ \endgroup}
+
\protect
\continueifinputfile{publ-tra.mkiv}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 3da4d77e2..0cd6b92cb 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 a6ccfe118..5182fb633 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 180394ce6..dc2bb35bf 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/10/14 23:13:18
+-- merge date : 11/11/14 12:12:33
do -- begin closure to overcome local limits and interference