summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4061 -> 4062 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/publ-dat.lua57
-rw-r--r--tex/context/base/publ-imp-cite.mkiv16
-rw-r--r--tex/context/base/publ-ini.lua136
-rw-r--r--tex/context/base/publ-ini.mkiv46
-rw-r--r--tex/context/base/status-files.pdfbin24620 -> 24618 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin243695 -> 243725 bytes
9 files changed, 178 insertions, 81 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 47289ebe9..cded7454f 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.05.16 20:08}
+\newcontextversion{2014.05.17 23: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/context-version.pdf b/tex/context/base/context-version.pdf
index 145596d8c..2b973ae9b 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 50a8e6259..ef3c639e3 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.05.16 20:08}
+\edef\contextversion{2014.05.17 23:46}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index b463064ca..da2fe1f6c 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -24,8 +24,9 @@ end
local chardata = characters.data
local lowercase = characters.lower
-local lower, gsub, concat = string.lower, string.gsub, table.concat
-local next, type = next, type
+local lower, gsub, find = string.lower, string.gsub, string.find
+local concat = table.concat
+local next, type, rawget = next, type, rawget
local utfchar = utf.char
local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
local textoutf = characters and characters.tex.toutf
@@ -73,13 +74,56 @@ local defaultshortcuts = {
dec = "12",
}
+local l_splitter = lpeg.tsplitat("+")
+local d_splitter = lpeg.splitat ("+")
+
function publications.new(name)
publicationsstats.nofdatasets = publicationsstats.nofdatasets + 1
+ local function getcombinedluadata(t,k)
+ if find(k,"%+") then
+ local tags = lpegmatch(l_splitter,k)
+ local parent = tags[i]
+ local first = rawget(t,parent)
+ if first then
+ local combined = first.combined
+ if not combined then
+ combined = { }
+ first.combined = combined
+ end
+ -- add new ones but only once
+ for i=1,#tags do
+ local tag = tags[i]
+ local new = true
+ for j=1,#combined do
+ if combined[j] == tag then
+ new = false
+ end
+ end
+ if new then
+ local entry = rawget(t,tag)
+ if entry then
+ combined[#combined+1] = tag
+ entry.combined[parent] = true
+ end
+ end
+ end
+ return first
+ end
+ end
+ end
+ local function getcombineddetails(t,k)
+ if find(k,"%+") then
+ local tag = lpegmatch(d_splitter,k)
+ return rawget(t,tag)
+ end
+ end
+ local luadata = setmetatableindex({ },getcombinedluadata)
+ local details = setmetatableindex({ },getcombineddetails)
local dataset = {
name = name or "dataset " .. publicationsstats.nofdatasets,
nofentries = 0,
shortcuts = { },
- luadata = { },
+ luadata = luadata,
xmldata = xmlconvert(xmlplaceholder),
-- details = { },
nofbytes = 0,
@@ -95,10 +139,13 @@ function publications.new(name)
userdata = false,
},
}
+ -- we delay details till we need it (maybe we just delay the
+ -- individual fields but that is tricky as there can be some
+ -- depedencies)
setmetatableindex(dataset,function(t,k)
-- will become a plugin
if k == "details" and publications.enhance then
- dataset.details = { }
+ dataset.details = details
publications.enhance(dataset.name)
return dataset.details
end
@@ -150,7 +197,7 @@ local filter_2 = Cs(
)
-- Currently we expand shortcuts and for large ones (like the acknowledgements
--- in tugboat.bib this is not that efficient. However, eventually strings get
+-- in tugboat.bib) this is not that efficient. However, eventually strings get
-- hashed again.
local function do_shortcut(key,value,dataset)
diff --git a/tex/context/base/publ-imp-cite.mkiv b/tex/context/base/publ-imp-cite.mkiv
index 3d227d736..0f0c69fa7 100644
--- a/tex/context/base/publ-imp-cite.mkiv
+++ b/tex/context/base/publ-imp-cite.mkiv
@@ -146,17 +146,25 @@
% author lists: can be less
+\startsetups \s!btx:\s!cite:common:author
+ \ifx\currentbtxcitevariant\v!normal
+ \currentbtxfirst
+ \else
+ \currentbtxciteauthor
+ \fi
+\stopsetups
+
\startsetups \s!btx:\s!cite:render:author
- \directsetup{\s!btx:\s!cite:common:normal}
+ \directsetup{\s!btx:\s!cite:common:author}
\stopsetups
\startsetups \s!btx:\s!cite:render:authoryear
- \directsetup{\s!btx:\s!cite:common:normal}
+ \directsetup{\s!btx:\s!cite:common:author}
\stopsetups
\startsetups \s!btx:\s!cite:render:authoryears
- \directsetup{\s!btx:\s!cite:common:normal}
+ \directsetup{\s!btx:\s!cite:common:author}
\stopsetups
\startsetups \s!btx:\s!cite:render:authornum
- \directsetup{\s!btx:\s!cite:common:normal}
+ \directsetup{\s!btx:\s!cite:common:author}
\stopsetups
\startsetups \s!btx:\s!cite:author:num
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index ea54a4add..09f4b0e11 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -79,7 +79,7 @@ local v_left = variables.left
local v_right = variables.right
local v_middle = variables.middle
local v_inbetween = variables.inbetween
-
+local v_yes = variables.yes
local v_short = variables.short
local v_cite = variables.cite
local v_default = variables.default
@@ -121,6 +121,7 @@ local ctx_btxsetreference = context.btxsetreference
local ctx_directsetup = context.directsetup
local ctx_btxmissing = context.btxmissing
+local ctx_btxsettag = context.btxsettag
local ctx_btxcitesetup = context.btxcitesetup
local ctx_btxsetfirst = context.btxsetfirst
local ctx_btxsetsecond = context.btxsetsecond
@@ -386,30 +387,44 @@ end)
-- end
-- end
+local reported = { }
+
local function findallused(dataset,reference,block,section)
- local tags = settings_to_array(reference)
- local todo = { }
- local okay = { } -- only if mark
- local set = usedentries[dataset]
+ local tags = settings_to_array(reference)
+ local todo = { }
+ local okay = { } -- only if mark
+ local set = usedentries[dataset]
+ local valid = datasets[dataset].luadata
if set then
for i=1,#tags do
local tag = tags[i]
- local entry = set[tag]
- if entry then
- -- only once in a list
- if #entry == 1 then
- entry = entry[1]
- else
- -- find best match
- entry = entry[1] -- for now
+ if valid[tag] then
+ local entry = set[tag]
+ if entry then
+ -- only once in a list
+ if #entry == 1 then
+ entry = entry[1]
+ else
+ -- find best match (todo)
+ entry = entry[1] -- for now
+ end
+ okay[#okay+1] = entry
end
- okay[#okay+1] = entry
+ todo[tag] = true
+ elseif not reported[tag] then
+ reported[tag] = true
+ report_cite("non-existent entry %a in %a",tag,dataset)
end
- todo[tag] = true
end
else
for i=1,#tags do
- todo[tags[i]] = true
+ local tag = tags[i]
+ if valid[tag] then
+ todo[tag] = true
+ elseif not reported[tag] then
+ reported[tag] = true
+ report_cite("non-existent entry %a in %a",tag,dataset)
+ end
end
end
return okay, todo, tags
@@ -1002,6 +1017,7 @@ function lists.flushentries(dataset,sortvariant)
end
for i=1,#list do
ctx_setvalue("currentbtxindex",i)
+ -- todo: also flush combinations
ctx_btxhandlelistentry(list[i][1]) -- we can pass i here too ... more efficient to avoid the setvalue
end
end
@@ -1010,6 +1026,7 @@ function lists.fetchentries(dataset)
local list = renderings[dataset].list
for i=1,#list do
ctx_setvalue("currentbtxindex",i)
+ -- todo: what to do with combinations
ctx_btxchecklistentry(list[i][1])
end
end
@@ -1123,14 +1140,17 @@ end
local prefixsplitter = lpeg.splitat("::")
--- function commands.btxhandlecite(dataset,tag,mark,variant,sorttype,compress)
function commands.btxhandlecite(specification)
- local dataset = specification.dataset
- local tag = specification.reference
+ local tag = specification.reference
+ if not tag or tag == "" then
+ return
+ end
+ --
+ local dataset = specification.dataset or ""
local mark = specification.markentry ~= false
- local variant = specification.variant
+ local variant = specification.variant or "num"
local sorttype = specification.sorttype
- local compress = specification.compress
+ local compress = specification.compress == v_yes
--
local prefix, rest = lpegmatch(prefixsplitter,tag)
if rest then
@@ -1138,42 +1158,47 @@ function commands.btxhandlecite(specification)
else
rest = tag
end
- local action = citevariants[variant]
- if action then
- if trace_cite then
- report_cite("inject, dataset: %s, tag: %s, variant: %s, compressed",dataset or "-",rest,variant)
- end
- ctx_setvalue("currentbtxdataset",dataset)
- action(dataset,rest,mark ~= false,compress,variant)
+ local action = citevariants[variant] -- there is always fallback on default
+ if trace_cite then
+ report_cite("inject, dataset: %s, tag: %s, variant: %s, compressed",dataset or "-",rest,variant)
end
+ ctx_setvalue("currentbtxdataset",dataset)
+ action(dataset,rest,mark,compress,variant)
end
-function commands.btxhandlenocite(dataset,tag,mark)
- if mark ~= false then
- local prefix, rest = lpegmatch(prefixsplitter,tag)
- if rest then
- dataset = prefix
- else
- rest = tag
- end
- ctx_setvalue("currentbtxdataset",dataset)
- local tags = settings_to_array(rest)
- if trace_cite then
- report_cite("mark, dataset: %s, tags: % | t",dataset or "-",tags)
- end
- for i=1,#tags do
- markcite(dataset,tags[i])
- end
+function commands.btxhandlenocite(specification)
+ local mark = specification.markentry ~= false
+ if not mark then
+ return
end
-end
-
-function commands.btxcitevariant(dataset,block,tags,variant)
- local action = citevariants[variant]
- if action then
- action(dataset,tags,variant)
+ local tag = specification.reference
+ if not tag or tag == "" then
+ return
+ end
+ local dataset = specification.dataset or ""
+ local prefix, rest = lpegmatch(prefixsplitter,tag)
+ if rest then
+ dataset = prefix
+ else
+ rest = tag
+ end
+ ctx_setvalue("currentbtxdataset",dataset)
+ local tags = settings_to_array(rest)
+ if trace_cite then
+ report_cite("mark, dataset: %s, tags: % | t",dataset or "-",tags)
+ end
+ for i=1,#tags do
+ markcite(dataset,tags[i])
end
end
+-- function commands.btxcitevariant(dataset,block,tags,variant) -- uses? specification ?
+-- local action = citevariants[variant]
+-- if action then
+-- action(dataset,tags,variant)
+-- end
+-- end
+
-- sorter
local keysorter = function(a,b) return a.sortkey < b.sortkey end
@@ -1267,14 +1292,15 @@ local function processcite(dataset,reference,mark,compress,setup,getter,setter,c
local entry = target[i]
local first = entry.first
if first then
+ local tags = entry.tags
if mark then
- local tags = entry.tags
for i=1,#tags do
local tag = tags[i]
markcite(dataset,tag)
todo[tag] = false
end
end
+ ctx_btxsettag(tags[1])
local internal = first.internal
if internal then
ctx_btxsetinternal(internal)
@@ -1283,11 +1309,12 @@ local function processcite(dataset,reference,mark,compress,setup,getter,setter,c
ctx_btxsetfirst(f_missing(first.tag))
end
else
+ local tag = entry.tag
if mark then
- local tag = entry.tag
markcite(dataset,tag)
todo[tag] = false
end
+ ctx_btxsettag(tag)
local internal = entry.internal
if internal then
ctx_btxsetinternal(internal)
@@ -1308,6 +1335,7 @@ local function processcite(dataset,reference,mark,compress,setup,getter,setter,c
markcite(dataset,tag)
todo[tag] = false
end
+ ctx_btxsettag(tag)
local internal = entry.internal
if internal then
ctx_btxsetinternal(internal)
@@ -1650,7 +1678,7 @@ local function setter(dataset,tag,entry,internal)
internal = internal,
author = getfield(dataset,tag,"author"),
num = text,
- sortkey = lpegmatch(numberonly,text)
+ sortkey = text and lpegmatch(numberonly,text)
}
end
@@ -1676,7 +1704,7 @@ local function setter(dataset,tag,entry,internal)
internal = internal,
author = getfield(dataset,tag,"author"),
year = year,
- sortkey = lpegmatch(numberonly,year)
+ sortkey = year and lpegmatch(numberonly,year)
}
end
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index ab20d2fd9..0b1a92300 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -554,6 +554,13 @@
\unexpanded\def\btxflushauthorinverted {\btx_flush_author{inverted}} % #1
\unexpanded\def\btxflushauthorinvertedshort{\btx_flush_author{invertedshort}} % #1
+\unexpanded\def\currentbtxciteauthor % always author
+ {\ctxcommand{btxauthor("\currentbtxdataset","\currentbtxtag","author",{
+ combiner = "\btxcitevariantparameter\c!author",
+ etallimit = \number\btxcitevariantparameter\c!etallimit,
+ etaldisplay = \number\btxcitevariantparameter\c!etaldisplay,
+ })}}
+
% \btxflushauthor{author}
% \btxflushauthor{artauthor}
% \btxflushauthor{editor}
@@ -713,11 +720,15 @@
\unexpanded\def\publ_cite_tags_options[#1]%
{\strictdoifnextoptionalelse{\publ_cite_tags_options_indeed{#1}}{\publ_cite_tags_indeed{#1}}}
+% \unexpanded\def\publ_cite_tags_options_indeed#1[#2]%
+% {\edef\currentbtxcitetag{#2}%
+% \doifassignmentelse{#1}
+% {\publ_cite_tags_settings_indeed{#1}}
+% {\publ_cite_tags_variants_indeed{#1}}}
+
\unexpanded\def\publ_cite_tags_options_indeed#1[#2]%
{\edef\currentbtxcitetag{#2}%
- \doifassignmentelse{#1}
- {\publ_cite_tags_settings_indeed{#1}}
- {\publ_cite_tags_variants_indeed{#1}}}
+ \doifassignmentelse{#1}\publ_cite_tags_settings_indeed\publ_cite_tags_variants_indeed{#1}}
\def\publ_cite_tags_settings_indeed#1%
{\letinteractionparameter\c!style\empty
@@ -778,22 +789,14 @@
{\usebtxcitevariantstyleandcolor\c!style\c!color
\letbtxcitevariantparameter\c!alternative\currentbtxcitevariant
\btxcitevariantparameter\v!left
- \edef\p_compress{\btxcitevariantparameter\c!compress}%
-% \ctxcommand{btxhandlecite(%
-% "\currentbtxdataset",%
-% "#1",%
-% \iftrialtypesetting false\else true\fi,%
-% "\currentbtxcitevariant",%
-% "\btxcitevariantparameter\c!sorttype",%
-% \ifx\p_compress\v!yes true\else false\fi%
-% )}%
\ctxcommand{btxhandlecite{%
dataset = "\currentbtxdataset",%
reference = "#1",%
markentry = \iftrialtypesetting false\else true\fi,%
variant = "\currentbtxcitevariant",%
sorttype = "\btxcitevariantparameter\c!sorttype",%
- compress = \ifx\p_compress\v!yes true\else false\fi,%
+ compress = "\btxcitevariantparameter\c!compress",%
+ author = "\btxcitevariantparameter\c!author",%
}}%
\btxcitevariantparameter\v!right
\endgroup}
@@ -815,7 +818,11 @@
\unexpanded\def\publ_cite_no[#1]%
{\iftrialtypesetting \else
- \ctxcommand{btxhandlenocite("\currentbtxdataset","#1",true)}%
+ \ctxcommand{btxhandlecite{%
+ dataset = "\currentbtxdataset",%
+ reference = "#1",%
+ markentry = \iftrialtypesetting false\else true\fi,%
+ }}%
\fi}
\unexpanded\def\btxmissing#1%
@@ -833,13 +840,14 @@
\newconstant\currentbtxconcat
-\unexpanded\def\btxcitevariant#1%
- {\ctxcommand{btxcitevariant("\currentbtxdataset","\currentbtxblock","\currentbtxtag","#1")}}
+% \unexpanded\def\btxcitevariant#1%
+% {\ctxcommand{btxcitevariant("\currentbtxdataset","\currentbtxblock","\currentbtxtag","#1")}}
\unexpanded\def\btxcitereset
{\let\currentbtxfirst \empty
\let\currentbtxsecond \empty
\let\currentbtxinternal\empty
+ \let\currentbtxtag \empty
\setconstant\currentbtxconcat\zerocount}
\btxcitereset
@@ -850,6 +858,7 @@
\unexpanded\def\btxsetfirst {\def\currentbtxfirst}
\unexpanded\def\btxsetsecond {\def\currentbtxsecond}
+\unexpanded\def\btxsettag {\def\currentbtxtag}
\unexpanded\def\btxsetinternal{\def\currentbtxinternal}
\unexpanded\def\btxsetconcat#1{\setconstant\currentbtxconcat#1\relax}
@@ -1066,6 +1075,11 @@
[artauthor]
[author]
+\setupbtxcitevariant
+ [\c!author =\btxlistvariantparameter\c!author,
+ \c!etallimit =\btxlistvariantparameter\c!etallimit,
+ \c!etaldisplay =\btxlistvariantparameter\c!etaldisplay]
+
% Do we want these in the format? Loading them delayed is somewhat messy.
\loadbtxdefinitionfile[apa]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 87359fbfc..5480e6dd9 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 1206b6e33..a41068eda 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ