From f92d855b414d751600b729bf4d28bf3342a9ef50 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Mon, 20 Oct 2014 11:15:04 +0200 Subject: 2014-10-20 10:55:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4380 -> 4386 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/publ-ini.lua | 78 +++++++++++++++++---- tex/context/base/publ-ini.mkiv | 65 ++++++++++++----- tex/context/base/status-files.pdf | Bin 24739 -> 24717 bytes tex/context/base/status-lua.pdf | Bin 333380 -> 333364 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 8 files changed, 114 insertions(+), 35 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 7b6551c57..5a72e9074 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.10.19 21:08} +\newcontextversion{2014.10.20 10:52} %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 1bf53a033..ec13349e1 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 cfcae05ad..3482313cf 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.10.19 21:08} +\edef\contextversion{2014.10.20 10:52} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 53735dd5b..82510960f 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -101,6 +101,7 @@ local ctx_btxcitevariantparameter = context.btxcitevariantparameter local ctx_btxlistvariantparameter = context.btxlistvariantparameter local ctx_btxdirectlink = context.btxdirectlink local ctx_btxhandlelistentry = context.btxhandlelistentry +local ctx_btxhandlelisttextentry = context.btxhandlelisttextentry local ctx_btxchecklistentry = context.btxchecklistentry local ctx_btxchecklistcombi = context.btxchecklistcombi local ctx_btxsetcitereference = context.btxsetcitereference @@ -133,6 +134,9 @@ local ctx_btxstartsubcite = context.btxstartsubcite local ctx_btxstopsubcite = context.btxstopsubcite local ctx_btxlistsetup = context.btxlistsetup +local optionalspace = lpeg.patterns.whitespace^0 +local prefixsplitter = optionalspace * lpeg.splitat(optionalspace * P("::") * optionalspace) + statistics.register("publications load time", function() local publicationsstats = publications.statistics local nofbytes = publicationsstats.nofbytes @@ -1356,7 +1360,7 @@ lists.sorters = { -- for determining width -local lastnumber = 0 -- document wide +local lastreferencenumber = 0 -- document wide function lists.prepareentries(dataset) local rendering = renderings[dataset] @@ -1382,19 +1386,19 @@ function lists.prepareentries(dataset) end local detail = details[tag] if detail then - local number = detail.number - if not number then - lastnumber = lastnumber + 1 - number = lastnumber - detail.number = lastnumber + local referencenumber = detail.referencenumber + if not referencenumber then + lastreferencenumber = lastreferencenumber + 1 + referencenumber = lastreferencenumber + detail.referencenumber = lastreferencenumber end - li[3] = number + li[3] = referencenumber else report("missing details for tag %a in dataset %a (enhanced: %s)",tag,dataset,current.enhanced and "yes" or "no") -- weird, this shouldn't happen .. all have a detail - lastnumber = lastnumber + 1 - details[tag] = { number = lastnumber } - li[3] = lastnumber + lastreferencenumber = lastreferencenumber + 1 + details[tag] = { referencenumber = lastreferencenumber } + li[3] = lastreferencenumber end end end @@ -1414,7 +1418,7 @@ end -- for rendering -function lists.flushentries(dataset) +function lists.flushentries(dataset,textmode) local rendering = renderings[dataset] local list = rendering.list local luadata = datasets[dataset].luadata @@ -1457,10 +1461,56 @@ function lists.flushentries(dataset) end end rendering.userdata = userdata - ctx_btxhandlelistentry() + if textmode then + ctx_btxhandlelisttextentry() + else + ctx_btxhandlelistentry() + end end end +function lists.flushentry(specification) + local tag = specification.reference + if not tag or tag == "" then + return + end + -- + local dataset = specification.dataset or "" -- standard + -- local mark = specification.markentry ~= false + -- local internal = specification.internal or "" + -- + local prefix, rest = lpegmatch(prefixsplitter,tag) + if rest then + dataset = prefix + else + rest = tag + end + -- + -- if trace_cite then + -- report_cite("mark, dataset: %s, tags: %s",dataset or "-",rest) + -- end + -- + local reference = publications.parenttag(dataset,rest) + local found, todo, list = findallused(dataset,reference,internal) + local valid = { } + if list and #list > 0 then + local luadata = datasets[dataset].luadata + for i=1,#list do + local tag = list[i] + if luadata[tag] then + valid[#valid+1] = { tag, 0, 0 } -- datasets[dataset].details.number + end + end + end + if #valid > 0 then + local rendering = renderings[dataset] + rendering.list = valid + lists.flushentries(dataset,true) + else + ctx_btxmissing(tag) + end +end + local function getuserdata(dataset,key) local rendering = renderings[dataset] if rendering then @@ -1506,13 +1556,11 @@ commands.btxcollectlistentries = lists.collectentries commands.btxpreparelistentries = lists.prepareentries commands.btxfetchlistentries = lists.fetchentries commands.btxflushlistentries = lists.flushentries +commands.btxflushlistentry = lists.flushentry local citevariants = { } publications.citevariants = citevariants -local optionalspace = lpeg.patterns.whitespace^0 -local prefixsplitter = optionalspace * lpeg.splitat(optionalspace * P("::") * optionalspace) - function commands.btxhandlecite(specification) local tag = specification.reference if not tag or tag == "" then diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 92faf7076..0c08c73b1 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -909,10 +909,15 @@ \let\p_publ_cite_lefttext \empty \let\p_publ_cite_righttext\empty -\unexpanded\def\btxcite - {\dontleavehmode - \begingroup - \strictdoifnextoptionalelse\publ_cite_tags_options\publ_cite_tags_indeed} +\let\currentbtxciteuservariables\empty + +% \unexpanded\def\btxcite +% {\dontleavehmode +% \begingroup +% \strictdoifnextoptionalelse\publ_cite_tags_options\publ_cite_tags_indeed} +% +% \unexpanded\def\publ_cite_tags_options[#1]% +% {\strictdoifnextoptionalelse{\publ_cite_tags_options_indeed{#1}}{\publ_cite_tags_indeed{#1}}} \unexpanded\def\publ_cite_tags_indeed#1% {\letinteractionparameter\c!style\empty @@ -922,13 +927,6 @@ \publ_cite_variant \endgroup} -\let\publ_citation_tags_indeed\publ_cite_tags_indeed - -\let\currentbtxciteuservariables\empty - -\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% {\doifassignmentelse{#1}\publ_cite_tags_settings_indeed\publ_cite_tags_variants_indeed{#1}} @@ -1030,7 +1028,7 @@ \publ_cite_tags_indeed{#1}% \fi} -\unexpanded\def\btxnocite +\unexpanded\def\btxnocitation {\dosingleempty\publ_cite_no} \unexpanded\def\publ_cite_no[#1]% @@ -1044,15 +1042,15 @@ \fi} \unexpanded\def\btxmissing#1% - {{\tttf<#1>}} + {\dontleavehmode{\tttf<#1>}} %D Compatibility: -\let\cite \btxcite +\let\cite \btxcitation \let\citation \btxcitation -\let\nocite \btxnocite -\let\nocitation \btxnocite -\let\usepublication\btxnocite +\let\nocite \btxnocitation +\let\nocitation \btxnocitation +%let\usepublication\btxnocitation %D Cite helpers: @@ -1148,6 +1146,39 @@ % \savebtxdataset[standard][e:/tmp/foo.lua] % \savebtxdataset[standard][e:/tmp/foo.xml] +%D In-text entries: + +\unexpanded\def\placecitation + {\dodoubleempty\publ_place_citation} + +\unexpanded\def\publ_place_citation + {\ifsecondargument + \expandafter\publ_place_citation_two + \else\iffirstargument + \doubleexpandafter\publ_place_citation_one + \else + \doubleexpandafter\publ_place_citation_zero + \fi\fi} + +\unexpanded\def\publ_place_citation_one[#1][#2]% + {\publ_place_citation_two[\currentbtxrendering][#1]} + +\unexpanded\def\publ_place_citation_two[#1][#2]% + {\dontleavehmode + \begingroup + \startbtxrendering[#1]% + \btx_set_rendering_alternative + \edef\currentbtxdataset{\btxrenderingparameter\c!dataset}% + \uselanguageparameter\btxdatasetparameter % new + \ctxcommand{btxflushlistentry{ dataset = "\currentbtxdataset", reference = \!!bs#2\!!es }}% + \stopbtxrendering + \endgroup} + +\unexpanded\def\publ_place_citation_zero[#1][#2]% + {\btxmissing{??}} + +\let\btxhandlelisttextentry\btx_entry_inject + %D Defaults: \setbtxdataset diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 79fee3eb4..1e9f5baad 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 5da55ee05..eec816bf2 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1671ffb23..68400c088 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 : 10/19/14 21:08:40 +-- merge date : 10/20/14 10:52:56 do -- begin closure to overcome local limits and interference -- cgit v1.2.3