From bb2506852296fa976c95d5b35327a5955d55d789 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Tue, 17 Jun 2014 01:15:04 +0200 Subject: 2014-06-17 00:30:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4350 -> 4348 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/publ-aut.lua | 200 +++++++++++----- tex/context/base/publ-dat.lua | 19 +- tex/context/base/publ-fnd.lua | 71 ++++-- tex/context/base/publ-imp-cite.mkiv | 233 ------------------- tex/context/base/publ-imp-cite.mkvi | 249 ++++++++++++++++++++ tex/context/base/publ-imp-list.mkvi | 74 ++++++ tex/context/base/publ-ini.lua | 257 ++++++++++++--------- tex/context/base/publ-ini.mkiv | 171 +++++++------- tex/context/base/status-files.pdf | Bin 24867 -> 24905 bytes tex/context/base/status-lua.pdf | Bin 247262 -> 247343 bytes tex/context/base/strc-ref.mkvi | 29 +++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 15 files changed, 805 insertions(+), 504 deletions(-) delete mode 100644 tex/context/base/publ-imp-cite.mkiv create mode 100644 tex/context/base/publ-imp-cite.mkvi create mode 100644 tex/context/base/publ-imp-list.mkvi diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 2daba177b..ff7b77c0e 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.06.15 15:54} +\newcontextversion{2014.06.17 00:28} %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 3d9a12dea..56fa75d07 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 816e5a6d2..81a2f6fe8 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.06.15 15:54} +\edef\contextversion{2014.06.17 00:28} \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 f30902ae6..9f100ec42 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -452,73 +452,163 @@ local compare = sorters.comparers.basic -- (a,b) local strip = sorters.strip local splitter = sorters.splitters.utf -function authors.preparedsort(dataset,list,sorttype_a,sorttype_b,sorttype_c) - local luadata = datasets[dataset].luadata - local details = datasets[dataset].details - local valid = { } - local splitted = { } - table.setmetatableindex(splitted,function(t,k) -- could be done in the sorter but seldom that many shared - local v = splitter(k,true) -- in other cases +-- authors(s) | year | journal | title | pages + +local pubsorters = { } +authors.sorters = pubsorters + +-- local function assemble(snippets,key) +-- -- maybe an option is to also sort the authors first +-- if not key then +-- return "" +-- end +-- local n = #key +-- if n == 0 then +-- return "" +-- 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 +-- 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(initials," ") +-- end +-- end +-- local result = concat(snippets," ",1,s) +-- return strip(result) +-- end + +-- local function byauthor(dataset,list,sorttype_a,sorttype_b,sorttype_c) +-- local luadata = datasets[dataset].luadata +-- local details = datasets[dataset].details +-- local valid = { } +-- local splitted = { } +-- table.setmetatableindex(splitted,function(t,k) -- could be done in the sorter but seldom that many shared +-- local v = splitter(k,true) -- in other cases +-- t[k] = v +-- return v +-- end) +-- local snippets = { } +-- for i=1,#list do +-- -- either { tag, tag, ... } or { { tag, index }, { tag, index } } +-- local li = list[i] +-- local tag = type(li) == "string" and li or li[1] +-- local entry = luadata[tag] +-- local detail = details[tag] +-- local suffix = tostring(i) +-- local year = nil +-- local assembled = nil +-- if entry and detail then +-- assembled = assemble(snippets,detail.author or detail.editor) +-- year = entry.year or "9998" +-- else +-- assembled = "" +-- year = "9999" +-- end +-- valid[i] = { +-- index = i, +-- split = { +-- splitted[strip(assembled)], +-- splitted[year], +-- splitted[suffix], +-- splitted[entry.journal or ""], +-- splitted[entry.title or ""], +-- splitted[entry.pages or ""], +-- }, +-- } +-- end +-- return valid +-- end + +local function writer(snippets,key) + if not key then + return "" + end + local n = #key + if n == 0 then + return "" + 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 + 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(initials," ") + end + end + local result = concat(snippets," ",1,s) + return strip(result) +end + +local function newsplitter(splitter) + return table.setmetatableindex({},function(t,k) -- could be done in the sorter but seldom that many shared + local v = splitter(k,true) -- in other cases t[k] = v return v end) - local snippets = { } +end + +local function byauthor(dataset,list,method) -- todo: yearsuffix + local luadata = datasets[dataset].luadata + local details = datasets[dataset].details + local result = { } + local splitted = newsplitter(splitter) -- saves mem + local snippets = { } -- saves mem for i=1,#list do -- either { tag, tag, ... } or { { tag, index }, { tag, index } } - local li = list[i] - local tag = type(li) == "string" and li or li[1] - local entry = luadata[tag] - local detail = details[tag] - local suffix = tostring(i) - local year = nil - local assembled = nil + local li = list[i] + local tag = type(li) == "string" and li or li[1] + local entry = luadata[tag] + local detail = details[tag] if entry and detail then - local key = detail[sorttype_a] or detail[sorttype_b] or detail[sorttype_c] - if key then - -- maybe an option is to also sort the authors first - local n = #key - local s = 0 - for i=1,n do - local k = key[i] - local vons = k.vons - local surnames = k.surnames - local initials = k.initials - 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(initials," ") - end - end - assembled = concat(snippets," ",1,s) - else - assembled = "" - end - year = entry.year or "9998" + result[i] = { + index = i, + split = { + splitted[writer(snippets,detail.author or detail.editor or "")], + splitted[entry.year or "9998"], + splitted[entry.journal or ""], + splitted[entry.title or ""], + splitted[entry.pages or ""], + splitted[tostring(i)], + }, + } else - assembled = "" - year = "9999" + result[i] = { + index = i, + split = { + splitted[""], + splitted["9999"], + splitted[""], + splitted[""], + splitted[""], + splitted[tostring(i)], + }, + } end - valid[i] = { - index = i, - split = { - splitted[strip(assembled)], - splitted[year], - splitted[suffix], - }, --- names = assembled, --- year = year, --- suffix = suffix, - } end - return valid + return result end +authors.sorters.author = byauthor + function authors.sorted(dataset,list,sorttype) -- experimental - local valid = authors.preparedsort(dataset,list,sorttype) + local valid = byauthor(dataset,list,sorttype) if #valid == 0 or #valid ~= #list then return list else diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua index 082b97c3c..a7ed88bc5 100644 --- a/tex/context/base/publ-dat.lua +++ b/tex/context/base/publ-dat.lua @@ -122,6 +122,7 @@ function publications.new(name) suffixes = { }, xmldata = xmlconvert(xmlplaceholder), -- details = { }, + -- ordered = { }, nofbytes = 0, entries = nil, -- empty == all sources = { }, @@ -140,10 +141,20 @@ function publications.new(name) -- depedencies) setmetatableindex(dataset,function(t,k) -- will become a plugin - if k == "details" and publications.enhance then - dataset.details = { } - publications.enhance(dataset.name) - return dataset.details + if k == "details" then + if publications.enhance then + dataset.details = { } + publications.enhance(dataset.name) + return dataset.details + end + elseif k == "ordered" then + local luadata = dataset.luadata + local ordered = sortedkeys(luadata) + for i=1,#ordered do + ordered[i] = luadata[ordered[i]] + end + dataset.ordered = ordered + return ordered end end) return dataset diff --git a/tex/context/base/publ-fnd.lua b/tex/context/base/publ-fnd.lua index 7dd4fd74c..14d65a244 100644 --- a/tex/context/base/publ-fnd.lua +++ b/tex/context/base/publ-fnd.lua @@ -6,14 +6,26 @@ if not modules then modules = { } end modules ['publ-fnd'] = { license = "see context related readme files" } -local tonumber, next = tonumber, next -local P, R, C, Cs, Cp, Carg = lpeg.P, lpeg.R, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Carg +if not characters then + dofile(resolvers.findfile("char-def.lua")) + dofile(resolvers.findfile("char-ini.lua")) + dofile(resolvers.findfile("char-tex.lua")) +end + +if not publications then + publications = { } +end + +local tonumber, next, type = tonumber, next, type +local P, R, C, Cs, Cp, Cc, Carg = lpeg.P, lpeg.R, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Carg local lpegmatch = lpeg.match local concat = table.concat local formatters = string.formatters local lowercase = characters.lower +local report = logs.reporter("publications") + local colon = P(":") local dash = P("-") local lparent = P("(") @@ -51,11 +63,14 @@ local field = (P("field:")/"") * key * Carg(1) / function(_,key,keys) return f_field_match(key) end ------ pattern = Cs((field + range + match + P(1))^1) ------ b_match = P("match")/"" * lparent +----- b_match = lparent +----- e_match = rparent * space^0 * P(-1) +----- pattern = Cs(b_match * ((field + range + match + space + P(1))-e_match)^1 * e_match) + local b_match = lparent -local e_match = rparent * space^0 * P(-1) -local pattern = Cs(b_match * ((field + range + match + space + P(1))-e_match)^1 * e_match) +local e_match = rparent * space^0 * (P(-1) + P(",")/" or ") +local p_match = b_match * ((field + range + match + space + P(1))-e_match)^1 * e_match +local pattern = Cs(Cc("(") * (P("match")/"" * p_match)^1 * Cc(")")) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- @@ -81,17 +96,19 @@ return %s and true or false end ]] ] -local function compile(expr,start) +----- function compile(expr,start) +local function compile(expr) local keys = { } - local expression = lpegmatch(pattern,expr,start,keys) - -- print("!!!!",expression) + -- local expression = lpegmatch(pattern,expr,start,keys) + local expression = lpegmatch(pattern,expr,1,keys) + -- report("compiling expression: %s",expr) local definitions = { } for k, v in next, keys do definitions[#definitions+1] = v end definitions = concat(definitions,"\n") local code = f_template(definitions,expression) - -- print(code) + -- report("generated code: %s",code) code = loadstring(code) if type(code) == "function" then code = code() @@ -99,34 +116,48 @@ local function compile(expr,start) return code end end - print("no valid expression",expression) + report("invalid expression: %s",expr) return false end local cache = { } -- todo: make weak, or just remember the last one (trial typesetting) -local check = P("match") * space^0 * Cp() +local check = P("match") -- * space^0 * Cp() local function finder(expression) local found = cache[expression] if found == nil then - local e = lpegmatch(check,expression) - found = e and compile(expression,e) or false + -- local e = lpegmatch(check,expression) + -- found = e and compile(expression,e) or false + found = lpegmatch(check,expression) and compile(expression) or false + if found then + local okay, message = pcall(found,{}) + if not okay then + found = false + report("error in match: %s",message) + end + end cache[expression] = found end return found end +-- finder("match(author:foo)") +-- finder("match(author:foo and author:bar)") +-- finder("match(author:foo or (author:bar and page:123))") +-- finder("match(author:foo),match(author:foo)") + publications.finder = finder function publications.search(dataset,expression) - local find = finder(expression) - local source = dataset.luadata + local find = finder(expression) if find then - local target = { } - for k, v in next, source do - if find(v) then - target[k] = v + local ordered = dataset.ordered + local target = { } + for i=1,#ordered do + local entry = ordered[i] + if find(entry) then + target[entry.tag] = entry end end return target diff --git a/tex/context/base/publ-imp-cite.mkiv b/tex/context/base/publ-imp-cite.mkiv deleted file mode 100644 index e0b284624..000000000 --- a/tex/context/base/publ-imp-cite.mkiv +++ /dev/null @@ -1,233 +0,0 @@ -%D \module -%D [ file=publ-imp-cite, -%D version=2013.12.24, -%D title=\CONTEXT\ Publication Support, -%D subtitle=XML, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -% The null case: - -\startsetups \s!btx:\s!cite:none - % dummy -\stopsetups - -% This saves keying: - -\startsetups [\s!btx:\s!cite:\s!unknown] - \begingroup - \showmessage\m!publications{13}{\currentbtxcitevariant,\currentbtxtag} - \tttf - <\currentbtxcitevariant:\currentbtxtag> - \endgroup -\stopsetups - -\startsetups \s!btx:\s!cite:common:normal - \ifx\currentbtxfirst\empty - \directsetup{\s!btx:\s!cite:\s!unknown} - \else\ifx\currentbtxsecond\empty - \currentbtxfirst - \else - \currentbtxfirst - \btxcitevariantparameter\v!inbetween - \currentbtxsecond - \fi\fi -\stopsetups - -\startsetups \s!btx:\s!cite:common:range - \ifx\currentbtxfirst\empty - \directsetup{\s!btx:\s!cite:\s!unknown} - \else\ifx\currentbtxsecond\empty - \currentbtxfirst - \else - \currentbtxfirst - \btxcitevariantparameter\c!range - \currentbtxsecond - \fi\fi -\stopsetups - -\startsetups \s!btx:\s!cite:concat - \ifcase\currentbtxconcat \or \or - \btxcitevariantparameter\c!pubsep - \or - \btxcitevariantparameter\c!finalpubsep - \or - \btxcitevariantparameter\c!lastpubsep - \fi -\stopsetups - -\startsetups \s!btx:\s!cite:render:normal - \directsetup{\s!btx:\s!cite:concat} - \ifx\currentbtxfirst\empty - \directsetup{\s!btx:\s!cite:\s!unknown} - \else\ifconditional\btxinteractive - \goto { - \currentbtxfirst - \ifx\currentbtxsecond\empty \else - \btxcitevariantparameter\v!inbetween - \currentbtxsecond - \fi - } [ - \s!internal(\currentbtxinternal) - ] - \else - \currentbtxfirst - \ifx\currentbtxsecond\empty \else - \btxcitevariantparameter\v!inbetween - \currentbtxsecond - \fi - \fi\fi -\stopsetups - -\startsetups \s!btx:\s!cite:render:range - \directsetup{\s!btx:\s!cite:concat} - \ifx\currentbtxfirst\empty - \directsetup{\s!btx:\s!cite:missing} - \else\ifconditional\btxinteractive - \goto { - \currentbtxfirst - \ifx\currentbtxsecond\empty \else - \btxcitevariantparameter\c!range - \currentbtxsecond - \fi - } [ - \s!internal(\currentbtxinternal) - ] - \else - \currentbtxfirst - \ifx\currentbtxsecond\empty \else - \btxcitevariantparameter\c!range - \currentbtxsecond - \fi - \fi\fi -\stopsetups - -\startsetups \s!btx:\s!cite:render:variant - \directsetup{\s!btx:\s!cite:concat} - \ifconditional\btxinteractive - \goto { - \directsetup{\s!btx:\s!cite:render:\currentbtxcitevariant} - } [ - \s!internal(\currentbtxinternal) - ] - \else - \directsetup{\s!btx:\s!cite:render:\currentbtxcitevariant} - \fi -\stopsetups - -% author lists: can be less - -\startsetups \s!btx:\s!cite:common:author - \ifx\currentbtxfirst\empty - \directsetup{\s!btx:\s!cite:\s!unknown} - \else\ifx\currentbtxcitevariant\v!normal - \currentbtxfirst - \else - \currentbtxciteauthor - \fi\fi - \ifx\currentbtxsecond\empty \else - \btxcitevariantparameter\v!inbetween - \currentbtxsecond - \fi -\stopsetups - -\startsetups \s!btx:\s!cite:render:author - \directsetup{\s!btx:\s!cite:common:author} -\stopsetups -\startsetups \s!btx:\s!cite:render:authoryear - \directsetup{\s!btx:\s!cite:common:author} -\stopsetups -\startsetups \s!btx:\s!cite:render:authoryears - \directsetup{\s!btx:\s!cite:common:author} -\stopsetups -\startsetups \s!btx:\s!cite:render:authornum - \directsetup{\s!btx:\s!cite:common:author} -\stopsetups - -\startsetups \s!btx:\s!cite:author:num - \directsetup{\s!btx:\s!cite:render:range} -\stopsetups -\startsetups \s!btx:\s!cite:author:year - \directsetup{\s!btx:\s!cite:render:range} -\stopsetups -\startsetups \s!btx:\s!cite:author:years - \directsetup{\s!btx:\s!cite:render:range} -\stopsetups - -\startsetups \s!btx:\s!cite:author - \directsetup{\s!btx:\s!cite:render:variant} -\stopsetups -\startsetups \s!btx:\s!cite:authoryear - \directsetup{\s!btx:\s!cite:render:variant} -\stopsetups -\startsetups \s!btx:\s!cite:authoryears - \directsetup{\s!btx:\s!cite:render:variant} -\stopsetups -\startsetups \s!btx:\s!cite:authornum - \directsetup{\s!btx:\s!cite:render:variant} -\stopsetups - -\startsetups \s!btx:\s!cite:year - \directsetup{\s!btx:\s!cite:render:range} -\stopsetups -\startsetups \s!btx:\s!cite:short - \directsetup{\s!btx:\s!cite:render:normal} -\stopsetups -\startsetups \s!btx:\s!cite:serial - \directsetup{\s!btx:\s!cite:render:range} -\stopsetups -\startsetups \s!btx:\s!cite:tag - \directsetup{\s!btx:\s!cite:render:normal} -\stopsetups -\startsetups \s!btx:\s!cite:key - \directsetup{\s!btx:\s!cite:render:normal} -\stopsetups -%startsetups \s!btx:\s!cite:doi -% \directsetup{\s!btx:\s!cite:render:normal} -%stopsetups -%startsetups \s!btx:\s!cite:url -% \directsetup{\s!btx:\s!cite:render:normal} -%stopsetups -\startsetups \s!btx:\s!cite:category - \directsetup{\s!btx:\s!cite:render:normal} -\stopsetups -\startsetups \s!btx:\s!cite:type - \directsetup{\s!btx:\s!cite:render:normal} -\stopsetups -\startsetups \s!btx:\s!cite:num - \directsetup{\s!btx:\s!cite:render:range} -\stopsetups -\startsetups \s!btx:\s!cite:page - \directsetup{\s!btx:\s!cite:render:normal} -\stopsetups - -\startsetups \s!btx:\s!cite:render:doi - \ifx\currentbtxfirst\empty - \directsetup{\s!btx:\s!cite:\s!unknown} - \else - \hyphenatedurl{\currentbtxfirst} - \fi -\stopsetups - -\startsetups \s!btx:\s!cite:url - \ifx\currentbtxfirst\empty - \directsetup{\s!btx:\s!cite:\s!unknown} - \else\ifconditional\btxinteractive - \goto { - \hyphenatedurl{\currentbtxfirst} - } [ - url(\currentbtxfirst) - ] - \else - \hyphenatedurl{\currentbtxfirst} - \fi\fi -\stopsetups - -\protect diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi new file mode 100644 index 000000000..20f9e24f8 --- /dev/null +++ b/tex/context/base/publ-imp-cite.mkvi @@ -0,0 +1,249 @@ +%D \module +%D [ file=publ-imp-cite, +%D version=2013.12.24, +%D title=\CONTEXT\ Publication Support, +%D subtitle=Citations, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\starttexdefinition btx:cite:inject #content + \ifconditional\btxinteractive + \ifx\currentbtxinternal\empty + #content + \else + \goto { + #content + } [ + \s!internal(\currentbtxinternal) + ] + \fi + \else + #content + \fi +\stoptexdefinition + +\starttexdefinition btx:cite:checkconcat + \ifnum\currentbtxcount>\zerocount + \let\currentbtxinternal\empty + \let\currentbtxbacklink\empty + \fi +\stoptexdefinition + +% The null case: + +\startsetups \s!btx:\s!cite:none + % dummy +\stopsetups + +% This saves keying: + +\startsetups [\s!btx:\s!cite:\s!unknown] + \begingroup + \showmessage\m!publications{13}{\currentbtxcitevariant,\currentbtxtag} + \tttf + <\currentbtxcitevariant:\currentbtxtag> + \endgroup +\stopsetups + +\startsetups \s!btx:\s!cite:common:normal + \ifx\currentbtxfirst\empty + \directsetup{\s!btx:\s!cite:\s!unknown} + \else\ifx\currentbtxsecond\empty + \btxcitereference + \currentbtxfirst + \else + \btxcitereference + \currentbtxfirst + \btxcitevariantparameter\v!inbetween + \currentbtxsecond + \fi\fi +\stopsetups + +\startsetups \s!btx:\s!cite:common:range + \ifx\currentbtxfirst\empty + \directsetup{\s!btx:\s!cite:\s!unknown} + \else\ifx\currentbtxsecond\empty + \btxcitereference + \currentbtxfirst + \else + \btxcitereference + \currentbtxfirst + \btxcitevariantparameter\c!range + \currentbtxsecond + \fi\fi +\stopsetups + +\startsetups \s!btx:\s!cite:concat + \ifcase\currentbtxconcat \or \or + \btxcitevariantparameter\c!pubsep + \or + \btxcitevariantparameter\c!finalpubsep + \or + \btxcitevariantparameter\c!lastpubsep + \fi +\stopsetups + +\startsetups \s!btx:\s!cite:render:normal + \directsetup{\s!btx:\s!cite:concat} + \ifx\currentbtxfirst\empty + \directsetup{\s!btx:\s!cite:\s!unknown} + \else + \texdefinition {btx:cite:inject} { + \btxcitereference + \currentbtxfirst + \ifx\currentbtxsecond\empty \else + \btxcitevariantparameter\v!inbetween + \currentbtxsecond + \fi + } + \fi +\stopsetups + +\startsetups \s!btx:\s!cite:render:range + \directsetup{\s!btx:\s!cite:concat} + \ifx\currentbtxfirst\empty + \directsetup{\s!btx:\s!cite:missing} + \else + \texdefinition {btx:cite:inject} { + \btxcitereference + \currentbtxfirst + \ifx\currentbtxsecond\empty \else + \btxcitevariantparameter\c!range + \currentbtxsecond + \fi + } + \fi +\stopsetups + +\startsetups \s!btx:\s!cite:render:variant + \directsetup{\s!btx:\s!cite:concat} + \texdefinition {btx:cite:inject} { + \directsetup{\s!btx:\s!cite:render:\currentbtxcitevariant} + } +\stopsetups + +% author lists: can be less + +\startsetups \s!btx:\s!cite:common:author + \ifx\currentbtxfirst\empty + \directsetup{\s!btx:\s!cite:\s!unknown} + \else\ifx\currentbtxcitevariant\v!normal + \btxcitereference + \currentbtxfirst + \else + \btxcitereference + \currentbtxciteauthor + \fi\fi + \ifx\currentbtxsecond\empty \else + \btxcitevariantparameter\v!inbetween + \currentbtxsecond + \fi +\stopsetups + +\startsetups \s!btx:\s!cite:render:author + \directsetup{\s!btx:\s!cite:common:author} +\stopsetups +\startsetups \s!btx:\s!cite:render:authoryear + \directsetup{\s!btx:\s!cite:common:author} +\stopsetups +\startsetups \s!btx:\s!cite:render:authoryears + \directsetup{\s!btx:\s!cite:common:author} +\stopsetups +\startsetups \s!btx:\s!cite:render:authornum + \directsetup{\s!btx:\s!cite:common:author} +\stopsetups + +\startsetups \s!btx:\s!cite:author:num + \directsetup{\s!btx:\s!cite:render:range} +\stopsetups +\startsetups \s!btx:\s!cite:author:year + \directsetup{\s!btx:\s!cite:render:range} +\stopsetups +\startsetups \s!btx:\s!cite:author:years + \directsetup{\s!btx:\s!cite:render:range} +\stopsetups + +\startsetups \s!btx:\s!cite:author + \texdefinition{btx:cite:checkconcat} + \directsetup{\s!btx:\s!cite:render:variant} +\stopsetups +\startsetups \s!btx:\s!cite:authoryear + \texdefinition{btx:cite:checkconcat} + \directsetup{\s!btx:\s!cite:render:variant} +\stopsetups +\startsetups \s!btx:\s!cite:authoryears + \texdefinition{btx:cite:checkconcat} + \directsetup{\s!btx:\s!cite:render:variant} +\stopsetups +\startsetups \s!btx:\s!cite:authornum + \texdefinition{btx:cite:checkconcat} + \directsetup{\s!btx:\s!cite:render:variant} +\stopsetups + +\startsetups \s!btx:\s!cite:year + \directsetup{\s!btx:\s!cite:render:range} +\stopsetups +\startsetups \s!btx:\s!cite:short + \directsetup{\s!btx:\s!cite:render:normal} +\stopsetups +\startsetups \s!btx:\s!cite:serial + \directsetup{\s!btx:\s!cite:render:range} +\stopsetups +\startsetups \s!btx:\s!cite:tag + \directsetup{\s!btx:\s!cite:render:normal} +\stopsetups +\startsetups \s!btx:\s!cite:key + \directsetup{\s!btx:\s!cite:render:normal} +\stopsetups +%startsetups \s!btx:\s!cite:doi +% \directsetup{\s!btx:\s!cite:render:normal} +%stopsetups +%startsetups \s!btx:\s!cite:url +% \directsetup{\s!btx:\s!cite:render:normal} +%stopsetups +\startsetups \s!btx:\s!cite:category + \directsetup{\s!btx:\s!cite:render:normal} +\stopsetups +\startsetups \s!btx:\s!cite:type + \directsetup{\s!btx:\s!cite:render:normal} +\stopsetups +\startsetups \s!btx:\s!cite:num + \directsetup{\s!btx:\s!cite:render:range} +\stopsetups +\startsetups \s!btx:\s!cite:page + \directsetup{\s!btx:\s!cite:render:normal} +\stopsetups + +\startsetups \s!btx:\s!cite:render:doi + \ifx\currentbtxfirst\empty + \directsetup{\s!btx:\s!cite:\s!unknown} + \else + \btxcitereference + \hyphenatedurl{\currentbtxfirst} + \fi +\stopsetups + +\startsetups \s!btx:\s!cite:url + \ifx\currentbtxfirst\empty + \directsetup{\s!btx:\s!cite:\s!unknown} + \else\ifconditional\btxinteractive + \goto { + \btxcitereference + \hyphenatedurl{\currentbtxfirst} + } { + url(\currentbtxfirst) + } + \else + \btxcitereference + \hyphenatedurl{\currentbtxfirst} + \fi\fi +\stopsetups + +\protect diff --git a/tex/context/base/publ-imp-list.mkvi b/tex/context/base/publ-imp-list.mkvi new file mode 100644 index 000000000..881e80a79 --- /dev/null +++ b/tex/context/base/publ-imp-list.mkvi @@ -0,0 +1,74 @@ +%D \module +%D [ file=publ-imp-list, +%D version=2014.06.16, +%D title=\CONTEXT\ Publication Support, +%D subtitle=Lists, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\starttexdefinition btx:list:inject #content + \ifconditional\btxinteractive + \ifx\currentbtxinternal\empty + #content + \else + \goto { + #content + } [ + \s!internal(\currentbtxinternal) + ] + \fi + \else + #content + \fi +\stoptexdefinition + +\startsetups \s!btx:\s!list:concat +% \ifcase\currentbtxconcat \or \or +% \btxcitevariantparameter\c!pubsep +% \or +% \btxcitevariantparameter\c!finalpubsep +% \or +% \btxcitevariantparameter\c!lastpubsep +% \fi + \space +\stopsetups + +\startsetups \s!btx:\s!list:page + \directsetup{\s!btx:\s!list:concat} + \texdefinition {btx:list:inject} { + \currentbtxfirst + \high{\currentbtxsecond} + } +\stopsetups + +\startsetups \s!btx:\s!list:yes + \texdefinition {btx:list:inject} { + \currentbtxfirst + } +\stopsetups + +\startsetups \s!btx:\s!list:short + \texdefinition {btx:list:inject} { + \currentbtxfirst + \currentbtxsecond + } +\stopsetups + +\startsetups \s!btx:\s!list:num + \directsetup{\s!btx:\s!list:yes} +\stopsetups +\startsetups \s!btx:\s!list:bib + \directsetup{\s!btx:\s!list:yes} +\stopsetups +\startsetups \s!btx:\s!list:unknown + \directsetup{\s!btx:\s!list:yes} +\stopsetups + +\protect diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index f6567402d..cd65f65bc 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -12,6 +12,7 @@ local next, rawget, type, tostring, tonumber = next, rawget, type, tostring, ton local match, gmatch, format, gsub, find = string.match, string.gmatch, string.format, string.gsub, string.find local concat, sort, tohash = table.concat, table.sort, table.tohash local utfsub = utf.sub +local mod = math.mod local formatters = string.formatters local allocate = utilities.storage.allocate local settings_to_array, settings_to_set = utilities.parsers.settings_to_array, utilities.parsers.settings_to_set @@ -109,9 +110,12 @@ local ctx_btxsetsecond = context.btxsetsecond local ctx_btxsetinternal = context.btxsetinternal local ctx_btxsetbacklink = context.btxsetbacklink local ctx_btxsetbacktrace = context.btxsetbacktrace +local ctx_btxsetcount = context.btxsetcount +----- ctx_btxsetrealpage = context.btxsetrealpage local ctx_btxsetconcat = context.btxsetconcat local ctx_btxstartsubcite = context.btxstartsubcite local ctx_btxstopsubcite = context.btxstopsubcite +local ctx_btxlistsetup = context.btxlistsetup statistics.register("publications load time", function() local publicationsstats = publications.statistics @@ -330,13 +334,14 @@ local reported = { } local finder = publications.finder local function findallused(dataset,reference,internal) - local finder = publications.finder -- for the moment, not yes in all betas - local find = finder and finder(reference) - local tags = not find and settings_to_array(reference) - local todo = { } - local okay = { } -- only if mark - local set = usedentries[dataset] - local valid = datasets[dataset].luadata + local finder = publications.finder -- for the moment, not yet in all betas + local find = finder and finder(reference) + local tags = not find and settings_to_array(reference) + local todo = { } + local okay = { } -- only if mark + local set = usedentries[dataset] + local valid = datasets[dataset].luadata + local ordered = datasets[dataset].ordered if set then local function register(tag) local entry = set[tag] @@ -381,9 +386,10 @@ local function findallused(dataset,reference,internal) end if find then tags = { } - for tag, entry in sortedhash(valid) do - local found = find(entry) - if found then + for i=1,#ordered do + local entry = ordered[i] + if find(entry) then + local tag = entry.tag register(tag) tags[#tags+1] = tag end @@ -402,11 +408,10 @@ local function findallused(dataset,reference,internal) else if find then tags = { } - for tag, entry in sortedhash(valid) do - local found = find(entry) - if found then - todo[tag] = true - tags[#tags+1] = tag + for i=1,#ordered do + local entry = ordered[i] + if find(entry) then + tags[#tags+1] = entry.tag end end else @@ -441,22 +446,58 @@ local function flushcollected(reference,flush,nofcollected) end end -local function markcite(dataset,tag,internal) - if trace_cite then - report_cite("mark, dataset: %s, tag: %s, internal: %s",dataset,tag,internal) +local tobemarked = nil + +local function markcite(dataset,tag,flush) + if not tobemarked then + return 0 + end + local citation = tobemarked[tag] + if not citation then + return 0 + end + if citation == true then + nofcitations = nofcitations + 1 + if trace_cite then + report_cite("mark, dataset: %s, tag: %s, number: %s, state: %s",dataset,tag,nofcitations,"cited") + end + if flush then + ctx_btxdomarkcitation(dataset,tag,nofcitations) + end + tobemarked[tag] = nofcitations + return nofcitations + else + return citation end - ctx_btxdomarkcitation(dataset,tag,internal or 0) end +local marked_dataset = nil +local marked_list = nil + local function flushmarked(dataset,list,todo) - if todo then - for i=1,#list do - local tag = list[i] - if todo[tag] then - markcite(dataset,tag,0) + marked_dataset = dataset + marked_list = list +end + +function commands.flushmarked() + if marked_list then + for i=1,#marked_list do + -- keep order + local tag = marked_list[i] + local tbm = tobemarked[tag] + if not tbm or tbm == true then + nofcitations = nofcitations + 1 + ctx_btxdomarkcitation(marked_dataset,tag,nofcitations) + if trace_cite then + report_cite("mark, dataset: %s, tag: %s, number: %s, state: %s",dataset,tag,nofcitations,"unset") + end + else end end end + tobemarked = nil + marked_dataset = nil + marked_list = nil end -- basic access @@ -533,6 +574,7 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi end local luadata = dataset.luadata local details = dataset.details + local ordered = dataset.ordered -- author, editor for tag, entry in next, luadata do local author = entry.author @@ -544,7 +586,9 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi end -- short local shorts = { } - for tag, entry in next, luadata do + for i=1,#ordered do + local entry = ordered[i] + local tag = entry.tag local author = details[tag].author if author then -- number depends on sort order @@ -563,7 +607,7 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi end end local year = tonumber(entry.year) or 0 - local short = formatters["%t%02i"](t,math.mod(year,100)) + local short = formatters["%t%02i"](t,mod(year,100)) local s = shorts[short] if not s then shorts[short] = tag @@ -575,8 +619,19 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi else -- end + -- + local pages = entry.pages + if pages then + local first, last = lpegmatch(pagessplitter,pages) + details[tag].pages = first and last and { first, last } or pages + end + -- + local keyword = entry.keyword + if keyword then + details[tag].keyword = settings_to_set(keyword) + end end - for short, tags in next, shorts do + for short, tags in next, shorts do -- ordered ? if type(tags) == "table" then sort(tags) for i=1,#tags do @@ -589,21 +644,6 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi details[tags].short = short end end - -- pages - for tag, entry in next, luadata do - local pages = entry.pages - if pages then - local first, last = lpegmatch(pagessplitter,pages) - details[tag].pages = first and last and { first, last } or pages - end - end - -- keywords - for tag, entry in next, luadata do - local keyword = entry.keyword - if keyword then - details[tag].keyword = settings_to_set(keyword) - end - end statistics.stoptiming(publications) end @@ -959,7 +999,7 @@ function lists.collectentries(specification) end elseif method == v_dataset then local luadata = datasets[dataset].luadata - for tag, data in table.sortedhash(luadata) do + for tag, data in sortedhash(luadata) do if not keyword or validkeyword(dataset,tag,keyword) then list[#list+1] = { tag } end @@ -1014,7 +1054,7 @@ lists.sorters = { -- sort(list,compare) -- end, [v_author] = function(dataset,rendering,list) - local valid = publications.authors.preparedsort(dataset,list,v_author,v_editor) + local valid = publications.authors.sorters.author(dataset,list) if #valid == 0 or #valid ~= #list then -- nothing to sort else @@ -1225,7 +1265,7 @@ function commands.btxhandlenocite(specification) report_cite("mark, dataset: %s, tags: % | t",dataset or "-",tags) end for i=1,#tags do - markcite(dataset,tags[i],0) + markcite(dataset,tags[i],true) end end @@ -1338,6 +1378,7 @@ local f_missing = formatters["<%s>"] local function processcite(dataset,reference,mark,compress,setup,internal,getter,setter,compressor) reference = publications.parenttag(dataset,reference) local found, todo, list = findallused(dataset,reference,internal) + tobemarked = mark and todo if found and setup then local source = { } local badkey = false @@ -1364,21 +1405,14 @@ local function processcite(dataset,reference,mark,compress,setup,internal,getter if compress and not badkey then local target = (compressor or compresslist)(source) local function flush(i,state) - nofcitations = nofcitations + 1 local entry = target[i] local first = entry.first if first then - local tags = entry.tags - if mark then - for i=1,#tags do - local tag = tags[i] - markcite(dataset,tag,nofcitations) - todo[tag] = false - end - end - ctx_btxsettag(tags[1]) - ctx_btxsetbacklink(nofcitations) - local bl = listtocite[nofcitations] + local tag = tags[1] + local currentcitation = markcite(dataset,tag) + ctx_btxsettag(tag) + ctx_btxsetbacklink(currentcitation) + local bl = listtocite[currentcitation] ctx_btxsetinternal(bl and bl.references.internal or 0) local language = first.language if language then @@ -1389,13 +1423,10 @@ local function processcite(dataset,reference,mark,compress,setup,internal,getter end else local tag = entry.tag - if mark then - markcite(dataset,tag,nofcitations) - todo[tag] = false - end + local currentcitation = markcite(dataset,tag) ctx_btxsettag(tag) - ctx_btxsetbacklink(nofcitations) - local bl = listtocite[nofcitations] + ctx_btxsetbacklink(currentcitation) + local bl = listtocite[currentcitation] ctx_btxsetinternal(bl and bl.references.internal or 0) local language = entry.language if language then @@ -1411,16 +1442,12 @@ local function processcite(dataset,reference,mark,compress,setup,internal,getter flushcollected(reference,flush,#target) else local function flush(i,state) - nofcitations = nofcitations + 1 local entry = source[i] - local tag = entry.tag - if mark then - markcite(dataset,tag,nofcitations) - todo[tag] = false - end + local tag = entry.tag + local currentcitation = markcite(dataset,tag) ctx_btxsettag(tag) - ctx_btxsetbacklink(nofcitations) - local bl = listtocite[nofcitations] + ctx_btxsetbacklink(currentcitation) + local bl = listtocite[currentcitation] ctx_btxsetinternal(bl and bl.references.internal or 0) local language = entry.language if language then @@ -1435,11 +1462,10 @@ local function processcite(dataset,reference,mark,compress,setup,internal,getter flushcollected(reference,flush,#source) end end - if mark then - flushmarked(dataset,list,todo) - end + flushmarked(dataset,list) end + local function simplegetter(first,last,field) local value = first[field] if value then @@ -1722,11 +1748,13 @@ local function authorconcat(target,key,setup) local function flush(i,state) local entry = target[i] local first = entry.first + local tag = entry.tag + local currentcitation = markcite(entry.dataset,tag) + ctx_btxsettag(tag) + ctx_btxsetbacklink(currentcitation) + local bl = listtocite[currentcitation] + ctx_btxsetinternal(bl and bl.references.internal or 0) if first then - local internal = first.internal - if internal then - ctx_btxsetinternal(internal) - end ctx_btxsetfirst(first[key] or f_missing(first.tag)) local suffix = entry.suffix local value = entry.last[key] @@ -1736,12 +1764,8 @@ local function authorconcat(target,key,setup) ctx_btxsetsecond(value) end else - local internal = entry.internal - if internal then - ctx_btxsetinternal(internal) - end local suffix = entry.suffix - local value = entry[key] or f_missing(entry.tag) + local value = entry[key] or f_missing(tag) if suffix then ctx_btxsetfirst(value .. converters.characters(suffix)) else @@ -1757,14 +1781,15 @@ local function authorconcat(target,key,setup) end local function authorsingle(entry,key,setup) - ctx_btxstartsubcite(setup) - local internal = entry.internal - if internal then - ctx_btxsetinternal(internal) - end - ctx_btxsetfirst(entry[key] or f_missing(entry.tag)) - ctx_btxcitesetup(setup) -- ?? - ctx_btxstopsubcite() + -- alternatively we can use a concat with one ... so that we can only make the + -- year interactive, as with the concat + ctx_btxcitesetup(setup) + local tag = entry.tag + ctx_btxsettag(tag) + local currentcitation = markcite(entry.dataset,tag) + ctx_btxsetbacklink(currentcitation) + local bl = listtocite[currentcitation] + ctx_btxsetinternal(bl and bl.references.internal or 0) end local function authorgetter(first,last,key,setup) -- only first @@ -1772,8 +1797,10 @@ local function authorgetter(first,last,key,setup) -- only first local entries = first.entries if entries then local c = compresslist(entries) + ctx_btxsetcount(#c) ctx_btxsetsecond(function() authorconcat(c,key,setup) end) else + ctx_btxsetcount(0) ctx_btxsetsecond(function() authorsingle(first,key,setup) end) end return true @@ -1856,29 +1883,47 @@ function commands.btxlistvariant(dataset,block,tag,variant,listindex) end function listvariants.default(dataset,block,tag,variant) - context("?") + ctx_btxsetfirst("?") + ctx_btxlistsetup(variant) end --- function listvariants.num(dataset,block,tag,variant,listindex) --- local lst = f_listentry(dataset,block,tag) --- local ref = f_reference(dataset,block,tag) --- if trace_references then --- report_reference("list: %s",lst) --- end --- -- todo --- ctx_btxdirectlink(ref,listindex) -- a goto --- end - function listvariants.num(dataset,block,tag,variant,listindex) - context(listindex) -- a goto + ctx_btxsetfirst(listindex) + ctx_btxlistsetup(variant) end function listvariants.short(dataset,block,tag,variant,listindex) local short = getdetail(dataset,tag,"short","short") local suffix = getdetail(dataset,tag,"suffix","suffix") + if short then + ctx_btxsetfirst(short) + end if suffix then - context(short .. suffix) - elseif short then - context(short) + ctx_btxsetsecond(suffix) + end + ctx_btxlistsetup(variant) +end + +function listvariants.page(dataset,block,tag,variant,listindex) + local rendering = renderings[dataset] + local specification = rendering.list[listindex] + for i=3,#specification do + local backlink = tonumber(specification[i]) + if backlink then + local citation = citetolist[backlink] + if citation then + local references = citation.references + if references then + local internal = references.internal + local realpage = references.realpage + if internal and realpage then + ctx_btxsetconcat(i-2) + ctx_btxsetfirst(realpage) + ctx_btxsetsecond(backlink) + ctx_btxlistsetup(variant) + end + end + end + end end end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index f70628bad..1048fd663 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -86,10 +86,17 @@ \endgroup} \unexpanded\setvalue{\??constructionstarthandler\v!btxlist}% - {\csname\??constructionstarthandler\v!construction\endcsname} + {\csname\??constructionstarthandler\v!construction\endcsname + %\ifx\currentbtxnumbering\empty\else + % \startgoto[\s!internal(\currentbtxinternal)]% + %\fi + } \unexpanded\setvalue{\??constructionstophandler\v!btxlist}% - {\csname\??constructionstophandler\v!construction\endcsname + {%\ifx\currentbtxnumbering\empty\else + % \stopgoto + %\fi + \csname\??constructionstophandler\v!construction\endcsname \endgroup} \unexpanded\def\startbtxlistentry#1% @@ -102,7 +109,13 @@ \unexpanded\setvalue{\??constructiontexthandler\v!btxlist}% {\begingroup + \ifx\currentbtxnumbering\empty\else + \startgoto[\s!internal(\currentbtxinternal)]% + \fi \directsetup{\v!btxrendering:\v!number:\constructionparameter\c!number}% + \ifx\currentbtxnumbering\empty\else + \stopgoto + \fi \endgroup} \startsetups[\v!btxrendering:\v!number:\v!no] @@ -113,20 +126,11 @@ \useconstructionstyleandcolor\c!headstyle\c!headcolor % move to \currentconstructiontext \the\everyconstruction \relax - \iflocation - \goto - {\publ_list_number_normal}% - [\s!internal(\currentbtxinternal)]% - \else - \publ_list_number_normal - \fi -\stopsetups - -\unexpanded\def\publ_list_number_normal - {\strut + \strut \constructionparameter\c!text \btx_list_reference_inject - \relax} + \relax +\stopsetups % todo: low level builder commands without using the constructor @@ -202,7 +206,7 @@ \installcorenamespace {btxcitevariant} \installcorenamespace {btxrendering} \installcorenamespace {btxcommand} -\installcorenamespace {btxnumbering} +%installcorenamespace {btxnumbering} \installcorenamespace {btxrenderingdefinition} \installcommandhandler \??btxdataset {btxdataset} \??btxdataset @@ -510,8 +514,7 @@ keyword = "\btxrenderingparameter\c!keyword", }}% % next we analyze the width - \ifx\btx_list_reference_inject_indeed\relax - \else + \ifx\currentbtxnumbering\empty \else \edef\p_width{\btxrenderingparameter\c!width}% \ifx\p_width\v!auto \scratchcounter\btxlistcounter @@ -546,14 +549,16 @@ \endgroup} \unexpanded\def\btxlistreset - {\let\currentbtxindex \!!zerocount - \let\currentbtxcombis \empty - \let\currentbtxcategory \empty - \let\currentbtxinternal \empty - \let\currentbtxbacklink \empty - \let\currentbtxbacktrace\empty - \let\currentbtxlanguage \empty - \let\currentbtxtag \empty} + {\let \currentbtxindex \!!zerocount % can be a constant + \let \currentbtxcombis \empty + \let \currentbtxcategory \empty + \let \currentbtxinternal \empty + \let \currentbtxbacklink \empty + \let \currentbtxbacktrace\empty + \let \currentbtxlanguage \empty + \let \currentbtxtag \empty + %setconstant\currentbtxrealpage \zerocount + } \unexpanded\def\btxsetindex {\def\currentbtxindex} \unexpanded\def\btxsetcombis {\def\currentbtxcombis} @@ -600,9 +605,20 @@ \hbox{\btx_reference_checked}% \par} +\unexpanded\def\btxlistsetup#1% + {\directsetup{\s!btx:\s!list:#1}} + +\unexpanded\def\btx_reference_indeed + {\begingroup + \let\currentbtxlistvariant\currentbtxnumbering + \btxlistvariantparameter\c!left + \ctxcommand{btxlistvariant("\currentbtxdataset","\currentbtxblock","\currentbtxtag","\currentbtxnumbering","\number\btxlistcounter")}% some can go + \btxlistvariantparameter\c!right + \endgroup} + \unexpanded\def\btx_reference_checked {\dontleavehmode\hbox\bgroup - \btx_list_reference_inject_indeed + \btx_reference_indeed \egroup} \newcount\c_btx_list_reference @@ -612,7 +628,7 @@ \iftrialtypesetting\else \btx_list_reference_inject_now \fi - \btx_list_reference_inject_indeed % needs checking ... still needed? + \btx_reference_indeed \endgroup} \def\btx_list_reference_inject_now @@ -623,35 +639,37 @@ {\s!btx::\v!list::\number\c_btx_list_reference}% {\number\btxlistcounter}} -\unexpanded\def\btx_cite_reference_inject % todo: wrap whole content? - {\dontleavehmode\begingroup % no box - \iftrialtypesetting \else - \btx_trace_list_cross\currentbtxbacklink\empty - \fi - \endgroup} +\unexpanded\def\btx_cite_reference_inject + {\dontleavehmode + \iftrialtypesetting \else + \ifx\currentbtxbacklink\empty + % can be made empty when combining author / year + \else + \btx_trace_list_cross\currentbtxbacklink\empty + \normalexpanded{\writedatatolist[\s!btx][\s!btxset=\currentbtxdataset,\s!btxref=\currentbtxtag,\s!btxint=\number\currentbtxbacklink]}% % \c!location=\v!here + \fi + \fi} -% \let\btxcitereference\btx_cite_reference_inject -\let\btxcitereference\relax +\let\btxcitereference\btx_cite_reference_inject -\setuvalue{\??btxnumbering\v!short }{\btxlistvariant{short}} % these will be setups -\setuvalue{\??btxnumbering\v!bib }{\btxlistvariant{num}} % these will be setups -\setuvalue{\??btxnumbering\s!unknown}{\btxlistvariant{num}} % these will be setups -\setuvalue{\??btxnumbering\v!yes }{\btxlistvariant{num}} % these will be setups +% \setuvalue{\??btxnumbering\v!page }{\btxlistvariant{page}} % these will be setups +% \setuvalue{\??btxnumbering\v!short }{\btxlistvariant{short}} % these will be setups +% \setuvalue{\??btxnumbering\v!bib }{\btxlistvariant{num}} % these will be setups +% \setuvalue{\??btxnumbering\s!unknown}{\btxlistvariant{num}} % these will be setups +% \setuvalue{\??btxnumbering\v!yes }{\btxlistvariant{num}} % these will be setups + +\let\currentbtxnumbering\empty \appendtoks - \edef\p_btx_numbering{\btxrenderingparameter\c!numbering}% + \edef\currentbtxnumbering{\btxrenderingparameter\c!numbering}% \letlistparameter\c!numbercommand\firstofoneargument % for the moment, no doubling needed - \ifx\p_btx_numbering\v!no + \ifx\currentbtxnumbering\v!no \letlistparameter\c!textcommand\outdented % needed? we can use titlealign \letlistparameter\c!symbol \v!none \letlistparameter\c!aligntitle \v!yes - \let\btx_list_reference_inject_indeed\relax + \let\currentbtxnumbering\empty \else - \ifcsname\??btxnumbering\p_btx_numbering\endcsname \else - \let\p_btx_numbering\s!unknown - \fi \letlistparameter\c!headnumber\v!always - \expandafter\let\expandafter\btx_list_reference_inject_indeed\csname\??btxnumbering\p_btx_numbering\endcsname \fi \to \everysetupbtxlistplacement @@ -735,19 +753,6 @@ \fi \to \everysetupbtxciteplacement -% these will go away or at least need to be checked: - -% \unexpanded\def\btxgotolink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{#1}} -% \unexpanded\def\btxatlink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{#1}} -% \unexpanded\def\btxinlink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{#1}} - -% \unexpanded\def\btxdirectlink#1#2{\goto{#2 {\tttf[#1]}}[#1]} -% \unexpanded\def\btxdirectlink#1#2{\goto{#2}[#1]} - -% \let\gotobiblink\btxgotolink -% \let\atbiblink \btxatlink -% \let\inbiblink \btxinlink - \appendtoks % for old times sake, for a while at least \let\maybeyear\gobbleoneargument @@ -791,7 +796,7 @@ \def\publ_cite_mark_citation#1#2#3% called from lua end {\dontleavehmode - \normalexpanded{\writedatatolist[\s!btx][\s!btxset=#1,\s!btxref=#2,\s!btxint=\number#3]}} % \c!location=\v!here + \normalexpanded{\writedatatolist[\s!btx][\s!btxset=#1,\s!btxref=#2,\s!btxint=\number#3]}}% \c!location=\v!here for nocite? %D \macros{cite,nocite,citation,nocitation,usecitation} %D @@ -903,6 +908,7 @@ author = "\btxcitevariantparameter\c!author",% }}% \btxcitevariantparameter\v!right + \ctxcommand{flushmarked()}% \endgroup} \unexpanded\def\btxcitation @@ -943,30 +949,36 @@ %D Cite helpers: \newconstant\currentbtxconcat +\newconstant\currentbtxcount +%newconstant\currentbtxrealpage \unexpanded\def\btxcitereset - {\let\currentbtxfirst \empty - \let\currentbtxsecond \empty - \let\currentbtxinternal \empty - \let\currentbtxbacklink \empty - \let\currentbtxbacktrace\empty - \let\currentbtxlanguage \empty - \let\currentbtxtag \empty - \setconstant\currentbtxconcat\zerocount} + {\let \currentbtxfirst \empty + \let \currentbtxsecond \empty + \let \currentbtxinternal \empty + \let \currentbtxbacklink \empty + \let \currentbtxbacktrace\empty % not used here + \let \currentbtxlanguage \empty + \let \currentbtxtag \empty + %setconstant\currentbtxrealpage \zerocount + \setconstant\currentbtxconcat \zerocount + \setconstant\currentbtxcount \zerocount} \btxcitereset \unexpanded\def\btxcitesetup#1% - {\btx_cite_reference_inject + {%\btx_cite_reference_inject \directsetup{btx:cite:#1}% \btxcitereset} -\unexpanded\def\btxsetfirst {\def\currentbtxfirst} -\unexpanded\def\btxsetsecond {\def\currentbtxsecond} -\unexpanded\def\btxsettag {\def\currentbtxtag} -\unexpanded\def\btxsetinternal{\def\currentbtxinternal} -%unexpanded\def\btxsetlanguage{\def\currentbtxlanguage} -\unexpanded\def\btxsetconcat#1{\setconstant\currentbtxconcat#1\relax} +\unexpanded\def\btxsetfirst {\def\currentbtxfirst} +\unexpanded\def\btxsetsecond {\def\currentbtxsecond} +\unexpanded\def\btxsettag {\def\currentbtxtag} +%unexpanded\def\btxsetlanguage {\def\currentbtxlanguage} +\unexpanded\def\btxsetinternal {\def\currentbtxinternal} +\unexpanded\def\btxsetcount #1{\setconstant\currentbtxcount #1\relax} +\unexpanded\def\btxsetconcat #1{\setconstant\currentbtxconcat #1\relax} +%unexpanded\def\btxsetrealpage #1{\setconstant\currentbtxrealpage#1\relax} \unexpanded\def\btxstartsubcite#1% {\bgroup @@ -983,14 +995,6 @@ \let\currentbtxindex \!!zerocount \let\currentbtxcategory\empty -\unexpanded\def\btxlistvariant#1% was \currentbtxindex - {\begingroup - \edef\currentbtxlistvariant{#1}% - \btxlistvariantparameter\c!left - \ctxcommand{btxlistvariant("\currentbtxdataset","\currentbtxblock","\currentbtxtag","#1","\number\btxlistcounter")}% some can go - \btxlistvariantparameter\c!right - \endgroup} - %D Whatever helpers: \unexpanded\def\btxsingularplural#1% @@ -1239,6 +1243,7 @@ \loadbtxdefinitionfile[apa] \loadbtxdefinitionfile[cite] +\loadbtxdefinitionfile[list] \loadbtxdefinitionfile[commands] \loadbtxdefinitionfile[definitions] diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 3a2a70a01..e8fc3b789 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 1c9f6bd8d..6869953cd 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index 7d9c1c526..87a3ee478 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -1358,6 +1358,35 @@ %\egroup\unhbox\referencebox} \endgroup} +\unexpanded\def\startgoto[#label]% + {\dontleavehmode + \begingroup + \iflocation + \ctxcommand{doifelsereference("\referenceprefix","#label",\extrareferencearguments)}{\expandafter\startgoto_yes}{\expandafter\startgoto_nop}% + \else + \expandafter\startgoto_nop + \fi} + +\unexpanded\def\startgoto_nop + {\let\stopgoto\stopgoto_nop} + +\unexpanded\def\stopgoto_nop + {\endgroup} + +\unexpanded\def\startgoto_yes + {\expandtexincurrentreference + \ctxcommand{injectcurrentreference(\number\ht\strutbox,\number\dp\strutbox)}% + \setlocationattributes + \setstrut % can be option + \global\lastsavedreferenceattribute\lastreferenceattribute + \attribute\referenceattribute\lastreferenceattribute + \dostarttagged\t!link\empty + \let\stopgoto\stopgoto_yes} + +\unexpanded\def\stopgoto_yes + {\dostoptagged + \endgroup} + \def\dogotohtdp#content#dummy[#label]% dummy gobbles spaces {\dontleavehmode \begingroup diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 3f24c9795..f7f23daaa 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 : 06/15/14 15:54:28 +-- merge date : 06/17/14 00:28:28 do -- begin closure to overcome local limits and interference -- cgit v1.2.3