summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-ext/ext-dashed-common.bbx
blob: b8311e3d42f1a0ccb818966b3a4ca036199d44f7 (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
\ProvidesFile{ext-dashed-common.bbx}
  [2018/03/20 v0.1a common files for extended biblatex
   dashed bibliography styles (MW)]

% \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.
\csundef{KV@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
  {\PackageWarningNoLine{biblatex-ext}{%
     'etoolbox' does not provide '\string\listcsremove'.\MessageBreak
     Please update 'etoolbox' to v2.4 (2017-01-02)\MessageBreak or later}}
  {\listcsremove{blx@globalopts@boolean}{dashed}}

\DeclareBibliographyOption[string]{dashed}[true]{%
  \ifcsdef{extblx@opt@dashed@#1}
    {\csuse{extblx@opt@dashed@#1}}
    {\PackageWarningNoLine{biblatex-ext}{%
       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 option that were already executed
% by the standard styles again, because we changed the
% underlying definitions.
\ExecuteBibliographyOptions{dashed=true}%

\endinput