blob: 9a01bc7cde10aa2abeb5b15a14a0f952bed5487c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
%D Note by HH:
%D
%D We use a still somewhat experimental extension to the list
%D mechanism. Eventually the bibtex module will use the bibl loader
%D and access the data by means of lpath expressions. In that case we
%D don't need to process the bibliography but still need to track
%D usage as done here.
\unprotect
\startluacode
local list = { }
bibtexhacks = {
reset = function() list = { } end,
add = function(str) list[#list+1] = str end,
flush = function() tex.sprint(table.concat(list,",")) end,
}
\stopluacode
% HACK WILL GO:
\def\namedlistparameter#1#2{\csname\dolistparameter{\??li#1}#2\endcsname}
% TILL HERE
\let\bibrefprefixcounter\!!plusone
\def\bibrefprefix {\bibrefprefixcounter:}
\let\preparebibrefprefix\relax
\let\preparebibreflist \gobbleoneargument
\let\bibreflist \empty
\setuplist[pubs][\c!state=\s!start]
\installstructurelistprocessor{pubs:userdata}
{\ctxlua{bibtexhacks.add(structure.lists.uservalue("\currentlist",\currentlistindex,"bibref"))}}
\def\docitation#1%
{\expanded{\writedatatolist[pubs][bibref=#1]}}
\def\filllocalpublist
{\edef\currentlist{pubs}%
\doif{\listparameter\c!criterium}{cite}{\setuplist[pubs][\c!criterium=\v!here]}%
\ctxlua{bibtexhacks.reset()}%
\placestructurelist{pubs}{\listparameter\c!criterium}{\listparameter\c!number}%
\edef\localpublist{\ctxlua{bibtexhacks.flush()}}}
\def\gotobiblink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{\unknownreference{#2}}}
\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{\unknownreference{#1}}}
\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{\unknownreference{#1}}}
\ifdefined\normaldodoplacepublications \else % just in case we load twice
\let\normaldodoplacepublications\dodoplacepublications
\def\dodoplacepublications
{\normaldodoplacepublications
\doglobal\increment\bibrefprefixcounter}
\fi
\protect \endinput
|