From cba59c19999ad3034c8232e0f1566a5ffae358a9 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 29 Jul 2014 22:25:00 +0200 Subject: beta 2014.07.29 22:25 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4431 -> 4430 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/math-ini.mkiv | 2 +- tex/context/base/publ-imp-apa.mkvi | 12 +++ tex/context/base/publ-ini.lua | 109 +++++++++++++-------- tex/context/base/publ-ini.mkiv | 54 +++++++--- tex/context/base/status-files.pdf | Bin 24949 -> 24949 bytes tex/context/base/status-lua.pdf | Bin 326999 -> 327044 bytes tex/context/base/strc-syn.mkiv | 7 ++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 11 files changed, 133 insertions(+), 57 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index f8ce269bc..63779bef9 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.07.29 00:30} +\newcontextversion{2014.07.29 22:25} %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 ea6da3b1c..127780121 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 ce5b6db10..1ff7413d8 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.07.29 00:30} +\edef\contextversion{2014.07.29 22:25} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 2d3d3bf6c..caa531c1d 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -458,7 +458,7 @@ \startimath#1\stopimath \egroup \ht\scratchbox\strutht - \dp\scratchbox\strutht + \dp\scratchbox\strutdp \box\scratchbox \endgroup} diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 5aa2c80ca..1a758a87d 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -799,4 +799,16 @@ \texdefinition{btx:apa:note} \stopsetups +%D Experiment: + +\startsetups btx:apa:lefttext + \currentbtxlefttext + \enspace +\stopsetups + +\startsetups btx:apa:righttext + \enspace + \currentbtxrighttext +\stopsetups + \stopbtxrenderingdefinitions diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index d2600d8a0..1052c37e2 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -112,8 +112,10 @@ local ctx_btxsetcategory = context.btxsetcategory local ctx_btxcitesetup = context.btxcitesetup local ctx_btxsetfirst = context.btxsetfirst local ctx_btxsetsecond = context.btxsetsecond -local ctx_btxsetthird = context.btxsetthird +local ctx_btxsetthird = context.btxsetthird local ctx_btxsetinternal = context.btxsetinternal +local ctx_btxsetlefttext = context.btxsetlefttext +local ctx_btxsetrighttext = context.btxsetrighttext local ctx_btxsetbacklink = context.btxsetbacklink local ctx_btxsetbacktrace = context.btxsetbacktrace local ctx_btxsetcount = context.btxsetcount @@ -585,11 +587,14 @@ local pagessplitter = lpeg.splitat(P("-")^1) local function shortsorter(a,b) local ay, by = a[2], b[2] - if ay == by then - return a[3] < b[3] - else + if ay ~= by then + return ay < by + end + local ay, by = a[3], b[3] + if ay ~= by then return ay < by end + return a[4] < b[4] end function publications.enhance(dataset) -- for the moment split runs (maybe publications.enhancers) @@ -642,10 +647,16 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi local short = formatters["%t%02i"](t,mod(year,100)) local s = shorts[short] -- we could also sort on reference i.e. entries.text + local u = used[tag] + if u then + u = u[1].entries.text -- hm + else + u = "0" + end if not s then - shorts[short] = { { tag, year, i } } + shorts[short] = { { tag, year, u, i } } else - s[#s+1] = { tag, year, i } + s[#s+1] = { tag, year, u, i } end else -- @@ -672,28 +683,31 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi end end for short, tags in next, shorts do -- ordered ? - if #tags > 1 then - sort(tags,shortsorter) + local done = #tags > 0 + -- we only use suffixes when there are multiple references to same years + -- so we check for used first + if done then local n = 0 for i=1,#tags do local tag = tags[i][1] - local detail = details[tag] - detail.short = short if used[tag] then n = n + 1 - local suffix = numbertochar(n) - detail.suffix = suffix - local entry = luadata[tag] - local year = entry.year - if year then - detail.suffixedyear = year .. suffix + if n > 1 then + break end end end + done = n > 1 + end + -- now we assign the suffixes, unless we have only one reference + if done then + sort(tags,shortsorter) + local n = 0 for i=1,#tags do local tag = tags[i][1] local detail = details[tag] - if not detail.suffix then + detail.short = short + if used[tag] then n = n + 1 local suffix = numbertochar(n) detail.suffix = suffix @@ -704,8 +718,22 @@ function publications.enhance(dataset) -- for the moment split runs (maybe publi end end end + -- for i=1,#tags do + -- local tag = tags[i][1] + -- local detail = details[tag] + -- if not detail.suffix then + -- n = n + 1 + -- local suffix = numbertochar(n) + -- detail.suffix = suffix + -- local entry = luadata[tag] + -- local year = entry.year + -- if year then + -- detail.suffixedyear = year .. suffix + -- end + -- end + -- end else - local tag = tags[i][1] + local tag = tags[1][1] local detail = details[tag] detail.short = short local entry = luadata[tag] @@ -1043,10 +1071,10 @@ lists.methods = methods methods[v_dataset] = function(dataset,rendering,keyword) -- why only once inless criterium=all? local luadata = datasets[dataset].luadata - local list = rendering.list + local list = rendering.list for tag, data in sortedhash(luadata) do if not keyword or validkeyword(dataset,tag,keyword) then - list[#list+1] = { tag, false, false, 0 } + list[#list+1] = { tag, false, 0, false, false } end end end @@ -1062,7 +1090,7 @@ methods[v_force] = function (dataset,rendering,keyword) if u and u.btxset == dataset then local tag = u.btxref if tag and (not keyword or validkeyword(dataset,tag,keyword)) then - list[#list+1] = { tag, listindex, u.btxint, 0 } + list[#list+1] = { tag, listindex, 0, u, u.btxint } end end end @@ -1100,14 +1128,14 @@ methods[v_local] = function(dataset,rendering,keyword) if l then l[#l+1] = u.btxint else - local l = { tag, listindex, u.btxint, 0 } + local l = { tag, listindex, 0, u, u.btxint } list[#list+1] = l traced[tag] = l end else done[tag] = section alldone[tag] = true - list[#list+1] = { tag, listindex, u.btxint, 0 } + list[#list+1] = { tag, listindex, 0, u, u.btxint } end end end @@ -1264,22 +1292,10 @@ lists.sorters = { end sort(list,compare) end, - -- [v_default] = function(dataset,rendering,list) -- not really needed - -- local ordered = rendering.ordered - -- local function compare(a,b) - -- local aa, bb = a and a[1], b and b[1] - -- if aa and bb then - -- aa, bb = ordered[aa], ordered[bb] - -- return aa and bb and aa < bb - -- end - -- return false - -- end - -- sort(list,compare) - -- end, [v_default] = function(dataset,rendering,list,sorttype) -- experimental if sorttype == "" or sorttype == v_default then local function compare(a,b) - local aa, bb = a and a[4], b and b[4] + local aa, bb = a and a[3], b and b[3] if aa and bb then return aa and bb and aa < bb end @@ -1349,7 +1365,7 @@ function lists.prepareentries(dataset) number = lastnumber detail.number = lastnumber end - li[4] = number + li[3] = number end end rendering.list = type(sorter) == "function" and sorter(dataset,rendering,newlist,sorttype) or newlist @@ -1375,7 +1391,7 @@ function lists.flushentries(dataset) for i=1,#list do local li = list[i] local tag = li[1] - local n = li[4] + local n = li[3] local entry = luadata[tag] local combined = entry.combined local language = entry.language @@ -1388,10 +1404,10 @@ function lists.flushentries(dataset) if language then ctx_btxsetlanguage(language) end - local bl = li[3] + local bl = li[5] if bl and bl ~= "" then ctx_btxsetbacklink(bl) - ctx_btxsetbacktrace(concat(li," ",3)) -- how about 4 + ctx_btxsetbacktrace(concat(li," ",5)) local uc = citetolist[tonumber(bl)] if uc then ctx_btxsetinternal(uc.references.internal or "") @@ -1399,6 +1415,17 @@ function lists.flushentries(dataset) else -- nothing end + local u = li[4] + if u then + local l = u.btxltx + local r = u.btxrtx + if l then + ctx_btxsetlefttext (l) + end + if r then + ctx_btxsetrighttext(r) + end + end ctx_btxhandlelistentry() end end @@ -1408,7 +1435,7 @@ function lists.filterall(dataset) local list = r.list local registered = r.registered for i=1,#registered do - list[i] = { registered[i], i, false, 0 } + list[i] = { registered[i], i, 0, false, false } end end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 0ef8f39cc..c2823d45b 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -62,6 +62,8 @@ \def\s!btxref {btxref} \def\s!btxint {btxint} \def\s!btxbck {btxbck} +\def\s!btxltx {btxltx} +\def\s!btxrtx {btxrtx} \definelabelclass[btxlabel][2] @@ -356,6 +358,8 @@ \let\currentbtxsecond \empty \unexpanded\def\btxsetsecond {\def\currentbtxsecond} \let\currentbtxthird \empty \unexpanded\def\btxsetthird {\def\currentbtxthird} \let\currentbtxinternal \empty \unexpanded\def\btxsetinternal {\def\currentbtxinternal} +\let\currentbtxlefttext \empty \unexpanded\def\btxsetlefttext {\def\currentbtxlefttext} +\let\currentbtxrighttext \empty \unexpanded\def\btxsetrighttext {\def\currentbtxrighttext} \let\currentbtxlanguage \empty \unexpanded\def\btxsetlanguage {\def\currentbtxlanguage} \let\currentbtxtag \empty \unexpanded\def\btxsettag {\def\currentbtxtag} \let\currentbtxnumber \empty \unexpanded\def\btxsetnumber {\def\currentbtxnumber} @@ -397,6 +401,8 @@ {\let\currentbtxcombis \empty \let\currentbtxcategory \empty \let\currentbtxinternal \empty + \let\currentbtxlefttext \empty + \let\currentbtxrighttext\empty \let\currentbtxbacklink \empty \let\currentbtxbacktrace\empty \let\currentbtxlanguage \empty @@ -492,12 +498,14 @@ \endgroup} \def\btx_entry_inject_yes - {\fastsetup\currentbtxsetup + {\fastsetup{\s!btx:\currentbtxalternative:lefttext}% + \fastsetup\currentbtxsetup \removeunwantedspaces \ifx\currentbtxcombis\empty \else \btxrenderingparameter\c!separator \processcommacommand[\currentbtxcombis]\btx_entry_inject_combi - \fi} + \fi + \fastsetup{\s!btx:\currentbtxalternative:righttext}}% \def\btx_entry_inject_nop {\tttf \getmessage\m!publications{12}{\currentbtxsetup}} @@ -667,7 +675,9 @@ {\btx_trace_list_cross\empty\currentbtxbacktrace \global\advance\c_btx_list_reference\plusone \strc_references_direct_full_user - {\s!btxset="\currentbtxdataset",\s!btxref="\currentbtxtag",\ifx\currentbtxbacklink\currentbtxbacktrace\s!btxint="\currentbtxbacklink"\else\s!btxbck="\currentbtxbacktrace"\fi}% + {\s!btxset="\currentbtxdataset",% + \s!btxref="\currentbtxtag",% + \ifx\currentbtxbacklink\currentbtxbacktrace\s!btxint="\currentbtxbacklink"\else\s!btxbck="\currentbtxbacktrace"\fi}% {\s!btx::\v!list::\number\c_btx_list_reference}% {\currentbtxnumber}} @@ -675,13 +685,22 @@ {\dontleavehmode \iftrialtypesetting \else \ifx\currentbtxbacklink\empty - % can be made empty when combining author / year + % 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 + \btx_cite_reference_inject_indeed \fi \fi} +\def\btx_cite_reference_inject_indeed + {\btx_trace_list_cross\currentbtxbacklink\empty + \normalexpanded{\writedatatolist% + [\s!btx]% + [\s!btxset=\currentbtxdataset,% + \s!btxref=\currentbtxtag,% + \ifx\p_publ_cite_lefttext \empty\else\s!btxltx={\p_publ_cite_lefttext },\fi% + \ifx\p_publ_cite_righttext\empty\else\s!btxrtx={\p_publ_cite_righttext},\fi% + \s!btxint=\number\currentbtxbacklink]}}% % \c!location=\v!here + \let\btxcitereference\btx_cite_reference_inject \let\currentbtxnumbering\empty @@ -853,6 +872,13 @@ % [base::tags] % [settings|variant][base::tags] +% these need to be sort of protected: + +\let\p_publ_cite_before \empty +\let\p_publ_cite_after \empty +\let\p_publ_cite_lefttext \empty +\let\p_publ_cite_righttext\empty + \unexpanded\def\btxcite {\dontleavehmode \begingroup @@ -882,6 +908,8 @@ \letdummyparameter\c!after \empty \letdummyparameter\c!extras \empty \letdummyparameter\c!alternative\empty + \letdummyparameter\c!lefttext \empty + \letdummyparameter\c!righttext \empty \getdummyparameters[#1]% \edef\p_alternative{\dummyparameter\c!alternative}% \ifx\p_alternative\empty @@ -897,17 +925,19 @@ \setexpandedbtxcitevariantparameter\p_right{\p_extras\p_right}% \fi \fi - \edef\p_before{\dummyparameter\c!before}% - \edef\p_after {\dummyparameter\c!after}% + \edef\p_publ_cite_before {\dummyparameter\c!before}% + \edef\p_publ_cite_after {\dummyparameter\c!after}% + \edef\p_publ_cite_lefttext {\dummyparameter\c!lefttext}% + \edef\p_publ_cite_righttext{\dummyparameter\c!righttext}% \the\everysetupbtxciteplacement - \ifx\p_before\empty \else - \p_before + \ifx\p_publ_cite_before\empty \else + \p_publ_cite_before \space \fi \publ_cite_variant - \ifx\p_after\empty \else + \ifx\p_publ_cite_after\empty \else \optionalspace - \p_after + \p_publ_cite_after \fi \endgroup} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index a9107b947..0955b4832 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 39eb99248..ab7d11449 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-syn.mkiv b/tex/context/base/strc-syn.mkiv index 73aca18e6..6dfc79832 100644 --- a/tex/context/base/strc-syn.mkiv +++ b/tex/context/base/strc-syn.mkiv @@ -423,6 +423,13 @@ %D Presets. +\setupsimplelist + [\v!sorting] + [\c!headstyle=\simplelistparameter\c!synonymstyle, + \c!headcolor=\simplelistparameter\c!synonymcolor, + \c!style=\simplelistparameter\c!textstyle, + \c!color=\simplelistparameter\c!textcolor] + \definesynonyms [\v!abbreviation] [\v!abbreviations] diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 660524e6f..5e6456394 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 : 07/29/14 00:30:11 +-- merge date : 07/29/14 22:25:18 do -- begin closure to overcome local limits and interference -- cgit v1.2.3