summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/biblatex-chicago/latex/chicago-notes.cbx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-chicago/latex/chicago-notes.cbx')
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-chicago/latex/chicago-notes.cbx75
1 files changed, 42 insertions, 33 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-chicago/latex/chicago-notes.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-chicago/latex/chicago-notes.cbx
index 97b61e12e6..f5b2f942e0 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-chicago/latex/chicago-notes.cbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-chicago/latex/chicago-notes.cbx
@@ -4,7 +4,7 @@
% formatted according to the specifications of the Chicago Manual of
% Style.
-\ProvidesFile{chicago-notes.cbx}[2022/07/02 v 3.18 biblatex citation style]
+\ProvidesFile{chicago-notes.cbx}[2022/11/17 v 3.18b biblatex citation style]
%%%% Biblatex initialization + Chicago options + Toggles %%%%
@@ -13,6 +13,34 @@
\newbool{cms:comma}
\newbool{cms:nd}
+% Here we provide a slightly improved \if@cms@capital replacement
+% using expl3 facilities, and also backport a patch for a bug in
+% (older versions of) expl3's case-changing code.
+
+\ifdef{\ExplSyntaxOff}{}{\RequirePackage{xparse}\RequirePackage{expl3}}%
+
+\ExplSyntaxOn%
+
+\NewDocumentCommand \IfCMSFieldInitCS {m}
+{
+ \regex_match:nnTF
+ {\A(?:\c{citeincite(?:f|s){0,2}}|\cM.)}
+ {#1}
+ {\use_i:nn}
+ {\use_ii:nn}
+}
+
+\cs_if_exist:NTF \__text_change_case_switch_titleonly:nnNnnnn
+{}
+{\cs_new:Npn \__text_change_case_switch_titleonly:nnNnnnn #1#2#3#4#5#6#7
+ {
+ \__text_change_case_store:n {#7}
+ \__text_change_case_break:w
+ }
+}
+
+\ExplSyntaxOff
+
\providecommand*{\mkibid}[1]{#1}
\providetoggle{cms@oneyear}% Needed for author-date
@@ -1456,10 +1484,8 @@
\ifx\cms@ldt@cmsnameparts\cms@tpl
#1{#3}%
#1[#2]{#3}
- \blx@warning@noline{#2 is the So Global Template}
\else
#1[#2]{#3}
- \blx@warning@noline{#2 is the Local Template}
\fi}
%% Name format declarations for bibliography and notes. The
@@ -6971,7 +6997,8 @@
\DeclareFieldFormat[patent]{lostitle}{\MakeSentenceCase*{#1}\isdot}
-\DeclareFieldFormat{prenote}{\ifcapital{\MakeCapital{#1}}{#1}\isdot}
+\DeclareFieldFormat{prenote}{%
+ \ifcapital{\MakeCapital{#1}}{#1}\isdot}
%% comprange code moved to .sty
@@ -7233,7 +7260,7 @@
\DeclareFieldFormat{letterday}{\mkbibcurdinal{#1}}
\DeclareFieldFormat{note}{%
- \if@cms@capital{#1}{\MakeCapital{#1}}{#1}}%
+ \ifcapital{\IfCMSFieldInitCS{#1}{#1}{\MakeCapital{#1}}}{#1}}%
\DeclareFieldFormat{capital}{%
\ifcapital{\MakeCapital{#1}}{#1}}
@@ -7388,7 +7415,7 @@
\DeclareFieldFormat{edition}{% New in 0.8
\ifinteger{#1}
{\mkbibordedition{#1}~\bibstring{edition}}%
- {\ifcapital
+ {\ifcapital%
{\MakeCapital{#1\isdot}}%
{#1\isdot}}}
@@ -7413,10 +7440,12 @@
\DeclareFieldFormat{usere}{[#1]} % Better than mkbibbrackets?
\DeclareFieldFormat{titleaddon}{%
- \if@cms@capital{#1}{\MakeCapital{#1\isdot}}{#1\isdot}}%
+ \ifcapital{\IfCMSFieldInitCS{#1}{#1\isdot}%
+ {\MakeCapital{#1\isdot}}}{#1\isdot}}%
\DeclareFieldFormat[periodical]{titleaddon}{%
- \ifcapital{\MakeCapital{#1\isdot}}{#1\isdot}}
+ \ifcapital{\IfCMSFieldInitCS{#1}{#1\isdot}%
+ {\MakeCapital{#1\isdot}}}{#1\isdot}}
\DeclareFieldAlias{booktitleaddon}{titleaddon}
@@ -7502,33 +7531,13 @@
\DeclareFieldFormat{shortseries}{#1\isdot}
\DeclareFieldFormat{addendum}{%
- \if@cms@capital{#1}{\MakeCapital{#1\isdot}}{#1\isdot}}
+ \ifcapital{\IfCMSFieldInitCS{#1}{#1\isdot}%
+ {\MakeCapital{#1\isdot}}}{#1\isdot}}
\DeclareFieldFormat[jurisdiction,legal,legislation]{addendum}{%
- \ifcapital{\mkbibparens{\MakeCapital{#1\isdot}}}{\mkbibparens{#1\isdot}}}
-
-% There was unfortunate interaction between the case-changing code and
-% cite commands when the latter were at the beginning of the
-% field. This modified \ifcapital will be used in the fields in which
-% the \citeincite(s) commands can appear.
-
-\newrobustcmd*{\if@cms@capital}[1]{%
- \noexpandarg
- \StrChar{#1}{1}[\cms@char]%
- \ifboolexpr{%
- test {\ifcapital}%
- and
- not test {\ifdefstring{\cms@char}{\citeincite}}%
- and
- not test {\ifdefstring{\cms@char}{\citeincitef}}%
- and
- not test {\ifdefstring{\cms@char}{\citeincites}}%
- and
- not test {\ifdefstring{\cms@char}{\citeincitefs}}%
- }%
- {\@firstoftwo}%
- {\@secondoftwo}%
-}
+ \ifcapital%
+ {\mkbibparens{\IfCMSFieldInitCS{#1}{#1\isdot}%
+ {\MakeCapital{#1\isdot}}}}{\mkbibparens{#1\isdot}}}
% For annotation fixes move all code for separators to the entrytail
% macro, below.