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.bbx127
1 files changed, 63 insertions, 64 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
index 2e17e6b3f8..09f83d0087 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
@@ -12,7 +12,7 @@
%%
%% The Current Maintainer of this work is Philip Kime.
-\ProvidesFile{apa.bbx}[2020/02/22\space v9.6\space APA biblatex references style]
+\ProvidesFile{apa.bbx}[2020/04/05\space v9.7\space APA biblatex references style]
\RequireBiber[3]
\RequireBibliographyStyle{standard}
\urlstyle{rm} % APA examples all have URLs in same font as text
@@ -62,24 +62,45 @@
\fi
}
-\newrobustcmd{\mkbibparense}[1]{%
- \setbox0=\hbox{#1\foreverunspace}%
+% we need a way to save the state of the punctuation buffer
+% cf. \blx@initunit in biblatex.sty for what we need to copy
+
+% this uses the internal implementation of etoolbox toggles
+% fingers crossed no one messes with it
+\newrobustcmd*{\apablx@savetoggle}[1]{%
+ \csletcs{apablx@savedtoggle@#1}{etb@tgl@#1}}
+
+\newrobustcmd*{\apablx@restoretoggle}[1]{%
+ \csletcs{etb@tgl@#1}{apablx@savedtoggle@#1}}
+
+\newrobustcmd*{\apablx@savepunctstate}{%
+ \apablx@savetoggle{blx@block}%
+ \apablx@savetoggle{blx@unit}%
+ \apablx@savetoggle{blx@insert}%
+ \apablx@savetoggle{blx@lastins}%
+ \apablx@savetoggle{blx@keepunit}%
+ \let\apablx@savd@unitpunct\blx@unitpunct
+ \let\apablx@savd@puncthook\abx@puncthook}
+
+\newrobustcmd*{\apablx@restorepunctstate}{%
+ \global\apablx@restoretoggle{blx@block}%
+ \global\apablx@restoretoggle{blx@unit}%
+ \global\apablx@restoretoggle{blx@insert}%
+ \global\apablx@restoretoggle{blx@lastins}%
+ \global\apablx@restoretoggle{blx@keepunit}%
+ \global\let\blx@unitpunct\apablx@savd@unitpunct
+ \global\let\abx@puncthook\apablx@savd@puncthook}
+
+% printtext that checks if it would print anything
+\newrobustcmd{\printtexte}[2][]{%
+ \apablx@savepunctstate
+ \setbox0=\hbox{#2\foreverunspace}%
+ \apablx@restorepunctstate
\ifdim\wd0=0pt
\else
- % Since we are evaluating the argument twice and it contains \setunit,
- % need to sanitise \setunit second time around. Can't just put in \box0
- % as it might be long and won't linebreak
- \mkbibparens{\setunit{}#1}%
- \fi}
-
-\newrobustcmd{\mkbibbracketse}[1]{%
- \setbox0=\hbox{#1\foreverunspace}%
- \ifdim\wd0=0pt
- \else
- % Since we are evaluating the argument twice and it contains \setunit,
- % need to sanitise \setunit second time around. Can't just put in \box0
- % as it might be long and won't linebreak
- \mkbibbrackets{\setunit{}#1}%
+ \ifblank{#1}
+ {\printtext{#2}}
+ {\printtext[#1]{#2}}%
\fi}
%
@@ -701,36 +722,34 @@
\usebibmacro{addinfo2}}}%
\newbibmacro*{addinfo1}{%
- \printtext{%
- \mkbibparense{%
- \usebibmacro{editor+trans+narr}%
- \setunit*{\addsemicolon\addspace}%
- \printfield{edition}%
- \setunit*{\addcomma\addspace}%
- \ifthenelse{\ifentrytype{report}\OR%
- \ifentrytype{thesis}\OR%
- \ifentrytype{unpublished}\OR%
- \ifentrytype{dataset}\OR%
- \ifentrytype{software}\OR%
- \ifentrytype{audio}\OR%
- \ifentrytype{patent}\OR%
- \ifentrytype{image}}{\usebibmacro{addinfo3}}{}%
- \setunit*{\addcomma\addspace}%
- \ifentrytype{inbook}{\printfield{pages}}{}%
- \setunit*{\addcomma\addspace}%
- \ifentrytype{book}{\printfield{volumes}}{}%
- \setunit*{\addcomma\addspace}%
- \ifentrytype{book}{\printfield{volume}}{}}}}
+ \printtexte[parens]{%
+ \usebibmacro{editor+trans+narr}%
+ \setunit*{\addsemicolon\addspace}%
+ \printfield{edition}%
+ \setunit*{\addcomma\addspace}%
+ \ifthenelse{\ifentrytype{report}\OR%
+ \ifentrytype{thesis}\OR%
+ \ifentrytype{unpublished}\OR%
+ \ifentrytype{dataset}\OR%
+ \ifentrytype{software}\OR%
+ \ifentrytype{audio}\OR%
+ \ifentrytype{patent}\OR%
+ \ifentrytype{image}}{\usebibmacro{addinfo3}}{}%
+ \setunit*{\addcomma\addspace}%
+ \ifentrytype{inbook}{\printfield{pages}}{}%
+ \setunit*{\addcomma\addspace}%
+ \ifentrytype{book}{\printfield{volumes}}{}%
+ \setunit*{\addcomma\addspace}%
+ \ifentrytype{book}{\printfield{volume}}{}}}
% Additional post title information in brackets
\newbibmacro*{addinfo2}{%
- \printtext{%
- \mkbibbracketse{%
- \iffieldbibstring{entrysubtype}
- {\bibcplstring{\thefield{entrysubtype}}}
- {\printfield{entrysubtype}}%
- \setunit*{\addsemicolon\addspace}%
- \printfield{note}}}}
+ \printtexte[brackets]{%
+ \iffieldbibstring{entrysubtype}
+ {\bibcplstring{\thefield{entrysubtype}}}
+ {\printfield{entrysubtype}}%
+ \setunit*{\addsemicolon\addspace}%
+ \printfield{note}}}
% number/issue information
\newbibmacro*{addinfo3}{%
@@ -1533,8 +1552,6 @@
\usebibmacro{title}%
\newunit\newblock
\printfield{type}%
- \newunit
- \printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit\newblock
@@ -1588,8 +1605,6 @@
\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
- \printfield{note}%
- \newunit\newblock
\usebibmacro{location+publisher}%
\newunit\newblock
\usebibmacro{doi+url}%
@@ -1621,8 +1636,6 @@
\newunit\newblock
\usebibmacro{eventinfo}%
\newunit\newblock
- \printfield{note}%
- \newunit\newblock
\printlist{organization}%
\newunit
\printfield{venue}%
@@ -1730,8 +1743,6 @@
\printfield{type}%
\newunit
\printfield{version}%
- \newunit
- \printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit
@@ -1807,8 +1818,6 @@
\newunit\newblock
\usebibmacro{location+publisher}%
\newunit\newblock
- \printfield{note}%
- \newunit\newblock
\usebibmacro{doi+url}%
\newunit\newblock
\printfield{addendum}%
@@ -1835,8 +1844,6 @@
\setunit{\addcomma\addspace}
\printfield{pages}%
\newunit\newblock
- \printfield{note}%
- \newunit\newblock
\usebibmacro{doi+url}%
\newunit\newblock
\printfield{addendum}%
@@ -1868,8 +1875,6 @@
\setunit{\addcomma\addspace}
\printfield{pages}%
\newunit\newblock
- \printfield{note}%
- \newunit\newblock
\printlist{organization}%
\newunit\newblock
\usebibmacro{doi+url}%
@@ -1895,8 +1900,6 @@
\newunit\newblock
\printlist{institution}%
\newunit\newblock
- \printfield{note}%
- \newunit\newblock
\usebibmacro{location+publisher}%
\newunit\newblock
\usebibmacro{doi+url}%
@@ -1944,8 +1947,6 @@
\newunit\newblock
\usebibmacro{location+publisher}%
\newunit\newblock
- \printfield{note}%
- \newunit\newblock
\usebibmacro{doi+url}%
\newunit\newblock
\printfield{addendum}%
@@ -1973,8 +1974,6 @@
\setunit{\addcomma\addspace}
\printlist{institution}%
\newunit\newblock
- \printfield{note}%
- \newunit\newblock
\usebibmacro{doi+url}%
\newblock
\printfield{addendum}%