]> hydra-www.ietfng.org Git - mcv-academic/commitdiff
Tweak hlblx implementation
authorNathaniel Wesley Filardo <nwfilardo@gmail.com>
Thu, 2 Apr 2020 17:04:23 +0000 (18:04 +0100)
committeradin <adin@ic.unicamp.br>
Tue, 7 Apr 2020 16:46:02 +0000 (13:46 -0300)
Move the patch point from prior to name:delim to after, using the
upstream name:hook macros.  This avoids applying formatting to
delimiters (and so avoids the need to patch name:delim) and so eases
more expressive fomatting, including coloration, e.g.:

\makeatletter
\renewcommand*{\hlblx@format}{\color{blue}}
\makeatother

academic.sty

index 6337dd1fd52a437c9886452a2bad65fa03f6d12d..d293400c6444ade2a8d004a7858dfb066f4fa25b 100644 (file)
   \fi
 }
 
-\def\hlblx@bibfile@name{\jobname.bib}
+\def\hlblx@bibfile@name{\jobname-hlblx.bib}
 \newwrite\hlblx@bibfile
 \immediate\openout\hlblx@bibfile=\hlblx@bibfile@name
 
 \newcounter{hlblx@name}
 \setcounter{hlblx@name}{0}
 
+% Ensure that the generated bib file isn't empty, because that causes some
+% tools to croak.
+\immediate\write\hlblx@bibfile{%
+ @misc{hlblx-dummy, options={dataonly=true},}%
+}
+
 \newcommand*{\hlblx@writenametobib}[1]{%
   \stepcounter{hlblx@name}%
   \edef\hlblx@tmp@nocite{%
 {}
 {}
 
-\newbibmacro*{name:bold}[2]{%
-  \def\do##1{\iffieldequalstr{hash}{##1}{\bfseries\listbreak}{}}%
+\newcommand*{\hlblx@format}{\bfseries}
+\newbibmacro*{name:hlblx}[1]{%
+  \def\do##1{\iffieldequalstr{hash}{##1}{\hlblx@format\listbreak}{}}%
   \dolistloop{\hlbxl@boldhashes}%
 }
-
-\xpretobibmacro{name:family}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
-\xpretobibmacro{name:given-family}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
-\xpretobibmacro{name:family-given}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
-\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}
-
-\xapptobibmacro{name:family}{\endgroup}{}{}
-\xapptobibmacro{name:given-family}{\endgroup}{}{}
-\xapptobibmacro{name:family-given}{\endgroup}{}{}
-\xapptobibmacro{name:delim}{\endgroup}{}{}
-
+\xpretobibmacro{name:hook}{\usebibmacro{name:hlblx}{#1}}{}{}
 
 % User macros
 \newcommand*{\addboldnames}{\forcsvlist\hlblx@writenametobib}