summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx')
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx222
1 files changed, 117 insertions, 105 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
index 2195222875..276fa50c0e 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
@@ -1,4 +1,4 @@
-%% Copyright 2019 Philip Kime
+%% Copyright 2020 Philip Kime
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -12,7 +12,7 @@
%%
%% The Current Maintainer of this work is Philip Kime.
-\ProvidesFile{apa.bbx}[2019/12/22\space v9.4\space APA biblatex references style]
+\ProvidesFile{apa.bbx}[2020/02/01\space v9.5\space APA biblatex references style]
\RequireBiber[3]
\RequireBibliographyStyle{standard}
\urlstyle{rm} % APA examples all have URLs in same font as text
@@ -491,48 +491,46 @@
{\addcomma\space\ldots\space}
{\ifthenelse{\value{listcount}>\maxprtauth\AND\value{listcount}<\value{listtotal}}
{}
- {\printtext{\usebibmacro{name:apa:family-given}%
+ {\usebibmacro{name:apa:family-given}%
{\namepartfamily}%
{\namepartgiven}%
{\namepartgiveni}%
{\namepartprefix}%
- {\namepartsuffix}}%
+ {\namepartsuffix}%
\let\bibstring\bibcplstring
- \setunit{\addspace}%
- \printtext{\mkbibparense{\usebibmacro{role}}}%
- \hasitemannotation[\currentname][username]{\addspace\mkbibbrackets{\getitemannotation[\currentname][username]}}{}}}%
- \ifthenelse{\value{listcount}=\value{listtotal}}%
- {\ifmorenames
- {\printdelim{andothersdelim}
- \bibstring{andothers}}
- {}%
- \let\bibstring\bibcplstring
- \setunit{\addspace}%
- \printtext{\mkbibparense{\usebibmacro{roles}}}}
- {}}
+ \usebibmacro{role}{\addspace}{\mkbibparens}%
+ \hasitemannotation[\currentname][username]
+ {\addspace\mkbibbrackets{\getitemannotation[\currentname][username]}}
+ {}}}%
+ \ifthenelse{\value{listcount}=\value{listtotal}}%
+ {\ifmorenames
+ {\printdelim{andothersdelim}%
+ \bibstring{andothers}}
+ {}%
+ \let\bibstring\bibcplstring
+ \usebibmacro{roles}{\addspace}{\mkbibparens}}
+ {}}
\DeclareNameFormat{apanames}{%
\ifthenelse{\value{listcount}=\maxprtauth\AND\value{listcount}<\value{listtotal}}
{\addcomma\space\ldots\space}
{\ifthenelse{\value{listcount}>\maxprtauth\AND\value{listcount}<\value{listtotal}}
{}
- {\printtext{\usebibmacro{name:apa:given-family}%
+ {\usebibmacro{name:apa:given-family}%
{\namepartfamily}%
{\namepartgiven}%
{\namepartgiveni}%
{\namepartprefix}%
- {\namepartsuffix}}%
+ {\namepartsuffix}%
\let\bibstring\bibcpsstring
- \setunit{\addcomma\addspace}%
- \usebibmacro{role}}}%
+ \usebibmacro{role}{\addcomma\space}{\@firstofone}}}%
\ifthenelse{\value{listcount}=\value{listtotal}}%
{\ifmorenames
{\printdelim{andothersdelim}%
\bibstring{andothers}}
{}%
\let\bibstring\bibcplstring
- \setunit{\addspace}%
- \usebibmacro{roles}}
+ \usebibmacro{roles}{\addspace}{\@firstofone}}
{}}
\renewbibmacro*{author/editor}{%
@@ -585,9 +583,12 @@
\printfield{nameaddon}%
\ifnameundef{with}
{}
- {\setunit{}\addspace\mkbibparens{\printtext{\bibstring{with}\addspace}%
- \printnames[apaauthor][-\value{listtotal}]{with}}
- \setunit*{\addspace}}}
+ {\setunit{\addspace}%
+ \printtext[parens]{%
+ \bibstring{with}%
+ \setunit{\addspace}%
+ \printnames[apaauthor][-\value{listtotal}]{with}}%
+ \setunit{\addspace}}}
\newbibmacro*{author:related}{%
\ifnameundef{author}
@@ -639,8 +640,8 @@
\DeclareFieldFormat{apadate}{%
\ifboolexpr{ test {\ifdatecirca} or test {\ifdateuncertain} }
- {\printtext{\mkbibbrackets{#1}}}
- {\printtext{\mkbibparens{#1}}}}
+ {\mkbibbrackets{#1}}
+ {\mkbibparens{#1}}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -758,9 +759,10 @@
\renewbibmacro*{eprint}{%
\iffieldundef{eprinttype}
{}
- {\printtext{%
- \iffieldbibstring{eprinttype}{\bibcplstring{\strfield{eprinttype}}}{\strfield{eprinttype}}%
- \setunit{\addspace}}}%
+ {\iffieldbibstring{eprinttype}
+ {\bibcplstring{\strfield{eprinttype}}}
+ {\strfield{eprinttype}}%
+ \setunit{\addspace}}%
\printfield{eprint}}
\DeclareFieldFormat{eprint}{#1}
@@ -811,73 +813,79 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Names
-% Individual name roles
-\newbibmacro*{role}{%
- \hasitemannotation[\currentname][role]%
- {\getitemannotation[\currentname][role]}
- {\ifitemannotation[\currentname][role]{writer}
- {\bibstring{writer}%
- \setunit{\addspace\&\addspace}}
- {}%
- \ifitemannotation[\currentname][role]{director}
- {\bibstring{director}%
- \setunit{\addspace\&\addspace}}
- {}%
- \ifitemannotation[\currentname][role]{execproducer}
- {\bibstring{execproducer}%
- \setunit{\addspace\&\addspace}}
- {}%
- \ifitemannotation[\currentname][role]{producer}
- {\bibstring{producer}%
- \setunit{\addspace\&\addspace}}
- {}%
- \ifitemannotation[\currentname][role]{host}
- {\bibstring{host}%
- \setunit{\addspace\&\addspace}}
+\newcommand*{\apabbx@ifrole@item}{%
+ \xifinlist{item@\currentname @role@\the\value{listcount}}%
+ \abx@annotation@defined}
+
+\newtoggle{apabbx:role:item:punct}
+
+\newcommand*{\apabbx@rolelist@item}{}
+\forcsvlist{\listadd\apabbx@rolelist@item}{%
+ writer,director,execproducer,producer,host,chair,guestexpert}
+
+\newcommand*{\apabbx@printrole@item@i}[1]{%
+ \ifitemannotation[\currentname][role]{#1}
+ {\iftoggle{apabbx:role:item:punct}
+ {\addspace\&\space}
{}%
- \ifitemannotation[\currentname][role]{chair}
- {\bibstring{chair}%
- \setunit{\addspace\&\addspace}}
+ \bibstring{#1}%
+ \toggletrue{apabbx:role:item:punct}}
+ {}%
+}
+
+\newcommand*{\apabbx@printrole@item}{%
+ \forlistloop{\apabbx@printrole@item@i}{\apabbx@rolelist@item}}
+
+% Individual name roles
+% takes two arguments
+% {<pre punct>}{<wrapper>}
+\newbibmacro*{role}[2]{%
+ \apabbx@ifrole@item
+ {#1%
+ #2{%
+ \togglefalse{apabbx:role:item:punct}%
+ \hasitemannotation[\currentname][role]%
+ {\getitemannotation[\currentname][role]}
+ {\apabbx@printrole@item}}}
+ {}%
+}
+
+\newcommand*{\apabbx@ifrole@field}{%
+ \xifinlist{field@\currentname @role@}%
+ \abx@annotation@defined}
+
+\newtoggle{apabbx:role:field:punct}
+
+\newcommand*{\apabbx@rolelist@field}{}
+\forcsvlist{\listadd\apabbx@rolelist@field}{%
+ writers,directors,execproducers,producers,hosts,chairs,guestexperts}
+
+\newcommand*{\apabbx@printrole@field@i}[1]{%
+ \iffieldannotation[\currentname][role]{#1}
+ {\iftoggle{apabbx:role:field:punct}
+ {\addspace\&\space}
{}%
- \ifitemannotation[\currentname][role]{guestexpert}
- {\bibstring{guestexpert}%
- \setunit{\addspace\&\addspace}}
- {}}%
- \setunit{}}
+ \bibstring{#1}%
+ \toggletrue{apabbx:role:field:punct}}
+ {}%
+}
+
+\newcommand*{\apabbx@printrole@field}{%
+ \forlistloop{\apabbx@printrole@field@i}{\apabbx@rolelist@field}}
% roles for complete name lists
-\newbibmacro*{roles}{%
- \hasfieldannotation[\currentname][role]%
- {\getfieldannotation[\currentname][role]}
- {\iffieldannotation[\currentname][role]{writers}
- {\bibstring{writers}%
- \setunit{\addspace\&\addspace}}
- {}%
- \iffieldannotation[\currentname][role]{directors}
- {\bibstring{directors}%
- \setunit{\addspace\&\addspace}}
- {}%
- \iffieldannotation[\currentname][role]{execproducers}
- {\bibstring{execproducers}%
- \setunit{\addspace\&\addspace}}
- {}%
- \iffieldannotation[\currentname][role]{producers}
- {\bibstring{producers}%
- \setunit{\addspace\&\addspace}}
- {}%
- \iffieldannotation[\currentname][role]{hosts}
- {\bibstring{hosts}%
- \setunit{\addspace\&\addspace}}
- {}%
- \iffieldannotation[\currentname][role]{chairs}
- {\bibstring{chairs}%
- \setunit{\addspace\&\addspace}}
- {}%
- \iffieldannotation[\currentname][role]{guestexperts}
- {\bibstring{guestexperts}%
- \setunit{\addspace\&\addspace}}
- {}}%
- \setunit{}}
+% takes two arguments
+% {<pre punct>}{<wrapper>}
+\newbibmacro*{roles}[2]{%
+ \apabbx@ifrole@field
+ {#1%
+ #2{%
+ \togglefalse{apabbx:role:field:punct}%
+ \hasfieldannotation[\currentname][role]%
+ {\getfieldannotation[\currentname][role]}
+ {\apabbx@printrole@field}}}
+ {}%
+}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -969,7 +977,7 @@
\setunit*{\addcomma\addspace}%
\usebibmacro{apaeditorstrg}{editor}%
\setunit*{\addspace\&\space}%
- \printtext{\bibcpstring{translator}}}
+ \bibcpstring{translator}}
{\ifnameundef{editor}%
{}%
{\printnames[apanames][-\value{listtotal}]{editor}%
@@ -981,13 +989,13 @@
{\setunit{}}%
{\printnames[apanames][-\value{listtotal}]{translator}%
\setunit{\addcomma\addspace}%
- \printtext{\bibcpstring{translator}}%
+ \bibcpstring{translator}%
\clearname{translator}}%
\ifnameundef{narrator}%
{\setunit{}}%
{\printnames[apanames][-\value{listtotal}]{narrator}%
\setunit{\addcomma\addspace}%
- \printtext{\bibcpstring{narrator}}%
+ \bibcpstring{narrator}%
\clearname{narrator}}}}}
\newbibmacro*{editor+trans}{%
@@ -1055,7 +1063,10 @@
not test {\iffieldundef{origyear}}
not test {\iffieldundef{labelyear}}
and not test {\iffieldsequal{labelyear}{origyear}}}
- {\printtext{\mkbibparens{\bibcpstring{origyear}~\printorigdate}}%
+ {\printtext[parens]{%
+ \bibcpstring{origyear}
+ \setunit{\addnbspace}%
+ \printorigdate}%
\renewcommand*{\finentrypunct}{\relax}}
{}}
@@ -1216,11 +1227,12 @@
% (APA 10.12) Audiovisual
\newbibmacro*{mainvideo}{%
- \iffieldundef{maintitle}{}
+ \iffieldundef{maintitle}
+ {}
{\usebibmacro{in}%
\printnames[apanames][-\value{listtotal}]{execproducer}%
\setunit{\addspace}%
- \printtext{\mkbibparens{\bibcplstring{execproducers}}}%
+ \bibcplstring[\mkbibparens]{execproducers}%
\setunit{\addcomma\addspace}%
\printfield{maintitle}}}
@@ -1351,9 +1363,9 @@
% disable normal date printing if it's in the citation info
\iftoggle{apa:courtdate}
{\iflistundef{organization}
- {\printtext{\mkbibparens{#1}}}
- {\printtext{\mkbibparens{%
- \printlist{organization}\space #1}}}}
+ {\mkbibparens{#1}}
+ {\mkbibparens{%
+ \printlist{organization}\space #1}}}
{}}
%
@@ -1384,7 +1396,7 @@
\newbibmacro*{legmattitle}{%
\iffieldundef{title}
- {\bibcpsstring{\thefield{source}}%
+ {\ifbibxstring{\thefield{source}}{\bibcpsstring{\thefield{source}}}{}%
\setunit*{\addspace}%
\bibcpsstring{\thefield{type}}%
\setunit*{\addspace}%
@@ -2048,8 +2060,8 @@
{}
{\iffieldundef{urlyear}
{}
- {\printtext{\bibstring{retrieved}}%
- \addspace
+ {\bibstring{retrieved}%
+ \setunit{\addspace}%
\printurldate
\setunit{\urldatecomma}%
\bibstring{from}%