From d7ccb42582f85acf30568913610ccf4d602023fb Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Wed, 1 Jun 2011 08:54:21 +0000 Subject: commit context 2011.05.18 git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/context/base/bibl-tra.mkiv | 168 +++++++---------------- 1 file changed, 51 insertions(+), 117 deletions(-) (limited to 'Master/texmf-dist/tex/context/base/bibl-tra.mkiv') diff --git a/Master/texmf-dist/tex/context/base/bibl-tra.mkiv b/Master/texmf-dist/tex/context/base/bibl-tra.mkiv index 519af0c6f77..8e2f61641f3 100644 --- a/Master/texmf-dist/tex/context/base/bibl-tra.mkiv +++ b/Master/texmf-dist/tex/context/base/bibl-tra.mkiv @@ -185,10 +185,11 @@ \setuplist [pubs] [\c!state=\v!start, + \c!criterium=\@@pbcriterium, \c!width=] \installstructurelistprocessor{pubs:userdata}% - {\ctxlua{bibtex.hacks.add(structure.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}} + {\ctxlua{bibtex.hacks.add(structures.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}} \newcount\bibtexblock \bibtexblock\plusone @@ -295,28 +296,18 @@ %D We can omit already shown references (\v!global) or use fresh %D lists each time (\v!local). -\chardef\bibtexoncemode\plusone % 0=disable, 1=local, 2=global +\setnewconstant\bibtexoncemode\plusone % 0=disable, 1=local, 2=global \appendtoks \doifelse\@@pbmethod\v!local - {\chardef\bibtexoncemode\plusone}% - {\chardef\bibtexoncemode\plustwo}% + {\bibtexoncemode\plusone}% + {\bibtexoncemode\plustwo}% \to \everysetuppublications %D Cite lists are compressed, if possible. This is set later on. \newif\ifbibcitecompress\bibcitecompresstrue -% \appendtoks -% \processaction -% [\@@pbnumbering] -% [ \v!yes=>\let\@@pbinumbercommand\firstofoneargument, -% \v!no=>\let\@@pbinumbercommand\gobbleoneargument, -% \v!short=>\def\@@pbinumbercommand##1{\bibgetvars\currentpublicationkey}, -% \v!bib=>\def\@@pbinumbercommand##1{\bibgetvarn\currentpublicationkey}, -% \s!unknown=>\let\@@pbinumbercommand\firstofoneargument]% -% \to \everysetuppublications - \def\@@pbinumbercommand{\executeifdefined{\??pb:\c!numbercommand:\@@pbnumbering}\firstofoneargument} \letvalue{\??pb:\c!numbercommand:\v!yes }\firstofoneargument @@ -348,16 +339,10 @@ \def\usepublications[#1]% {\processcommalist[#1]\dousepublications} -% \def\dousepublications#1% -% {\doonlyonce{#1.\f!bibextension} -% {\readfile{#1.\f!bibextension} -% {\showmessage\m!publications{4}{#1.\f!bibextension}} -% {\showmessage\m!publications{2}{#1.\f!bibextension}}}} - \def\dousepublications#1% {\doonlyonce{#1.\f!bibextension}{\dodousepublications{#1}}} -\def\dodousepublications#1% +\def\dodousepublications#1% brr, this par stuff {\let\@@savedpar\par \let\par\ignorespaces \ifhmode\kern\zeropoint\fi @@ -394,7 +379,10 @@ \let\normalsetuppublicationlayout\setuppublicationlayout -\setuppublicationlist[\c!title=,\c!command=\dospecialbibinsert,\c!maybeyear=\v!on] +\setuppublicationlist + [\c!title=, + \c!command=\dospecialbibinsert, + \c!maybeyear=\v!on] %D \macros{bibalternative} %D @@ -442,20 +430,6 @@ \processcommacommand[\bibcommandlist]\simplebibdef -% \def\bibinsertdoi#1#2#3% -% {\begingroup -% \bibdoifelse{\@@pb@doi}% -% {\edef\ascii{\detokenize\expandafter{\@@pb@doi}}% probably not ok, to less expansion -% #1\expanded{\bibgotoDOI{\@@pb@thekey}{\ascii}}#2}{#3}% -% \endgroup} -% -% \def\bibinsertbiburl#1#2#3% -% {\begingroup -% \bibdoifelse{\@@pb@biburl}% -% {\edef\ascii{\detokenize\expandafter{\@@pb@biburl}}% probably not ok, to less expansion -% #1\expanded{\bibgotoURL{\@@pb@thekey}{\ascii}}#2}{#3}% -% \endgroup} - \def\bibinsertdoi#1#2#3% let's see how this fails {\bibdoifelse{\@@pb@doi}{#1\expanded{\bibgotoDOI{\@@pb@thekey}{\@@pb@doi}}#2}{#3}} @@ -506,19 +480,6 @@ %D \specialbibinsert{author}{\author@num}{}{}{} %D \stoptyping -% \def\docomplexbibdef#1% -% {\def\currentype{#1}% -% \dosingleempty\dodocomplexbibdef} - -% \def\dodocomplexbibdef[#1]#2% -% {\def\firstarg{#1}\def\secondarg{#2}% -% \dosingleempty\dododocomplexbibdef} - -% \def\dododocomplexbibdef[#1]#2#3% -% {\@EA\increment\csname\currentype @num\endcsname -% \setevalue{\??pb @\currentype\csname \currentype @num\endcsname}% -% {{\secondarg}{#2}{#3}{#1}{\firstarg}}\ignorespaces} - \def\docomplexbibdef#1% {\dodoubleempty\dodocomplexbibdef[#1]} @@ -583,29 +544,6 @@ %D \#2 = number of items to be typeset %D \#3 = commacommand containing authors -% \def\dospecialbibinsert#1#2#3% -% {\getcommacommandsize[#3]% -% \scratchcounter\zerocount -% \def\processauthoritem##1% -% {\advance\scratchcounter\plusone -% \ifnum\numexpr\scratchcounter-\plusone\relax<#2\relax -% \publicationlistparameter{#1}##1% -% \ifnum\scratchcounter=#2\relax -% \ifnum\etallimitcounter<\commalistsize\relax -% \bibalternative{#1etaltext}% -% \fi -% \else\ifnum\numexpr\scratchcounter+\plusone\relax=#2\relax -% \ifnum\commalistsize>\plustwo -% \bibalternative\c!finalnamesep -% \else -% \bibalternative\c!lastnamesep -% \fi -% \else -% \bibalternative\c!namesep -% \fi\fi -% \fi}% -% \processcommacommand[#3]\processauthoritem} - \def\doprocessauthoritem#1#2#3% {\advance\scratchcounter\plusone \ifnum\numexpr\scratchcounter-\plusone\relax<#2\relax @@ -678,22 +616,6 @@ \def\clearbibitem#1{\setvalue{\??pb @#1}{}}% -% \def\clearbibitemtwo#1% -% {\letvalue{#1@num}\!!zerocount -% \doloop -% {\doifdefinedelse{\??pb @#1\recurselevel} -% {\letvalue{\??pb @#1\recurselevel}\empty} % why not undefined? -% {\exitloop}}} - -% \def\clearbibitemtwo#1% -% {\letvalue{#1@num}\!!zerocount -% \doloop -% {\ifcsname\??pb @#1\recurselevel\endcsname -% \expandafter\let\csname\??pb @#1\recurselevel\undefined -% \else -% \exitloop -% \fi}} - \def\clearbibitemtwo#1% is this reset really needed? after all we reset the counter and we are local {%\dofastrecurse\plusone{\csname#1@num\endcsname}\plusone{\expandafter\let\csname\??pb @#1\recurselevel\undefined}% \letvalue{#1@num}\!!zerocount} @@ -735,7 +657,7 @@ \unexpanded\def\startpublication {\begingroup - \catcode`\%=\othercatcode + \catcode\commentasciicode\othercatcode \dosingleempty\dostartpublication} \let\stoppublication\relax @@ -786,7 +708,7 @@ {\preloadbiblist \doifdefinedelse{pbd:#1} \firstoftwoarguments - {\showmessage\m!publications{5}{#1 is unknown}\secondoftwoarguments}} + {\showmessage\m!publications{5}{#1}\secondoftwoarguments}} %D \macros{bib@crossref} %D @@ -804,6 +726,8 @@ \def\bibinsertcrossref#1#2#3% {\bibdoifelse\@@pb@crossref{#1\cite[\@@pb@crossref]#2}{#3}} +\let\insertcrossref\gobblethreearguments + \appendtoks\let\insertcrossref\bibinsertcrossref\to\initializebibdefinitions %D The next macro is needed because the number command of the @@ -814,17 +738,28 @@ \def\doprocessbibtexentry#1{\typesetapublication{#1}} \def\typesetpubslist - {\dobeginoflist + {\preloadbiblist + \dobeginoflist % \the\initializebibdefinitions % COMMENTED \edef\currentlist{pubs}% - \doif{\listparameter\c!criterium}\v!cite{\setuplist[pubs][\c!criterium=\v!here]}% \ctxlua{bibtex.hacks.reset(\number\bibtexoncemode)}% - \placestructurelist{pubs}{\listparameter\c!criterium}{\listparameter\c!number}% + \doifelse{\listparameter\c!criterium}\v!all + {\showmessage\m!publications{7}{}% + \ctxlua{bibtex.hacks.filterall()}} + {\doif{\listparameter\c!criterium}\v!cite + {\setuplist[pubs][\c!criterium=\v!here]}% + \doplacestructurelist + {pubs}% + {\listparameter\c!criterium}% + {\listparameter\c!number}% + {\listparameter\c!extras}% + {\listparameter\c!order}}% \ctxlua{bibtex.hacks.flush("\@@pbsorttype")}% \doendoflist} \newif\ifinpublist + \def\initializepubslist {\def\currentlist{pubs}% \edef\@@pbnumbering{\@@pbnumbering}% @@ -832,7 +767,10 @@ {\ifx\@@pbnumbering\v!short \setbox\scratchbox\hbox{\@@pbnumbercommand{\listparameter\c!samplesize}}% \else - \setbox\scratchbox\hbox{\@@pbnumbercommand{\ctxlua{tex.write(structure.lists.size())}}}% + \doifelse{\listparameter\c!criterium}\v!all + {\setbox\scratchbox\hbox{\@@pbnumbercommand{\ctxlua{tex.write{bibtex.hacks.nofregistered()}}}}} + {\determinelistcharacteristics[pubs]% + \setbox\scratchbox\hbox{\@@pbnumbercommand{\structurelistsize}}}% \fi \edef\publistnumberbox{\hbox to \the\wd\scratchbox}% \expanded{\setuplist[pubs][\c!width=\the\wd\scratchbox,\c!distance=\zeropoint]}% @@ -871,7 +809,8 @@ \def\docompletepublications[#1]% {\begingroup - \setuplist[pubs][\c!criterium=\v!previous,#1] +% \setuplist[pubs][\c!criterium=\v!previous,#1] + \setuplist[pubs][#1] \doifelsenothing{\publicationlistparameter\c!title} {\systemsuppliedchapter[pubs]{\headtext{pubs}}} {\normalexpanded{\systemsuppliedchapter[pubs]{\publicationlistparameter\c!title}}}% @@ -886,7 +825,8 @@ \def\doplacepublications[#1]% {\begingroup - \setuplist[pubs][\c!criterium=\v!previous,#1]% +% \setuplist[pubs][\c!criterium=\v!previous,#1]% + \setuplist[pubs][#1]% \dodoplacepublications} \def\dodoplacepublications @@ -901,6 +841,9 @@ \global\advance\bibtexblock\plusone} %D \subsubject{What's in a publication} +%D +%D Watch out: here all means all publications in database, so use +%D text when you want text only. \unexpanded\def\typesetapublication#1% {\doifsomething{#1} @@ -970,17 +913,6 @@ %D \type{\cite} commands with a braced argument (these might appear %D in included data from the \type{.bib} file). -% \unexpanded\def\cite -% {\doifnextoptionalelse\dodocite\dobibref} -% \def\dobibref#1% -% {\docite[#1][]} -% \def\dodocite[#1]% -% {\startstrictinspectnextcharacter -% \dodoubleempty\dododocite[#1]} -% \def\dododocite % [#1][#2] -% {\stopstrictinspectnextcharacter -% \docite} - \unexpanded\def\cite {\strictdoifnextoptionalelse\dodocite\dobibref} @@ -1283,9 +1215,9 @@ %D %D The final task is looping over that list until a match is found. -\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}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{\unknownreference{#1}}} +\def\gotobiblink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{}} +\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{}} +\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{}} %D \macros{bibauthoryearref,bibauthoryearsref,bibauthorref,bibyearref} %D @@ -1386,7 +1318,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvars{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibserialref[#1]% {\bibalternative\v!left @@ -1397,7 +1329,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvarn{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibkeyref[#1]% {\bibalternative\v!left @@ -1424,7 +1356,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\expanded{\bibgotoDOI{#1}{\bibgetvaro{#1}}}} - {\unknownreference{#1}}} + {}} \def\biburlref[#1]% {\bibalternative\v!left @@ -1440,7 +1372,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\expanded{\bibgotoURL{#1}{\bibgetvaru{#1}}}} - {\unknownreference{#1}}} + {}} \def\bibtyperef[#1]% {\bibalternative\v!left @@ -1451,7 +1383,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvart{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibpageref[#1]% {\bibalternative\v!left @@ -1473,7 +1405,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\dotypesetapublication{#1}} - {\unknownreference{#1}}} + {}} \let\bibnoneref\nocite @@ -1529,7 +1461,7 @@ \setuppublications[\c!refcommand=num]% \cite[#1]% \endgroup} - {\unknownreference{#1}}} + {}} %D And some defaults are loaded from bibl-apa: @@ -1539,6 +1471,8 @@ [\c!monthconversion=, \c!alternative=apa, \c!method=\v!global, + %\c!criterium=\v!previous, + \c!criterium=\v!cite, % mojca wants this so bother her, not me \c!refcommand=num, \c!numbercommand=\bibleftnumber] -- cgit v1.2.3