summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/base/bib-simple.opm
blob: f152d87acda7a68e9fcd459c45cb1132051b42af (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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
%% This is part of OpTeX project, see http://petr.olsak.net/optex

% bibliography style (simple), version <2020-03-10>, loaded on demand by \usebib

\_ifx\_optexbibstyle\_undefined \_errmessage
   {This file can be read by: \_string\usebib/? (simple) bibfiles command only}
   \_endinput \_fi

% misc:

\_def\_maybedot{\_ifnum\_spacefactor=\_sfcode`\.\_relax\_else.\_fi}
\_tmpnum=\_sfcode`\. \_advance\_tmpnum by-2 \_sfcode`\.=\_tmpnum 
\_sfcode`\?=\_tmpnum \_sfcode`\!=\_tmpnum
\_let\.=\_maybedot  % prevents from double periods

% Formatting of Author/Editor lists:

\_def\_authorname{%
  \_ifnum\_NameCount>1
     \_ifnum0\_namecount=\_NameCount \_mtext{bib.and}\_else , \_fi
  \_else
     \_ifx\_dobibmark\_undefined \_edef\_dobibmark{\_Lastname}\_fi
  \_fi
  \_bprintc\_Firstname{* }\_bprintc\_Von{* }\_Lastname\_bprintc\_Junior{, *}%
}
\_let\_editorname=\_authorname

% Preparing bib-mark (used when \nonumcitations is set):

\_def\_setbibmark{%  
   \_ifx\_dobibmark\_undefined \_def\_dobibmark{}\_fi
   \_RetrieveFieldIn{bibmark}\_tmp      
   \_ifx\_tmp\_empty \_RetrieveFieldIn{year}\_tmp \_edef\_tmp{\_dobibmark, \_tmp}\_fi                
   \_bibmark=\_ea{\_tmp}%
}

% Multilinguals:      English     Czech     Slovak

\_mtdef{bib.and}       {, and }    { a }     {}
\_mtdef{bib.edition}   {edition}   {vydání}  {vydanie}
\_mtdef{bib.masterthesis} {Master's Thesis}   {Diplomová práce}   {Diplomová práca}
\_mtdef{bib.phdthesis} {Ph.D. Thesis}   {Disertační práce}  {Dizertačná práca}


\_def\_preurl{\_hfil\_break} 

% Non-standard fieldnames:

\_CreateField {isbn}
\_CreateField {doi}
\_CreateField {url}
\_CreateField {bibmark}

% Sorting:

\_SortingOrder{name,year}{lfvj}
\_SpecialSort {key}

% Entry types:

\_sdef{_print:END}{%
   \_bprinta [note]       {*.}{}%
   \_setbibmark
}  
\_sdef{_print:book}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1}.\ }{\_bibwarning}%
   \_bprinta [edition]    {*~\_mtext{bib.edition}.\ }{}%
   \_bprinta [address]    {*: }{\_bibwarning}%
   \_bprinta [publisher]  {*, }{\_bibwarning}%
   \_bprinta [year]       {*.\ }{\_bibwarning}%
   \_bprinta [isbn]       {ISBN~*.\ }{\_bibwarning}%
   \_bprintb [url]        {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:article}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprinta [title]      {*.\ }{\_bibwarning}%
   \_bprintb [journal]    {{\_em##1}.\ }{\_bibwarning}%
   \_bprinta [year]       {*, }{}%
   \_bprinta [volume]     {* }{}%
   \_bprinta [number]     {(*), }{}%
   \_bprinta [pages]      {*.\ }{}%
   \_bprintb [doi]        {DOI~\_ulink[http://dx.doi.org/##1]{##1}.\ }{}%
}
\_sdef{_print:inbook}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1.}\ }{\_bibwarning}%
                         In:~%
   \_bprinta [!editor]    {*,~eds.\ }{}%
   \_bprintb [booktitle]  {{\_em##1}.\ }{\_bibwarning}% 
   \_bprinta [address]    {*: }{\_bibwarning}%
   \_bprinta [publisher]  {*, }{\_bibwarning}%
   \_bprinta [year]       {*.\ }{\_bibwarning}%
   \_bprinta [chapter]    {*.\ }{%
                         \_bprinta [pages]      {*.\ }{}}%
   \_bprinta [isbn]       {ISBN~*.\ }{\_bibwarning}%
   \_bprintb [url]        {\_preurl\_url{##1}. }{}%
}
\_slet{_print:inproceedings}{_print:inbook}

\_sdef{_print:incolection}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1}.\ }{\_bibwarning}%
   \_bprinta [crossreff]  {In~\_cite[*]. }{%
                         \_bprinta [booktitle]  {*. }{\_bibwarning}%
                         \_bprinta [!editor]    {*,~eds.\ }{\_bibwarning}%
                         \_bprinta [edition]    {*~\_mtext{bib.edition}.\ }{\_bibwarning}%
                         \_bprinta [address]    {*: }{\_bibwarning}%
                         \_bprinta [publisher]  {*, }{\_bibwarning}%
                         \_bprinta [year]       {*.\ }{\_bibwarning}%
                         \_bprinta [pages]      {*.\ }{}%   
                         \_bprintb [url]        {\_preurl\_url{####1}. }{}}%
}
\_sdef{_print:conference}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1}\.\ }{\_bibwarning}%
   \_bprinta [edition]    {*~\_mtext{bib.edition}.\ }{}%
   \_bprinta [address]    {*: }{\_bibwarning}%
   \_bprinta [publisher]  {*, }{\_bibwarning}%
   \_bprinta [year]       {*.\ }{\_bibwarning}%
   \_bprinta [isbn]       {ISBN~*.\ }{}%
   \_bprintb [url]        {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:phdthesis}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1}\.\ }{\_bibwarning}%
                         \_mtext{bib.phdthesis}, %
   \_bprinta [school]     {*.\ }{}%
   \_bprinta [address]    {*, }{}%
   \_bprinta [year]       {*.\ }{}%
   \_bprintb [url]        {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:mastersthesis}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1}\.\ }{\_bibwarning}%
                         \_mtext{bib.masterthesis}, %
   \_bprinta [school]     {*.\ }{}%
   \_bprinta [address]    {*, }{}%
   \_bprinta [year]       {*.\ }{}%
   \_bprintb [url]        {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:proceedings}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1}\.\ }{\_bibwarning}%
   \_bprinta [publisher]  {*.\ }{%
                         \_bprinta [organization] {*.\ }{\_bibwarning}}%
}   
\_sdef{_print:techreport}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1}\.\ }{\_bibwarning}%
                         \_mtext{bib.techreport}.
   \_bprinta [institution] {*.\ }{}%
}
\_sdef{_print:booklet}{%
   \_bprinta [!author]    {*\.\ }{\_bibwarning}%
   \_bprintb [title]      {{\_em##1}\.\ }{\_bibwarning}%
   \_bprinta [howpublished] {*.\ }{\_bibwarning}%
}
\_sdef{_print:manual}{%
   \_bprinta [!author]    {*\.\ }{}%
   \_bprintb [title]      {{\_em##1}\.\ }{\_bibwarning}%
   \_bprinta [year]       {*.\ }{}%
   \_bprinta [institution] {*.\ }{}%
   \_bprintb [url]        {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:misc}{%
   \_bprinta [!author]    {*\.\ }{}%
   \_bprintb [title]      {{\_em##1}\.\ }{}%
   \_bprinta [howpublished] {*.\ }{}%
   \_bprinta [institution] {*.\ }{}%
   \_bprinta [series]     {*.\ }{}%
   \_bprinta [year]       {*.\ }{}%
   \_bprintb [url]        {\_preurl\_url{##1}. }{}%
}

%%% end of the style file

\_endcode

You can copy this file to bib-yourname.opm and modify it by your
needs...