diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/bibl-tra.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/bibl-tra.mkiv | 103 |
1 files changed, 61 insertions, 42 deletions
diff --git a/Master/texmf-dist/tex/context/base/bibl-tra.mkiv b/Master/texmf-dist/tex/context/base/bibl-tra.mkiv index 8e2f61641f3..3531703adc9 100644 --- a/Master/texmf-dist/tex/context/base/bibl-tra.mkiv +++ b/Master/texmf-dist/tex/context/base/bibl-tra.mkiv @@ -5,7 +5,7 @@ %D subtitle=Publications, %D author=Taco Hoekwater, %D date=\currentdate, -%D copyright=Public Domain] +%D copyright={Public Domain}] %C %C Donated to the public domain. @@ -23,6 +23,8 @@ %D A bit ongoing: make more local macros prefixed with bib, i.e. the bib %D namespace is reserved. +%D Todo: commandhandler + \writestatus{loading}{ConTeXt Bibliography Support / BibTeX} \definefilesynonym[bib][obsolete] @@ -186,6 +188,7 @@ [pubs] [\c!state=\v!start, \c!criterium=\@@pbcriterium, + \c!headnumber=\v!always, % needed as we provide our own and need to force \c!width=] \installstructurelistprocessor{pubs:userdata}% @@ -310,8 +313,8 @@ \def\@@pbinumbercommand{\executeifdefined{\??pb:\c!numbercommand:\@@pbnumbering}\firstofoneargument} -\letvalue{\??pb:\c!numbercommand:\v!yes }\firstofoneargument -\letvalue{\??pb:\c!numbercommand:\v!no }\gobbleoneargument +\setvalue{\??pb:\c!numbercommand:\v!yes }#1{#1}% +\setvalue{\??pb:\c!numbercommand:\v!no }#1{} \setvalue{\??pb:\c!numbercommand:\v!short}#1{\bibgetvars\currentpublicationkey} \setvalue{\??pb:\c!numbercommand:\v!bib }#1{\bibgetvarn\currentpublicationkey} @@ -656,9 +659,7 @@ %D Now prohibits comments, so % can be used for urls \unexpanded\def\startpublication - {\begingroup - \catcode\commentasciicode\othercatcode - \dosingleempty\dostartpublication} + {\dosingleempty\dostartpublication} \let\stoppublication\relax @@ -676,12 +677,17 @@ % hm, we can store at the lua end ... -\long\def\dostartpublication[#1]#2\stoppublication - {\doifassignmentelse{#1}% +\def\dostartpublication[#1]% + {\begingroup + \doifassignmentelse{#1}% {\getparameters[\??pb][k=\s!unknown,t=article,n=,s=,a=,y=,o=,u=,#1]}% {\getparameters[\??pb][k=#1,t=article,n=,s=,a=,y=,o=,u=]}% \ctxlua{bibtex.hacks.register("\@@pbk")}% - \setxvalue{pbd:\@@pbk}##1{\noexpand\ifcase##1\noexpand\or + \catcode\commentasciicode\othercatcode + \dodostartpublication} + +\def\dodostartpublication#1\stoppublication + {\setxvalue{pbd:\@@pbk}##1{\noexpand\ifcase##1\noexpand\or \@@pbk\noexpand\or \@@pba\noexpand\or \@@pby\noexpand\or @@ -690,7 +696,7 @@ \@@pbt\noexpand\or \@@pbo\noexpand\or \@@pbu\noexpand\or - \normalunexpanded{#2}\noexpand\fi}% + \normalunexpanded{#1}\noexpand\fi}% \endgroup \ignorespaces} @@ -737,9 +743,10 @@ \def\doprocessbibtexentry#1{\typesetapublication{#1}} -\def\typesetpubslist - {\preloadbiblist - \dobeginoflist +\unexpanded\def\typesetpubslist + {\begingroup + \startpacked[\v!blank]% + \preloadbiblist % \the\initializebibdefinitions % COMMENTED \edef\currentlist{pubs}% \ctxlua{bibtex.hacks.reset(\number\bibtexoncemode)}% @@ -755,12 +762,12 @@ {\listparameter\c!extras}% {\listparameter\c!order}}% \ctxlua{bibtex.hacks.flush("\@@pbsorttype")}% - \doendoflist} + \stoppacked + \endgroup} \newif\ifinpublist - -\def\initializepubslist +\unexpanded\def\initializepubslist {\def\currentlist{pubs}% \edef\@@pbnumbering{\@@pbnumbering}% \doifelse\@@pbautohang\v!yes @@ -799,22 +806,26 @@ \doifelse{\publicationlistparameter\c!maybeyear}{\v!off}{\def\maybeyear##1{}}{\def\maybeyear##1{##1}}% \forgetall} -\def\outdented#1% move to supp-box ? +\unexpanded\def\outdented#1% move to supp-box ? {\hskip-\hangindent#1\relax} %D The full list of publications -\def\completepublications +\unexpanded\def\completepublications {\dosingleempty\docompletepublications} \def\docompletepublications[#1]% {\begingroup -% \setuplist[pubs][\c!criterium=\v!previous,#1] - \setuplist[pubs][#1] - \doifelsenothing{\publicationlistparameter\c!title} - {\systemsuppliedchapter[pubs]{\headtext{pubs}}} - {\normalexpanded{\systemsuppliedchapter[pubs]{\publicationlistparameter\c!title}}}% - \dodoplacepublications} + \setuplist[pubs][#1]% + \edef\currentbibtexsessiontitle{\publicationlistparameter\c!title}% + \ifx\currentbibtexsessiontitle\empty + \normalexpanded{\startnamedsection[\v!chapter][\c!reference=pubs,\c!title={\headtext{pubs}}]}% + \else + \normalexpanded{\startnamedsection[\v!chapter][\c!reference=pubs,\c!title={\currentbibtexsessiontitle}]}% + \fi + \dodoplacepublications + \stopnamedsection + \endgroup} %D And the portion with the entries only. @@ -825,9 +836,9 @@ \def\doplacepublications[#1]% {\begingroup -% \setuplist[pubs][\c!criterium=\v!previous,#1]% \setuplist[pubs][#1]% - \dodoplacepublications} + \dodoplacepublications + \endgroup} \def\dodoplacepublications {\determinelistcharacteristics[pubs]% @@ -837,7 +848,6 @@ \inpublisttrue \typesetpubslist \inpublistfalse - \endgroup \global\advance\bibtexblock\plusone} %D \subsubject{What's in a publication} @@ -865,16 +875,17 @@ {\global\advance\bibtexcounter\plusone \def\currentpublicationkey{#1}% \ctxlua{bibtex.hacks.registerplaced("#1")}% - \dodolistelement - {pubs}% - {}% - {\number\bibtexcounter}% - {\expanded{\reference[\bibrefprefix#1]{\number\bibtexcounter}}% - \strut\dotypesetapublication{#1}\strut}% - {}% - {}} + \def \currentlist {pubs}% + \edef\currentlistentrynumber {\number\bibtexcounter}% + \let \currentlistentrytitle \bibtexpubtext + \let \currentlistentrypagenumber\empty + \strc_lists_apply_renderingsetup} {}} % invalid +\def\bibtexpubtext + {\expanded{\reference[\bibrefprefix\currentpublicationkey]{\number\bibtexcounter}}% + \strut\dotypesetapublication\currentpublicationkey\strut} + \def\dotypesetapublication#1% {\bgroup \the\initializebibdefinitions % NEW @@ -945,7 +956,11 @@ \ifx\LOextras\empty \setupcite[\@@currentalternative][#1]% \else - \expandafter\ifx\csname LOright\endcsname \relax + \expandafter\ifx\csname \??pv \@@currentalternative\c!right\endcsname\relax + % avoids tail recursion + \expandafter\let\csname \??pv \@@currentalternative\c!right\endcsname\empty + \fi + \expandafter\ifx\csname LOright\endcsname \relax \edef\LOextras{{\LOextras\bibalternative\c!right}}% \else \edef\LOextras{{\LOextras\LOright}}% @@ -1025,7 +1040,9 @@ %D does not have to be year info always. \type{\thebibyears} is %D pre-initialized because this makes the insertion macros simpler. %D -%D In `normal' \TeX, of course there are expansion problems again. +%D In normal \TEX, of course there are expansion problems again. + +%D Delegate this to \LUA. \def\ixbibauthoryear#1#2#3#4% {\bgroup @@ -1215,9 +1232,11 @@ %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]}{}} -\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{}} -\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{}} +%D Beware, we can have cites without reference match. + +\def\gotobiblink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{#1}} +\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{#1}} +\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{#1}} %D \macros{bibauthoryearref,bibauthoryearsref,bibauthorref,bibyearref} %D @@ -1414,7 +1433,7 @@ \def\bibnumref[#1]% {\begingroup \bibalternative\v!left - \penalty\!!tenthousand + \penalty\plustenthousand \ctxlua{bibtex.hacks.resolve("","\number\bibtexblock","#1")}% \bibalternative\v!right \endgroup} @@ -1450,7 +1469,7 @@ {\getcommalistsize[#1]% \global\bibitemcounter\commalistsize \bibresetrefsep - \processcommalist[#1]\dobibauthornumref } + \processcommalist[#1]\dobibauthornumref} \def\dobibauthornumref#1% {\bibinsertrefsep |