diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex/biblatex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex/biblatex.sty | 637 |
1 files changed, 465 insertions, 172 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty index 61a6ae51e73..fb6d3810573 100644 --- a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty +++ b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty @@ -1,4 +1,4 @@ -% $Id: biblatex.sty,v 1.1b 2011/02/04 11:36:21 lehman stable $ +% $Id: biblatex.sty,v 1.2a 2011/02/13 12:05:37 lehman stable $ % Copyright (c) 2006-2011 Philipp Lehman. % @@ -21,11 +21,11 @@ \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{biblatex} -[\abx@rcsid $Id: biblatex.sty,v 1.1b 2011/02/04 11:36:21 lehman stable $ +[\abx@rcsid $Id: biblatex.sty,v 1.2a 2011/02/13 12:05:37 lehman stable $ programmable bibliographies] \def\blx@bblversion$#1: #2 ${#2} -\edef\blx@bblversion{\blx@bblversion$Revision: 1.1 $} +\edef\blx@bblversion{\blx@bblversion$Revision: 1.2 $} %% Dependencies @@ -504,7 +504,19 @@ {\expandafter\expandafter\expandafter\docsvlist \expandafter\expandafter\expandafter{% \csname abx@field@#1\endcsname}}} -\blx@regimc\docsvfield + +% {<handler>}{<field>} => <handler>{<item1>}<handler>{<item2>}... + +\def\blx@imc@forcsvfield#1#2{% + \blx@imc@iffieldundef{#2} + {} + {\expandafter\expandafter\expandafter\blx@imc@forcsvfield@i + \expandafter\expandafter\expandafter{% + \csname abx@field@#2\endcsname}{#1}}} + +\def\blx@imc@forcsvfield@i#1#2{\forcsvlist{#2}{#1}} + +\blx@regimcs{\docsvfield \forcsvfield} % {<list>|<listmacro>} @@ -570,7 +582,8 @@ \abx@hook@xsanitize \def\blx@tempa{\endgroup#1}% \edef\blx@tempb{#2}% - \let\do\@makeother\dospecials + \let\do\@makeother + \dospecials \catcode`\<=\active \catcode`\>=\active \catcode`\&=\active @@ -615,18 +628,20 @@ \fi} \def\blx@auxinit@bibtex#1{% - \blx@auxwrite\blx@auxout@bibtex{}{% - \ifx\blx@auxout@bibtex\@mainaux - \else - \blx@msg@aux - \fi - \string\bibstyle{biblatex}\blx@nl - \string\bibdata{% - \blx@ctrlfile\blxauxsuffix - \expandafter\ifblank\expandafter{#1} - {} - {,#1}}\blx@nl - \string\citation{biblatex-control}}} + \blx@auxwrite\blx@auxout@bibtex + {\def\do##1{,\blx@stripbib{##1}}} + {\ifx\blx@auxout@bibtex\@mainaux + \else + \blx@msg@aux + \fi + \string\bibstyle{biblatex}\blx@nl + \string\bibdata{% + \blx@ctrlfile\blxauxsuffix + \ifx#1\@empty + \else + \dolistloop#1% + \fi}\blx@nl + \string\citation{biblatex-control}}} % {<file>}{<signature>}{<true>}{<false>} @@ -951,13 +966,20 @@ \let\blx@list@inactive\@empty \listeadd\blx@list@inactive{\jobname} +\protected\def\blx@regbibfiles#1#2{% + \forlistloop{\blx@regbibfile{#1}}{#2}} + \def\blx@regbibfile#1#2{% - \ifinlistcs{#2.bib}{blx@list@bibfiles@#1} - {} - {\listcsxadd{blx@list@bibfiles@#1}{#2.bib}}} + \ifcsundef{blx@res@loca@#2} + {\blx@regbibfile@i{#1}{#2}} + {\ifcsstring{blx@res@loca@#2}{local} + {\blx@regbibfile@i{#1}{#2}} + {}}} -\def\blx@regbibfiles#1#2{% - \blx@xsanitizeafter{\forcsvlist{\blx@regbibfile{#1}}}{#2}} +\def\blx@regbibfile@i#1#2{% + \ifinlistcs{#2}{blx@list@bibfiles@#1} + {} + {\listcsxadd{blx@list@bibfiles@#1}{#2}}} \def\blx@check@logreq{% \begingroup @@ -1695,28 +1717,31 @@ \newrobustcmd*{\InitializeBibliographyStyle}{\appto\blx@hook@bbxinit} \@onlypreamble\InitializeBibliographyStyle -% {<type>}{<driverdef>} +% {<entry type>}{<driverdef>} \newrobustcmd*{\DeclareBibliographyDriver}[1]{% \long\csdef{blx@bbx@#1}} \@onlypreamble\DeclareBibliographyDriver +% {<entry type>} + \def\blx@driver#1{% - \ifcsundef{blx@bbx@#1} - {\ifcsundef{blx@bbx@*} + \ifcsdef{blx@bbx@#1} + {\csuse{blx@bbx@#1}} + {\ifcsdef{blx@bbx@*} {\blx@warning{% - No driver for entry type '\abx@field@entrytype'}} - {\csuse{blx@bbx@*}}} - {\csuse{blx@bbx@#1}}} + No driver for entry type '#1'.\MessageBreak + Using fallback driver}% + \csuse{blx@bbx@*}} + {\blx@error + {No driver found} + {I can't find a driver for the entry type + '\abx@field@entrytype'\MessageBreak + and there is no fallback driver either}}}} % {<type>}{<true>}{<false>} -\def\blx@ifdriver#1{% - \ifcsundef{blx@bbx@#1} - {\ifcsundef{blx@bbx@*} - {\@secondoftwo} - {\@firstoftwo}} - {\@firstoftwo}} +\def\blx@imc@ifdriver#1{\ifcsdef{blx@bbx@#1}} % {<alias>}{<type>} @@ -2174,6 +2199,40 @@ \expandafter\@secondoftwo \fi}}} +% {<category>}{<true>}{<false>} + +\protected\def\blx@imc@ifcategory{% + \ifdef\abx@field@entrykey + {\blx@imc@ifentrycategory\abx@field@entrykey} + {\expandafter\@secondoftwo\@gobble}} + +% {<entrykey>}{<category>}{<true>}{<false>} + +\protected\def\blx@imc@ifentrycategory{% + \blx@xsanitizeafter\blx@imc@ifentrycategory@i} + +\def\blx@imc@ifentrycategory@i#1#2{% + \ifcsdef{blx@catg@\detokenize{#2}} + {\ifinlistcs{#1}{blx@catg@\detokenize{#2}}} + {\@secondoftwo}} + +% {<keyword>}{<true>}{<false>} + +\protected\def\blx@imc@ifkeyword{% + \ifdef\abx@field@entrykey + {\blx@imc@ifentrykeyword\abx@field@entrykey} + {\expandafter\@secondoftwo\@gobble}} + +% {<entrykey>}{<keyword>}{<true>}{<false>} + +\protected\def\blx@imc@ifentrykeyword{% + \blx@xsanitizeafter\blx@imc@ifentrykeyword@i} + +\def\blx@imc@ifentrykeyword@i#1#2{% + \ifcsdef{blx@keyw@\the\c@refsection @\detokenize{#2}} + {\ifinlistcs{#1}{blx@keyw@\the\c@refsection @\detokenize{#2}}} + {\@secondoftwo}} + % {<true>}{<false>} \protected\def\blx@ifciteseen@global{% @@ -2586,80 +2645,94 @@ \newrobustcmd*{\NumCheckSetup}{\appto\blx@hook@ifnum} \newcommand*{\NumcheckSetup}{\NumCheckSetup} -% [<pagination>]{<string>} +% [<pagination>][<postpro>]{<string>} \newrobustcmd*{\blx@imc@mkpageprefix}[1][pagination]{% - \iffieldequalstr{#1}{none} - {\@firstofone} - {\begingroup - \def\blx@tempa{page}% - \iffieldundef{#1} - {} + \begingroup + \def\blx@tempa{\blx@mkpageprefix{page}}% + \iffieldundef{#1} + {} + {\iffieldequalstr{#1}{none} + {\def\blx@tempa{\blx@mkpageprefix@i}} {\iffieldbibstring{#1} - {\edef\blx@tempa{\thefield{#1}}} - {\blx@warning@entry{% - Unknown pagination type '\thefield{#1}'}}}% - \expandafter\endgroup - \expandafter\blx@mkpageprefix - \expandafter{\blx@tempa}}} - -\long\def\blx@mkpageprefix#1#2{% - \ifnumeral{#2} - {\bibstring{#1}\ppspace#2} - {\ifnumerals{#2} - {\bibstring{#1s}\ppspace#2} - {\begingroup - \def\pno{\bibstring{#1}}% - \def\ppno{\bibstring{#1s}}% - #2\endgroup}}} + {\edef\blx@tempa{\blx@mkpageprefix{\thefield{#1}}}} + {\blx@warning@entry{% + Unknown pagination type '\strfield{#1}'}}}}% + \@ifnextchar[%] + {\blx@tempa} + {\blx@tempa[\@firstofone]}} + +\protected\long\def\blx@mkpageprefix#1[#2]#3{% + \ifnumeral{#3} + {\bibstring{#1}\ppspace} + {\ifnumerals{#3} + {\bibstring{#1s}\ppspace} + {\def\pno{\bibstring{#1}}% + \def\ppno{\bibstring{#1s}}}}% + \blx@mkpageprefix@i[#2]{#3}} -% [<pagination>]{<string>} +\long\def\blx@mkpageprefix@i[#1]#2{#1{#2}\endgroup} + +% [<pagination>][<postpro>]{<string>} \newrobustcmd*{\blx@imc@mkpagetotal}[1][bookpagination]{% \begingroup - \def\blx@tempa{page}% + \def\blx@tempa{\blx@mkpagetotal{page}}% \iffieldundef{#1} {} {\iffieldequalstr{#1}{none} - {} + {\def\blx@tempa{\blx@mkpagetotal@i}} {\iffieldbibstring{#1} - {\edef\blx@tempa{\thefield{#1}}} - {\blx@warning@entry{% - Unknown pagination type '\thefield{#1}'}}}}% - \expandafter\endgroup - \expandafter\blx@mkpagetotal - \expandafter{\blx@tempa}} - -\long\def\blx@mkpagetotal#1#2{% - \begingroup - \ifnumeral{#2} + {\edef\blx@tempa{\blx@mkpagetotal{\thefield{#1}}}} + {\blx@warning@entry{% + Unknown pagination type '\strfield{#1}'}}}}% + \@ifnextchar[%] + {\blx@tempa} + {\blx@tempa[\@firstofone]}} + +\protected\long\def\blx@mkpagetotal#1[#2]#3{% + \ifnumeral{#3} {\setbox\@tempboxa=\hbox{% - \blx@tempcnta0#2\relax + \blx@tempcnta0#3\relax \ifnum\blx@tempcnta=\@ne \aftergroup\@firstoftwo \else \aftergroup\@secondoftwo \fi}% - {#2\ppspace\bibstring{#1}} - {#2\ppspace\bibstring{#1s}}} + {#2{#3}\ppspace\bibstring{#1}} + {#2{#3}\ppspace\bibstring{#1s}}} {\def\pno{\bibstring{#1}}% \def\ppno{\bibstring{#1s}}% - #2}% + #2{#3}}% \endgroup} -% [<pagination>]{<string>} +\long\def\blx@mkpagetotal@i[#1]#2{#1{#2}\endgroup} -\protected\def\blx@imc@mkpagefirst{% - \@ifstar\blx@pagefirst@i\blx@pagefirst@ii} +% [<pagination>][<postpro>]{<string>} +% <*>[<postpro>]{<string>} -\long\def\blx@pagefirst@i#1{% - \blx@pagefirst@iii#1\bibrangedash&} +\protected\def\blx@imc@mkpagefirst{% + \@ifstar + {\@ifnextchar[%] + {\blx@pagefirst@i} + {\blx@pagefirst@i[\@firstofone]}} + {\blx@pagefirst@ii}} -\newcommand{\blx@pagefirst@ii}[2][pagination]{% +\long\def\blx@pagefirst@i[#1]#2{% \begingroup \edef\blx@tempa{\endgroup - \noexpand\mkpageprefix[#1]{% - \blx@pagefirst@iii#2\bibrangedash&}}% + \unexpanded{#1}{\blx@pagefirst@iii#2\bibrangedash&}}% + \blx@tempa} + +\newrobustcmd*{\blx@pagefirst@ii}[1][pagination]{% + \@ifnextchar[%] + {\blx@pagefirst@iiA{#1}} + {\blx@pagefirst@iiA{#1}[\@firstofone]}} + +\protected\long\def\blx@pagefirst@iiA#1[#2]#3{% + \begingroup + \def\blx@tempa{\endgroup\mkpageprefix[#1][#2]}% + \eappto\blx@tempa{{\blx@pagefirst@iii#3\bibrangedash&}}% \blx@tempa} \long\def\blx@pagefirst@iii#1\bibrangedash#2&{% @@ -2795,9 +2868,10 @@ \global\toggletrue{blx@block}} \blx@regimcs{% - \thefield \strfield \thelist \thename \clearfield \clearlist - \clearname \restorefield \restorelist \restorename \ifciteseen - \ifentryseen \ifciteibid \ifciteidem \ifopcit \ifloccit + \ifdriver \thefield \strfield \thelist \thename \clearfield \clearlist + \clearname \restorefield \restorelist \restorename + \ifcategory \ifentrycategory \ifkeyword \ifentrykeyword + \ifciteseen \ifentryseen \ifciteibid \ifciteidem \ifopcit \ifloccit \ifcurrentfield \ifcurrentlist \ifcurrentname \ifentrytype \iffieldequalcs \iffieldequals \iffieldequalstr \iffieldsequal \iffieldundef \iffieldxref \iflistequalcs \iflistequals @@ -3634,7 +3708,7 @@ {\@firstoftwo}} \def\blx@imc@ifbibxstring#1{% - \ifcsundef{\abx@str @#1} + \blx@xsanitizeafter\ifcsundef{\abx@str @#1} {\@secondoftwo} {\@firstoftwo}} @@ -3644,7 +3718,8 @@ \blx@imc@iffieldundef{#1} {\@secondoftwo} {\ifcsundef{\abx@str @\detokenize\expandafter - \expandafter\expandafter{\csname abx@field@#1\endcsname}} + \expandafter\expandafter{% + \csname abx@field@#1\endcsname}} {\@secondoftwo} {\@firstoftwo}}} @@ -3881,6 +3956,7 @@ \do{urlseen}% \do{file}% \do{inpress}% + \do{inpreparation}% \do{submitted}% \do{library}% \do{abstract}% @@ -4302,7 +4378,7 @@ \newrobustcmd*{\mkbibfemord}{\mkbibordinal} \newrobustcmd*{\mkbibmonth}[1]{% \ifcase0#1\relax - 0\blx@warning@entry{Month out of range}% + \blx@warning@entry{Month out of range or not an integer}% \or\abx@bibmonth{january}% \or\abx@bibmonth{february}% \or\abx@bibmonth{march}% @@ -4316,8 +4392,8 @@ \or\abx@bibmonth{november}% \or\abx@bibmonth{december}% \else - #1\blx@warning@entry{Month out of range}% - \fi}% + \blx@warning@entry{Month out of range}#1% + \fi} \protected\def\blx@imc@printdate{} \protected\def\blx@imc@printdateextra{} @@ -4428,12 +4504,12 @@ \do{set}% \do{article}% \do{book}% - \do{books}% - \do{bookinbook}% + \do{mvbook}% \do{booklet}% \do{collection}% - \do{collections}% + \do{mvcollection}% \do{inbook}% + \do{bookinbook}% \do{incollection}% \do{inproceedings}% \do{manual}% @@ -4442,6 +4518,7 @@ \do{patent}% \do{periodical}% \do{proceedings}% + \do{mvproceedings}% \do{report}% \do{suppbook}% \do{suppcollection}% @@ -4461,6 +4538,7 @@ \do{music}% \do{performance}% \do{reference}% + \do{mvreference}% \do{review}% \do{software}% \do{standard}% @@ -6146,32 +6224,27 @@ \blx@ifdata{#1} {\begingroup \blx@getdata{#1}% - \blx@ifdriver{\abx@field@entrytype} - {\blx@bibcheck - \iftoggle{blx@skipentry}{}{% - \global\let\blx@noitem\@empty - \blx@setoptions@type\abx@field@entrytype - \blx@setoptions@entry - \blx@thelabelnumber - \blx@addprefixnumber - \addtocounter{instcount}\@ne - \csuse{blx@item@\blx@theenv}\relax - \blx@initsep - \blx@namesep - \csuse{blx@hook@bibitem}% - \blx@execute - \blx@initunit - \blx@anchor - \blx@beglang - \bibsentence - \blx@pagetracker - \blx@driver{\abx@field@entrytype}% - \blx@postpunct - \blx@endlang}} - {\blx@warning{% - No driver for entry type - '\abx@field@entrytype'.\MessageBreak - Skipping entry '\abx@field@entrykey'}}% + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \blx@addprefixnumber + \addtocounter{instcount}\@ne + \csuse{blx@item@\blx@theenv}\relax + \blx@initsep + \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglang + \bibsentence + \blx@pagetracker + \blx@driver\abx@field@entrytype + \blx@postpunct + \blx@endlang}% \endgroup} {}} @@ -6383,8 +6456,16 @@ {\blx@refsection} {\blx@refsection[]}} +\def\blx@refsection{% + \begingroup + \let\do\@makeother + \dospecials + \catcode`\{=\@ne + \catcode`\}=\tw@ + \blx@refsection@i} -\def\blx@refsection[#1]{% +\def\blx@refsection@i[#1]{% + \endgroup \global\advance\blx@maxsection\@ne \global\c@refsection\blx@maxsection \blx@inf@refsec @@ -6394,41 +6475,50 @@ \string\abx@aux@refsection{\the\c@refsection}{\the\c@page}}% \ifblank{#1} {} - {\blx@xsanitizeafter{\def\blx@bibfiles}{#1% - \ifdef\blx@bibfiles@extra - {,\blx@bibfiles@extra} - {}}}% + {\let\blx@bibfiles\@empty + \blx@xsanitizeafter{\forcsvlist\blx@refsection@addfile}{#1}% + \forlistloop{\listadd\blx@bibfiles}\blx@bibfiles@global}% \ifnum\blx@backend=\blx@backend@biber - \blx@refsection@biber\blx@bibfiles + \blx@refsection@biber \else - \blx@refsection@bibtex\blx@bibfiles + \blx@refsection@bibtex \fi \fi \blx@info{Setting label 'refsection:\the\c@refsection'}% \label{refsection:\the\c@refsection}% \endgroup} -\def\blx@refsection@biber#1{% - \blx@regbibfiles{\jobname}{#1}% +\def\blx@refsection@addfile#1{% + \ifcsdef{blx@res@labl@#1} + {\blx@refsection@addfile@i{\csuse{blx@res@labl@#1}}} + {\blx@refsection@addfile@i{#1}}} + +\def\blx@refsection@addfile@i#1{% + \ifcsdef{blx@res@loca@#1} + {\listeadd\blx@bibfiles{#1}} + {\listeadd\blx@bibfiles{\blx@stripbib{#1}\detokenize{.bib}}}} + +\def\blx@refsection@biber{% + \blx@regbibfiles\jobname\blx@bibfiles \begingroup - \blx@xmlsanitizeafter{\def\blx@tempa}{#1}% + \let\blx@tempa\@empty + \blx@bibdata\blx@tempa\blx@bibfiles \blx@auxwrite\blx@auxout - {\def\do##1{\blx@xml@datasource{file}{##1}}} + {\let\do\blx@datasource} {\blx@xml@endsection\blx@nl \blx@xml@comment{section \the\c@refsection}% - \blx@xml@bibdata{\the\c@refsection}{% - \expandafter\docsvlist\expandafter{\blx@tempa}}% + \blx@xml@bibdata{\the\c@refsection}{\blx@tempa}% \blx@xml@section{\the\c@refsection}}% \endgroup} -\def\blx@refsection@bibtex#1{% +\def\blx@refsection@bibtex{% \xdef\blx@auxfile@bibtex{\jobname\the\c@refsection\blxauxsuffix}% - \blx@regbibfiles{\blx@auxfile@bibtex}{#1}% + \blx@regbibfiles\blx@auxfile@bibtex\blx@bibfiles \blx@logreq@inactive \blx@ifsigned{\blx@auxfile@bibtex}{aux} {\immediate\openout\blx@auxout\blx@auxfile@bibtex.aux\relax \global\let\blx@auxout@bibtex\blx@auxout - \blx@auxinit@bibtex{#1}} + \blx@auxinit@bibtex\blx@bibfiles} {}} \protected\def\endrefsection{% @@ -6508,7 +6598,7 @@ \newrobustcmd*{\DeclareBibliographyCategory}[1]{% \ifcsundef{blx@catg@#1} {\global\cslet{blx@catg@#1}\@empty - \listgadd{\blx@categories}{#1}} + \listgadd\blx@categories{#1}} {\blx@error {Category '#1' already declared} {The bibliography category '#1'\MessageBreak @@ -6540,27 +6630,111 @@ \AtEndDocument{\let\abx@aux@category\@gobbletwo} -% {<bibfile>,...} +% [<options>]{<resource>,...} -\renewrobustcmd*{\bibliography}{% - \@ifstar - {\blx@xsanitizeafter{\forcsvlist\blx@extrabibfile}} - {\blx@xsanitizeafter{\forcsvlist\blx@addbibfile}}} +\renewrobustcmd*{\bibliography}[1]{% + \begingroup + \def\blx@tempa{file}% + \def\blx@tempb{bibtex}% + \def\blx@tempc{local}% + \forcsvlist\blx@addbib@legacy{#1}% + \endgroup} \@onlypreamble\bibliography -\def\blx@addbibfile#1{% - \ifdefempty\blx@bibfiles - {\gdef\blx@bibfiles{#1}} - {\gappto\blx@bibfiles{,#1}}% - \blx@regbibfile{\jobname}{#1}} +\def\blx@addbib@legacy#1{% + \begingroup + \blx@xsanitizeafter{\def\blx@tempa}{\blx@stripbib{#1}\detokenize{.bib}} + \edef\blx@tempb{\endgroup\noexpand\blx@addbib@resource{\blx@tempa}}% + \blx@tempb} + +\def\blx@stripbib#1{% + \expandafter\blx@stripbib@i\detokenize{#1.bib}&} +\edef\blx@stripbib@i{% + \def\noexpand\blx@stripbib@i##1\detokenize{.bib}##2&} +\blx@stripbib@i{#1} + +% [<options>]{<resource>,...} + +\newrobustcmd*{\addbibresource}{% + \blx@addbib\blx@addbib@resource} +\@onlypreamble\addbibresource + +\newrobustcmd*{\addglobalbib}{% + \blx@addbib\blx@addbib@global} +\@onlypreamble\addglobalbib + +\newrobustcmd*{\addsectionbib}{% + \blx@addbib\blx@addbib@register} +\@onlypreamble\addsectionbib + +\def\blx@addbib#1{% + \@ifnextchar[%] + {\blx@addbib@i{#1}} + {\blx@addbib@i{#1}[]}} + +\def\blx@addbib@i#1[#2]{% + \begingroup + \let\do\@makeother + \dospecials + \catcode`\{=\@ne + \catcode`\}=\tw@ + \blx@addbib@ii{#1}{#2}} + +\def\blx@addbib@ii#1#2#3{% + \endgroup + \begingroup + \def\blx@tempa{file}% + \def\blx@tempb{bibtex}% + \def\blx@tempc{local}% + \undef\blx@tempd + \setkeys{blx@addbib}{#2}% + \blx@xsanitizeafter{#1}{#3}% + \endgroup} + +\define@key{blx@addbib}{type}{\def\blx@tempa{#1}} +\define@key{blx@addbib}{datatype}{\def\blx@tempb{#1}} +\define@key{blx@addbib}{location}{\def\blx@tempc{#1}} +\define@key{blx@addbib}{label}{\edef\blx@tempd{\detokenize{#1}}} + +% \blx@res@type@<resource> resource -> type +% \blx@res@data@<resource> resource -> datatype +% \blx@res@loca@<resource> resource -> datatype +% \blx@res@labl@<resource> label -> resource + +\def\blx@addbib@register#1{% + \csxdef{blx@res@type@#1}{\blx@tempa}% + \csxdef{blx@res@data@#1}{\blx@tempb}% + \csxdef{blx@res@loca@#1}{\blx@tempc}% + \ifdef\blx@tempd + {\csxdef{blx@res@labl@\blx@tempd}{#1}} + {}} -\def\blx@extrabibfile#1{% - \blx@addbibfile{#1}% - \ifdef\blx@bibfiles@extra - {\gappto\blx@bibfiles@extra{,#1}} - {\gdef\blx@bibfiles@extra{#1}}} +\def\blx@addbib@resource#1{% + \blx@addbib@register{#1}% + \listgadd\blx@bibfiles{#1}% + \blx@regbibfile\jobname{#1}} + +\def\blx@addbib@global#1{% + \blx@addbib@resource{#1}% + \listgadd\blx@bibfiles@global{#1}} \let\blx@bibfiles\@empty +\let\blx@bibfiles@global\@empty + +\def\blx@bibdata#1#2{% + \forlistloop{\blx@bibdata@i{#1}}#2} +\def\blx@bibdata@i#1#2{% + \blx@xmlsanitizeafter{\blx@bibdata@ii{#1}{#2}}{#2}} +\def\blx@bibdata@ii#1#2#3{% + \eappto#1{% + \blx@xml@datasource + {\ifcsdef{blx@res@type@#2} + {\csuse{blx@res@type@#2}} + {file}} + {\ifcsdef{blx@res@data@#2} + {\csuse{blx@res@data@#2}} + {bibtex}} + {#3}}} %% Citations @@ -7817,6 +7991,10 @@ \def\ifnameequals#1#2{\blx@TE{\blx@imc@ifnameequals{#1}{#2}}}% \def\ifnamesequal#1#2{\blx@TE{\blx@imc@ifnamesequal{#1}{#2}}}% \def\ifnameundef#1{\blx@TE{\blx@imc@ifnameundef{#1}}}% + \def\ifcategory#1{\blx@TE{\blx@imc@ifcategory{#1}}}% + \def\ifkeyword#1{\blx@TE{\blx@imc@ifkeyword{#1}}}% + \def\ifentrycategory#1#2{\blx@TE{\blx@imc@ifentrycategory{#1}{#2}}}% + \def\ifentrykeyword#1#2{\blx@TE{\blx@imc@ifentrykeyword{#1}{#2}}}% \def\ifcapital{\blx@TE\blx@imc@ifcapital}% \def\ifinteger#1{\blx@TE{\blx@imc@ifinteger{#1}}}% \def\iffieldint#1{\blx@TE{\blx@imc@iffieldint{#1}}}% @@ -8209,6 +8387,26 @@ ~~~~</bcf:option>\blx@nl} \xdef\blx@xml@ordered#1#2{% ~~~~~~<bcf:value order="#1">#2</bcf:value>\blx@nl} + +\xdef\blx@xml@inheritance#1{% + ~~<bcf:inheritance>\blx@nl + #1% + ~~</bcf:inheritance>\blx@nl} +\xdef\blx@xml@inherit@defaults#1#2{% + ~~~~<bcf:defaults#1>\blx@nl + #2% + ~~~~</bcf:defaults>\blx@nl} +\xdef\blx@xml@inherit@data#1{% + ~~~~<bcf:inherit>\blx@nl + #1% + ~~~~</bcf:inherit>\blx@nl} +\xdef\blx@xml@inherit@type#1#2#3{% + ~~~~~~<bcf:type_pair source="#1" target="#2"#3/>\blx@nl} +\xdef\blx@xml@inherit@field#1#2#3{% + ~~~~~~<bcf:field source="#1" target="#2"#3/>\blx@nl} +\xdef\blx@xml@inherit@block#1{% + ~~~~~~<bcf:field source="#1" skip="true"/>\blx@nl} + \xdef\blx@xml@sorting#1{% ~~<bcf:sorting>\blx@nl #1% @@ -8237,8 +8435,8 @@ ~~<bcf:bibdata section="#1">\blx@nl #2% ~~</bcf:bibdata>\blx@nl} -\xdef\blx@xml@datasource#1#2{% - ~~~~<bcf:datasource type="#1">#2</bcf:datasource>\blx@nl} +\xdef\blx@xml@datasource#1#2#3{% + ~~~~<bcf:datasource type="#1" datatype="#2">#3</bcf:datasource>\blx@nl} \xdef\blx@xml@citekey#1{% ~~~~<bcf:citekey>#1</bcf:citekey>} \xdef\blx@xml@citeset#1#2{% @@ -8260,10 +8458,9 @@ \blx@xml@options{biblatex}{global}{% \blx@xml@svalue{alphaothers}{\labelalphaothers}% \blx@xml@toggle{labelalpha}% - \blx@xml@mvalue{labelname}{\blx@bcf@labelname}% - \iftoggle{blx@labelyear} - {\blx@xml@mvalue{labelyear}{\blx@bcf@labelyear}} - {}% + \blx@xml@mvalue{labelnamespec}{\blx@bcf@labelnamespec}% + \blx@xml@toggle{labelyear}% + \blx@xml@mvalue{labelyearspec}{\blx@bcf@labelyearspec}% \blx@xml@svalue{maxitems}{\the\c@maxitems}% \blx@xml@svalue{maxnames}{\the\c@maxnames}% \blx@xml@svalue{minitems}{\the\c@minitems}% @@ -8284,16 +8481,15 @@ \blx@xml@comment{#1}% \blx@xml@options{biblatex}{#1}{% \blx@xml@toggle{labelalpha}% - \blx@xml@mvalue{labelname}{% - \ifcsdef{blx@bcf@labelname@#1} - {\csuse{blx@bcf@labelname@#1}} - {\blx@bcf@labelname}}% - \iftoggle{blx@labelyear} - {\blx@xml@mvalue{labelyear}{% - \ifcsdef{blx@bcf@labelyear@#1} - {\csuse{blx@bcf@labelyear@#1}} - {\blx@bcf@labelyear}}} - {}% + \blx@xml@mvalue{labelnamespec}{% + \ifcsdef{blx@bcf@labelnamespec@#1} + {\csuse{blx@bcf@labelnamespec@#1}} + {\blx@bcf@labelnamespec}}% + \blx@xml@toggle{labelyear}% + \blx@xml@mvalue{labelyearspec}{% + \ifcsdef{blx@bcf@labelyearspec@#1} + {\csuse{blx@bcf@labelyearspec@#1}} + {\blx@bcf@labelyearspec}}% \blx@xml@toggle{singletitle}% \blx@xml@toggle{skipbib}% \blx@xml@toggle{skiplab}% @@ -8346,6 +8542,7 @@ \begingroup \blx@safe@actives \let\protect\string + % options \edef\labelalphaothers{\labelalphaothers}% \edef\sortalphaothers{\sortalphaothers}% \blx@xmlsanitizeafter{\def\labelalphaothers}{\labelalphaothers}% @@ -8375,6 +8572,15 @@ \endgroup}% \dolistloop\blx@opts@type} {}% + % data inheritance + \eappto\blx@tempa{% + \blx@xml@comment{CROSSREF}% + \blx@xml@inheritance{% + \csuse{blx@biber@inherit@default}% + \csuse{blx@biber@inherit@data}% + }% + }% + % sorting \def\do##1{% \eappto\blx@bcf@presort{\csuse{blx@bcf@presort@##1}}% \eappto\blx@bcf@exclude{\csuse{blx@bcf@exclude@##1}}}% @@ -8387,12 +8593,13 @@ \csuse{blx@biber@sorting@\blx@sorting}% }% }% - \blx@xmlsanitizeafter{\def\blx@bibfiles}{\blx@bibfiles}% - \def\do{\blx@xml@datasource{file}}% + % files + \let\blx@tempb\@empty + \blx@bibdata\blx@tempb\blx@bibfiles \eappto\blx@tempa{% \blx@xml@comment{CITATION DATA}% \blx@xml@comment{section 0}% - \blx@xml@bibdata{0}{\expandafter\docsvlist\expandafter{\blx@bibfiles}}% + \blx@xml@bibdata{0}{\blx@tempb}% \blx@xml@section{0}% }% \immediate\openout\blx@auxout\jobname.bcf\relax @@ -8407,6 +8614,92 @@ %% Customization +% [<exceptions>]{<options>} + +\newrobustcmd*{\DefaultInheritance}[2][]{% + \begingroup + \ifblank{#2} + {} + {\setkeys{blx@inherit@default}{#2}}% + \edef\blx@tempa{\space + inherit\string_all="\iftoggle{blx@inherit@all}{true}{false}"\space + override\string_target="\iftoggle{blx@inherit@override}{true}{false}"}% + \let\blx@tempb\@empty + \let\except\blx@inherit@except + #1% + \xdef\blx@biber@inherit@default{% + \blx@xml@inherit@defaults{\blx@tempa}{\blx@tempb}}% + \endgroup} +\@onlypreamble\DefaultInheritance + +\newtoggle{blx@inherit@all} +\newtoggle{blx@inherit@override} + +\define@key{blx@inherit@default}{all}[true]{% true|false + \settoggle{blx@inherit@all}{#1}} +\define@key{blx@inherit@default}{override}[true]{% true|false + \settoggle{blx@inherit@override}{#1}} + +% {<source>}{<target>}{<options>} + +\newcommand{\blx@inherit@except}[3]{% + \let\blx@tempc\@empty + \ifblank{#3} + {} + {\setkeys{blx@inherit@except}{#3}}% + \eappto\blx@tempb{% + \blx@xml@inherit@type{#1}{#2}{\blx@tempc}}} + +\define@key{blx@inherit@except}{all}[true]{% true|false + \eappto\blx@tempc{ inherit\string_all="#1"}} +\define@key{blx@inherit@except}{override}[true]{% true|false + \eappto\blx@tempc{ override\string_target="#1"}} + +% {<type,type,...>}{<type,type,...>}{<spec>} + +\newrobustcmd*{\DeclareDataInheritance}[3]{% + \begingroup + \let\blx@tempa\@empty + \forcsvlist{\blx@inherit@i{#2}}{#1}% + \let\blx@tempb\@empty + \let\inherit\blx@inherit@field + \let\noinherit\blx@inherit@block + #3% + \xappto\blx@biber@inherit@data{% + \blx@xml@inherit@data{% + \blx@tempa + \blx@tempb}}% + \endgroup} +\@onlypreamble\DeclareDataInheritance + +\def\blx@inherit@i#1#2{% + \forcsvlist{\blx@inherit@ii{#2}}{#1}} + +\def\blx@inherit@ii#1#2{% + \eappto\blx@tempa{\blx@xml@inherit@type{#1}{#2}{}}} + +% [<options>]{<source>}{<target>} + +\newcommand{\blx@inherit@field}[3][]{% + \let\blx@tempc\@empty + \ifblank{#1} + {} + {\setkeys{blx@inherit@field}{#1}}% + \eappto\blx@tempb{% + \blx@xml@inherit@field{#2}{#3}{\blx@tempc}}} + +\newcommand{\blx@inherit@block}[1]{% + \eappto\blx@tempb{\blx@xml@inherit@block{#1}}} + +\define@key{blx@inherit@field}{override}[true]{% true|false + \ifstrequal{#1}{true} + {\def\blx@tempc{ override_target="true"}} + {\def\blx@tempc{ override_target="false"}}} + +\newrobustcmd*{\ResetDataInheritance}{% + \global\csundef{blx@biber@inherit@data}} +\@onlypreamble\ResetDataInheritance + % {<name>}{<spec>} \newrobustcmd*{\DeclareSortingScheme}[2]{% @@ -8528,11 +8821,11 @@ % [<type,type,...>]{<field,field,...>} \newrobustcmd*{\DeclareLabelname}[2][]{% - \blx@defmvalue{labelname}{#1}{#2}} + \blx@defmvalue{labelnamespec}{#1}{#2}} \@onlypreamble\DeclareLabelname \newrobustcmd*{\DeclareLabelyear}[2][]{% - \blx@defmvalue{labelyear}{#1}{#2}} + \blx@defmvalue{labelyearspec}{#1}{#2}} \@onlypreamble\Declarelabelyear \def\blx@defmvalue#1#2#3{% |