-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrkut.cbx
120 lines (100 loc) · 3.5 KB
/
trkut.cbx
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
% Põhineb stiilil authoryear-ibid
% https://github.com/plk/biblatex/blob/dev/tex/latex/biblatex/cbx/authoryear-ibid.cbx
\ProvidesFile{trkut.cbx}
\ExecuteBibliographyOptions{labeldateparts,uniquename=false,uniquelist,pagetracker,ibidtracker=constrict,maxcitenames=2,mincitenames=1,autocite=inline}
\providecommand*{\mkibid}[1]{#1}
\DefineBibliographyStrings{english}{%
ibidem = {\textit{ibid.}},
andothers = {\textit{et al.}},
}
\newbool{cbx:parens}
\newbool{cbx:loccit}
\DeclareBibliographyOption[boolean]{ibidpage}[true]{%
\ifstrequal{#1}{true}
{\ExecuteBibliographyOptions{loccittracker=constrict}}
{\ExecuteBibliographyOptions{loccittracker=false}}}
% Käsk pealkirjade lühendamiseks lõpetades punktiiriga
\def\@threefirstwords #1 #2 #3 #4\\#5{%
\ifblank{#1}{}{#1}\ifblank{#2}{}{ #2}\ifblank{#3}{}{ #3}\ifblank{#4}{}{#5}%
}%
\edef\threefirstwords#1#2{\noexpand\@threefirstwords#1\space\space\space\noexpand\\{#2}}
% don't use urldate as a substitute for date if it is missing
\DeclareLabeldate{%
\field{date}
\field{year}
\field{eventdate}
\field{origdate}
%\field{urldate}
\literal{}
}
\usepackage{xstring}
\newbibmacro*{cite}{%
\global\boolfalse{cbx:loccit}%
\iffieldundef{shorthand}
{\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}%
{\ifentrytype{customa}{%
% customa is for the (Name dd.mm.yyyy: lisa n) format
\printtext[bibhyperref]{\printnames{labelname}
\setunit{\nameyeardelim}%
\mkbibdateshort{year}{month}{day}}%
\addcolon\newunit%
\printfield{addendum}%
}{%
\printtext[bibhyperref]{\ifthenelse{\ifnameundef{labelname}}%
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
\usebibmacro{cite:labelyear+extrayear}%
% if label title starts with s.v.
\StrLeft{\strfield{labeltitle}}{14}[\maybesv]%
\IfStrEq{\maybesv}{\detokenize{\textit{s.v.}}}
{\addspace%
\usebibmacro{cite:label}}{}%
}}}}
{\usebibmacro{cite:shorthand}}}
\newbibmacro*{cite:shorthand}{%
\printtext[bibhyperref]{\printfield{shorthand}}}
\newbibmacro*{cite:ibid}{%
\printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
\ifloccit
{\global\booltrue{cbx:loccit}}
{}}
\newbibmacro*{cite:label}{%
\iffieldundef{label}
{\printfield[citetitle]{labeltitle}}
{\printfield{label}}}
\newbibmacro*{cite:labelyear+extrayear}{%
\iffieldundef{labelyear}
{}
{\printfield{labelyear}%
\printfield{extradate}}}
\newbibmacro*{cite:postnote}{%
\ifbool{cbx:loccit}
{}
{\usebibmacro{postnote}}}
\DeclareCiteCommand{\cite}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{cite:postnote}}
\DeclareCiteCommand{\parencite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{cite:postnote}}
% Leheküljenumbrid
\DeclareFieldFormat{pages}{lk #1}
% Nimega viitamisel pole kaldkirja, aga ainult kolm esimest sõna
\DeclareFieldFormat{citetitle}{\threefirstwords{#1}{\dots}}
\DeclareFieldFormat[article,book,misc,customa,online]{citetitle}{\threefirstwords{#1}{\dots}}
% Tsiteerimissulgudes enne aastat on koolon ja enne leheküljenumbrit koma
\renewcommand{\postnotedelim}{: }
\renewcommand{\finalnamedelim}{, }
% Leheküljenumbrite ette viidetes ei lisata "p. " vms
\DeclareFieldFormat{postnote}{#1}
% vim: syntax=tex
\endinput