summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-ext/ext-dashed-common.bbx
blob: f85006520763a9ca10b9395f97e5617bc359a90d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
\ProvidesFile{ext-dashed-common.bbx}
  [2022/03/06 v0.15 common files for extended biblatex
   dashed bibliography styles (MW)]

\blx@inputonce{ext-biblatex-aux.def}{auxiliary code for ext-biblatex}
  {}{}{}{}

% \DeclareBibliographyOption checks if an option is already defined.
% if we want to overwrite the definition we need to trick it into
% thinking the option has not been defined yet.
\blx@kv@undef{blx@opt@pre}{dashed}
% We want to define 'dashed' with a new type, so we need to make
% biblatex forget about the old type when it passes the options over to
% Biber.
\ifundef\listcsremove
  {\extblx@warning@noline{%
     'etoolbox' does not provide '\string\listcsremove'.\MessageBreak
     Please update 'etoolbox' to v2.4 (2017-01-02)\MessageBreak
     or later}}
  {\listcsremove{blx@globalopts@boolean}{dashed}}

\DeclareBiblatexOption{global,type,entry}[string]{dashed}[true]{%
  \ifcsdef{extblx@opt@dashed@#1}
    {\csuse{extblx@opt@dashed@#1}}
    {\extblx@warning@noline{%
       Invalid value '#1' for option 'dashed'.\MessageBreak
       Possible values are 'fullhash', 'true',\MessageBreak
       'bibnamehash', 'false'.\MessageBreak
       Falling back to 'dashed=false'}%
     \csuse{extblx@opt@dashed@false}}}

\csdef{extblx@opt@dashed@fullhash}{%
  \ExecuteBibliographyOptions{pagetracker}%
  \renewbibmacro*{bbx:savehash}{\savefield{fullhash}{\bbx@lasthash}}%
  \renewbibmacro*{bbx:dashcheck}[2]{%
    \ifboolexpr{
      test {\iffieldequals{fullhash}{\bbx@lasthash}}
      and
      not test \iffirstonpage
      and
      (
         not bool {bbx@inset}
         or
         test {\iffieldequalstr{entrysetcount}{1}}
      )
    }
      {##1}
      {##2}}}
\csletcs{extblx@opt@dashed@true}{extblx@opt@dashed@fullhash}

\csdef{extblx@opt@dashed@bibnamehash}{%
  \ExecuteBibliographyOptions{pagetracker}%
  \renewbibmacro*{bbx:savehash}{\savefield{bibnamehash}{\bbx@lasthash}}%
  \renewbibmacro*{bbx:dashcheck}[2]{%
    \ifboolexpr{
      test {\iffieldequals{bibnamehash}{\bbx@lasthash}}
      and
      not test \iffirstonpage
      and
      (
         not bool {bbx@inset}
         or
         test {\iffieldequalstr{entrysetcount}{1}}
      )
    }
      {##1}
      {##2}}}

\csdef{extblx@opt@dashed@false}{%
  \renewbibmacro*{bbx:savehash}{}%
  \renewbibmacro*{bbx:dashcheck}[2]{##2}}

% We need to execute the options that were already executed
% by the standard styles again, because we changed the
% underlying definitions.
\ExecuteBibliographyOptions{dashed=true}%

\endinput
%
% This file is part of the biblatex-ext bundle.
% biblatex-ext is released under the LaTeX Project Public License v1.3c
% or later.
%
% A complete list of files included in that package can be found in
% README.md or - failing that - in ext-standard.bbx.
%
% Official releases of this package are on CTAN
%   https://www.ctan.org/pkg/biblatex-ext
% development takes place on GitHub
%   https://github.com/moewew/biblatex-ext
%