summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/bib-simple.opm
blob: 642c6d84825489222b64e2fa419064f41e95c019 (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
182
183
% opmac-bib-simple ... the OPmac bib style for reading .bib databases
% Petr Olsak, version Apr. 2015 (beta)
% See the end of the file opmac-bib.tex for more information.
% You can compare this file with the old Forth-like BibTeX .bst files. 
% What seems to be more understandable?

\ifx\opmacbibstyle\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

% Formating 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=\expandafter{\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

\endinput

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