summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-02-04 00:15:04 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-02-04 00:15:04 +0100
commit08128a9710f7a34e16f7487b3bccfe7feadb36f1 (patch)
tree3d733f318680915c9f381dad1fc72dc8fbba8d85
parentb52a3ec06867c6722c0f6aeeeae57029235e53fb (diff)
downloadcontext-08128a9710f7a34e16f7487b3bccfe7feadb36f1.tar.gz
2015-02-03 23:57:00
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4385 -> 4386 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/publ-aut.lua109
-rw-r--r--tex/context/base/publ-tra.lua14
-rw-r--r--tex/context/base/status-files.pdfbin24610 -> 24590 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin333342 -> 333384 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
8 files changed, 94 insertions, 35 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 52c4e4d3c..2d0f07dad 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{2015.02.03 21:36}
+\newcontextversion{2015.02.03 23:55}
%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 cc5438f72..31c5d44c1 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 ba82de9d3..d6522da7e 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{2015.02.03 21:36}
+\edef\contextversion{2015.02.03 23:55}
\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 dc5a707cf..764550998 100644
--- a/tex/context/base/publ-aut.lua
+++ b/tex/context/base/publ-aut.lua
@@ -28,6 +28,8 @@ local publications = publications
local datasets = publications.datasets
local getcasted = publications.getcasted
+local allocate = utilities.storage.allocate
+
local chardata = characters.data
local report = logs.reporter("publications","authors")
@@ -133,7 +135,7 @@ local function splitauthorstring(str)
snippets = n,
}
if n == 1 then
- -- First von Last
+ -- {First Middle von Last}
local words = lpegmatch(spacesplitter,author)
firstnames, vons, surnames = { }, { }, { }
local i, n = 1, #words
@@ -172,7 +174,8 @@ local function splitauthorstring(str)
initials = makeinitials(firstnames)
end
elseif n == 2 then
- -- von Last, First
+ -- {Last, First}
+ -- {von Last, First}
firstnames, vons, surnames = { }, { }, { }
local words = lpegmatch(spacesplitter,split[1])
local i, n = 1, #words
@@ -208,20 +211,21 @@ local function splitauthorstring(str)
end
initials = makeinitials(firstnames)
elseif n == 3 then
- -- von Last, Jr ,First
+ -- {von Last, First, Jr}
surnames = lpegmatch(spacesplitter,split[1])
juniors = lpegmatch(spacesplitter,split[2])
firstnames = lpegmatch(spacesplitter,split[3])
initials = makeinitials(firstnames)
elseif n == 4 then
- -- von, Last, Jr, First
+ -- {Von, Last, First, Jr}
vons = lpegmatch(spacesplitter,split[1])
surnames = lpegmatch(spacesplitter,split[2])
juniors = lpegmatch(spacesplitter,split[3])
firstnames = lpegmatch(spacesplitter,split[4])
initials = makeinitials(firstnames)
elseif n >= 5 then
- -- von, Last, Jr, First, Initials
+ -- {Von, Last, First, Jr, F.}
+ -- {Von, Last, First, Jr, Fr., options}
vons = lpegmatch(spacesplitter,split[1])
surnames = lpegmatch(spacesplitter,split[2])
juniors = lpegmatch(spacesplitter,split[3])
@@ -429,13 +433,45 @@ local function components(snippet,short)
local firstnames = not short and snippet.firstnames
local juniors = snippet.juniors
return
- vons and #vons > 0 and concat(vons, " ") or "",
- surnames and #surnames > 0 and concat(surnames, " ") or "",
+ vons and #vons > 0 and concat(vons," ") or "",
+ surnames and #surnames > 0 and concat(surnames," ") or "",
initials and #initials > 0 and concat(the_initials(initials)," ") or "",
firstnames and #firstnames > 0 and concat(firstnames," ") or "",
- juniors and #juniors > 0 and concat(juniors, " ") or ""
+ juniors and #juniors > 0 and concat(juniors, " ") or ""
end
+local collapsers = allocate { }
+
+publications.authorcollapsers = collapsers
+
+local function default(author)
+ local vons = author.vons
+ local surnames = author.surnames
+ local initials = author.initials
+ local firstnames = author.firstnames
+ local juniors = author.juniors
+ local result = { }
+ local nofresult = 0
+ if vons and #vons > 0 then
+ nofresult = nofresult + 1 ; result[nofresult] = concat(vons," ")
+ end
+ if surnames and #surnames > 0 then
+ nofresult = nofresult + 1 ; result[nofresult] = concat(surnames," ")
+ end
+ if initials and #initials > 0 then
+ nofresult = nofresult + 1 ; result[nofresult] = concat(the_initials(initials)," ")
+ end
+ if firstnames and #firstnames > 0 then
+ nofresult = nofresult + 1 ; result[nofresult] = concat(firstnames," ")
+ end
+ if juniors and #juniors > 0 then
+ nofresult = nofresult + 1 ; result[nofresult] = concat(juniors," ")
+ end
+ return concat(result," ")
+end
+
+collapsers.default = default
+
local function writer(key,snippets)
if not key then
return ""
@@ -446,34 +482,45 @@ local function writer(key,snippets)
local n = #key
if n == 0 then
return ""
- end
- if not snippets then
- snippets = { }
- end
- local s = 0
- for i=1,n do
- local k = key[i]
- local vons = k.vons
- local surnames = k.surnames
- local initials = k.initials
- local juniors = k.juniors
- if vons and #vons > 0 then
- s = s + 1 ; snippets[s] = concat(vons," ")
- end
- if surnames and #surnames > 0 then
- s = s + 1 ; snippets[s] = concat(surnames," ")
- end
- if initials and #initials > 0 then
- s = s + 1 ; snippets[s] = concat(the_initials(initials," ","")," ") -- todo: configure . and -
+ elseif n == 1 then
+ local author = key[1]
+ local options = author.options
+ if options then
+ for option in next, options do
+ local collapse = collapsers[option]
+ if collapse then
+ return collapse(author)
+ end
+ end
end
- if juniors and #juniors > 0 then
- s = s + 1 ; snippets[s] = concat(juniors," ")
+ return default(author)
+ else
+ local t = { }
+ local s = 0
+ for i=1,n do
+ local author = key[i]
+ local options = author.options
+ s = s + 1
+ if options then
+ local done = false
+ for option in next, options do
+ local collapse = collapsers[option]
+ if collapse then
+ t[s] = collapse(author)
+ done = true
+ end
+ end
+ if not done then
+ t[s] = default(author)
+ end
+ else
+ t[s] = default(author)
+ end
end
+ return concat(t," & ")
end
- return concat(snippets," ",1,s)
end
-
publications.writers .author = writer
publications.casters .author = splitauthorstring
publications.components.author = components
diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua
index 1c39aef97..5f1610beb 100644
--- a/tex/context/base/publ-tra.lua
+++ b/tex/context/base/publ-tra.lua
@@ -327,6 +327,8 @@ function tracers.showdatasetauthors(settings)
local dataset = settings.dataset
local field = settings.field
+ local sortkey = publications.writers.author
+
if not dataset or dataset == "" then dataset = "standard" end
if not field or field == "" then field = "author" end
@@ -339,7 +341,16 @@ function tracers.showdatasetauthors(settings)
ctx_verbatim(k)
ctx_EQ()
if type(v) == "table" then
- ctx_verbatim(concat(v, " | "))
+ local t = { }
+ for i=1,#v do
+ local vi = v[i]
+ if type(vi) == "table" then
+ t[i] = concat(vi,"-")
+ else
+ t[i] = vi
+ end
+ end
+ ctx_verbatim(concat(t, " | "))
else
ctx_verbatim(v)
end
@@ -375,6 +386,7 @@ function tracers.showdatasetauthors(settings)
commonrow("tag",tag)
commonrow("field",field)
commonrow("content",getfield(dataset,tag,field))
+ commonrow("sortkey",sortkey(a))
for i=1,#a do
ctx_ML()
local ai = a[i]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 275184f80..bebc7d2e5 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 b9623e001..789ee16eb 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 bef47218d..c1951c8e7 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 : 02/03/15 21:36:49
+-- merge date : 02/03/15 23:55:34
do -- begin closure to overcome local limits and interference