line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
# NAME : BibTeX/Bib.pm |
3
|
|
|
|
|
|
|
# CLASSES : Text::BibTeX::BibStructure, Text::BibTeX::BibEntry; |
4
|
|
|
|
|
|
|
# loads Text::BibTeX::BibSort and Text::BibTeX::BibFormat |
5
|
|
|
|
|
|
|
# for use by BibEntry |
6
|
|
|
|
|
|
|
# RELATIONS : BibStructure inherits from Structure |
7
|
|
|
|
|
|
|
# BibEntry inherits from BibSort and BibFormat, which |
8
|
|
|
|
|
|
|
# both inherit from StructuredEntry |
9
|
|
|
|
|
|
|
# DESCRIPTION: Implements the "Bib" structure, which provides the |
10
|
|
|
|
|
|
|
# same functionality -- though in a completely different |
11
|
|
|
|
|
|
|
# context, and much more customizably -- as the standard |
12
|
|
|
|
|
|
|
# style files of BibTeX 0.99. |
13
|
|
|
|
|
|
|
# CREATED : 1997/09/21, Greg Ward |
14
|
|
|
|
|
|
|
# MODIFIED : |
15
|
|
|
|
|
|
|
# VERSION : $Id$ |
16
|
|
|
|
|
|
|
# COPYRIGHT : Copyright (c) 1997-2000 by Gregory P. Ward. All rights |
17
|
|
|
|
|
|
|
# reserved. |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# This file is part of the Text::BibTeX library. This |
20
|
|
|
|
|
|
|
# library is free software; you may redistribute it and/or |
21
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
22
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Text::BibTeX::Bib - defines the "Bib" database structure |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$bibfile = Text::BibTeX::File $filename->new; |
31
|
|
|
|
|
|
|
$bibfile->set_structure ('Bib', |
32
|
|
|
|
|
|
|
# Default option values: |
33
|
|
|
|
|
|
|
sortby => 'name', |
34
|
|
|
|
|
|
|
namestyle => 'full' |
35
|
|
|
|
|
|
|
nameorder => 'first', |
36
|
|
|
|
|
|
|
atitle => 1, |
37
|
|
|
|
|
|
|
labels => 'numeric'); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Alternate option values: |
40
|
|
|
|
|
|
|
$bibfile->set_option (sortby => 'year'); |
41
|
|
|
|
|
|
|
$bibfile->set_option (namestyle => 'nopunct'); |
42
|
|
|
|
|
|
|
$bibfile->set_option (namestyle => 'nospace'); |
43
|
|
|
|
|
|
|
$bibfile->set_option (nameorder => 'last'); |
44
|
|
|
|
|
|
|
$bibfile->set_option (atitle => 0); |
45
|
|
|
|
|
|
|
$bibfile->set_option (labels => 'alpha'); # not implemented yet! |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# parse entry from $bibfile and automatically make it a BibEntry |
48
|
|
|
|
|
|
|
$entry = Text::BibTeX::Entry->new($bibfile); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# or get an entry from somewhere else which is hard-coded to be |
51
|
|
|
|
|
|
|
# a BibEntry |
52
|
|
|
|
|
|
|
$entry = Text::BibTeX::BibEntry->new(...); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$sortkey = $entry->sort_key; |
55
|
|
|
|
|
|
|
@blocks = $entry->format; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
(B Do not believe everything you read in this document. The |
60
|
|
|
|
|
|
|
classes described here are unfinished and only lightly tested. The |
61
|
|
|
|
|
|
|
current implementation is a proof-of-principle, to convince myself (and |
62
|
|
|
|
|
|
|
anyone who might be interested) that it really is possible to |
63
|
|
|
|
|
|
|
reimplement BibTeX 0.99 in Perl using the core C classes; |
64
|
|
|
|
|
|
|
this principle is vaguely demonstrated by the current C modules, |
65
|
|
|
|
|
|
|
but not really proved. Many important features needed to reimplement |
66
|
|
|
|
|
|
|
the standard styles of BibTeX 0.99 are missing, even though this |
67
|
|
|
|
|
|
|
document may brashly assert otherwise. If you are interested in using |
68
|
|
|
|
|
|
|
these classes, you should start by reading and grokking the code, and |
69
|
|
|
|
|
|
|
contributing the missing bits and pieces that you need.) |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
C implements the database structure for |
72
|
|
|
|
|
|
|
bibliographies as defined by the standard styles of BibTeX 0.99. It |
73
|
|
|
|
|
|
|
does this by providing two classes, C and C (the |
74
|
|
|
|
|
|
|
leading C is implied, and will be omitted for the rest of |
75
|
|
|
|
|
|
|
this document). These two classes, being specific to bibliographic |
76
|
|
|
|
|
|
|
data, are outside of the core C class hierarchy, but are |
77
|
|
|
|
|
|
|
distributed along with it as they provide a canonical example of a |
78
|
|
|
|
|
|
|
specific database structure using classes derived from the core |
79
|
|
|
|
|
|
|
hierarchy. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
C, which derives from the C class, deals with |
82
|
|
|
|
|
|
|
the structure as a whole: it handles structure options and describes all |
83
|
|
|
|
|
|
|
the types and fields that make up the database structure. If you're |
84
|
|
|
|
|
|
|
interested in writing your own database structure modules, the standard |
85
|
|
|
|
|
|
|
interface for both of these is described in L; |
86
|
|
|
|
|
|
|
if you're just interested in finding out the exact database structure or |
87
|
|
|
|
|
|
|
the options supported by the C structure, you've come to the right |
88
|
|
|
|
|
|
|
place. (However, you may have to wade through a bit of excess verbiage |
89
|
|
|
|
|
|
|
due to this module's dual purpose: first, to reimplement the standard |
90
|
|
|
|
|
|
|
styles of BibTeX 0.99, and second, to provide an example for other |
91
|
|
|
|
|
|
|
programmers wishing to implement new or derived database structure |
92
|
|
|
|
|
|
|
modules.) |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
C derives from the C class and provides |
95
|
|
|
|
|
|
|
methods that operate on individual entries presumed to come from a |
96
|
|
|
|
|
|
|
database conforming to the structure defined by the C |
97
|
|
|
|
|
|
|
class. (Actually, to be completely accurate, C inherits from |
98
|
|
|
|
|
|
|
two intermediate classes, C and C. These two |
99
|
|
|
|
|
|
|
classes just exist to reduce the amount of code in the C module, |
100
|
|
|
|
|
|
|
and thanks to the magic of inheritance, their existence is usually |
101
|
|
|
|
|
|
|
irrelevant. But you might want to consult those two classes if you're |
102
|
|
|
|
|
|
|
interested in the gory details of sorting and formatting entries from |
103
|
|
|
|
|
|
|
BibTeX 0.99-style bibliography databases.) |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# first, the "structure class" (inherits from Text::BibTeX::Structure) |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
package Text::BibTeX::BibStructure; |
111
|
1
|
|
|
1
|
|
1338
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
112
|
1
|
|
|
1
|
|
6
|
use vars qw(@ISA $VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
539
|
|
113
|
|
|
|
|
|
|
@ISA = qw(Text::BibTeX::Structure); |
114
|
|
|
|
|
|
|
$VERSION = '0.88'; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 STRUCTURE OPTIONS |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
C handles several user-supplied "structure options" and |
119
|
|
|
|
|
|
|
methods for dealing with them. The options currently supported by the |
120
|
|
|
|
|
|
|
C database structure, and the values allowed for them, are: |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over 4 |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item C |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
How to sort entries. Valid values: C (sort on author names, year, |
127
|
|
|
|
|
|
|
and title), C (sort on year, author names, and title). Sorting on |
128
|
|
|
|
|
|
|
"author names" is a bit more complicated than just using the C |
129
|
|
|
|
|
|
|
field; see L for details. Default value: C. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item C |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
How to print author (and editor) names: C for unabbreviated first |
134
|
|
|
|
|
|
|
names, C for first names abbreviated with periods, C |
135
|
|
|
|
|
|
|
for first names abbreviated with space but no periods, and C to |
136
|
|
|
|
|
|
|
abbreviate without space or periods. Default value: C. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item C |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The order in which to print names: C for "first von last jr" |
141
|
|
|
|
|
|
|
order, and C for "von last jr first" order. Default value: |
142
|
|
|
|
|
|
|
C. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item C |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
A boolean option: if true, non-book titles will be changed to "sentence |
147
|
|
|
|
|
|
|
capitalization:" words following colons and sentence-ending punctuation |
148
|
|
|
|
|
|
|
will be capitalized, and everything else at brace-depth zero will be |
149
|
|
|
|
|
|
|
changed to lowercase. Default value: true. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item C |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
The type of bibliographic labels to generate: C or C. |
154
|
|
|
|
|
|
|
(Alphabetic labels are not yet implemented, so this option is currently |
155
|
|
|
|
|
|
|
ignored.) Default value: C. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=back |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Also, several "markup options" are supported. Markup options are |
160
|
|
|
|
|
|
|
distinct because they don't change how text is extracted from the |
161
|
|
|
|
|
|
|
database entries and subsequently mangled; rather, they supply bits of |
162
|
|
|
|
|
|
|
markup that go around the database-derived text. Markup options are |
163
|
|
|
|
|
|
|
always two-element lists: the first to "turn on" some feature of the |
164
|
|
|
|
|
|
|
markup language, and the second to turn it off. For example, if your |
165
|
|
|
|
|
|
|
target language is LaTeX2e and you want journal names emphasized, you |
166
|
|
|
|
|
|
|
would supply a list reference C<['\emph{','}']> for the C |
167
|
|
|
|
|
|
|
option. If you were instead generating HTML, you might supply |
168
|
|
|
|
|
|
|
C<['EemphE','E/emphE']>. To keep the structure module |
169
|
|
|
|
|
|
|
general with respect to markup languages, all markup options are empty |
170
|
|
|
|
|
|
|
by default. (Or, rather, they are all references to lists consisting of |
171
|
|
|
|
|
|
|
two empty strings.) |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=over 4 |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item C |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Markup to add around the list of author names. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item C |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Markup to add around non-book (article) titles. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item C |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Markup to add around book titles. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item C |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Markup to add around journal names. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=back |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=cut |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
my %default_options = |
196
|
|
|
|
|
|
|
(sortby => 'name', # or 'year', 'none' |
197
|
|
|
|
|
|
|
namestyle => 'full', # or 'abbrev', 'nopunct', 'nospace' |
198
|
|
|
|
|
|
|
nameorder => 'first', # or 'last' |
199
|
|
|
|
|
|
|
atitle_lower=> 1, # mangle case of non-book titles? |
200
|
|
|
|
|
|
|
labels => 'numeric', # or 'alpha' (not yet supported!) |
201
|
|
|
|
|
|
|
name_mkup => ['', ''], |
202
|
|
|
|
|
|
|
atitle_mkup => ['', ''], |
203
|
|
|
|
|
|
|
btitle_mkup => ['', ''], |
204
|
|
|
|
|
|
|
journal_mkup=> ['', ''], |
205
|
|
|
|
|
|
|
); |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 Option methods |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
As required by the C module, |
211
|
|
|
|
|
|
|
C provides two methods for handling options: |
212
|
|
|
|
|
|
|
C and C. (The other two option methods, |
213
|
|
|
|
|
|
|
C and C, are just inherited from |
214
|
|
|
|
|
|
|
C.) |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=over 4 |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item known_option (OPTION) |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Returns true if OPTION is one of the options on the above list. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item default_option (OPTION) |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Returns the default value of OPTION, or Cs if OPTION is not a |
225
|
|
|
|
|
|
|
supported option. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=back |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=cut |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub known_option |
232
|
|
|
|
|
|
|
{ |
233
|
10
|
|
|
10
|
|
19
|
my ($self, $option) = @_; |
234
|
10
|
|
|
|
|
31
|
return exists $default_options{$option}; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
sub default_option |
239
|
|
|
|
|
|
|
{ |
240
|
36
|
|
|
36
|
|
63
|
my ($self, $option) = @_; |
241
|
|
|
|
|
|
|
return exists $default_options{$option} |
242
|
36
|
50
|
|
|
|
93
|
? $default_options{$option} |
243
|
|
|
|
|
|
|
: $self->SUPER::default_option ($option); |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
# The field lists in the following documentation are automatically |
248
|
|
|
|
|
|
|
# generated by my `doc_structure' program -- I run it and read the |
249
|
|
|
|
|
|
|
# output into this file. Wouldn't it be cool if the module could just |
250
|
|
|
|
|
|
|
# document itself? Ah well, dreaming again... |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head1 DATABASE STRUCTURE |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
The other purpose of a structure class is to provide a method, |
255
|
|
|
|
|
|
|
C, that lists the allowed entry types and the known |
256
|
|
|
|
|
|
|
fields for the structure. Programmers wishing to write their own |
257
|
|
|
|
|
|
|
database structure module should consult L for |
258
|
|
|
|
|
|
|
the conventions and requirements of this method; the purpose of the |
259
|
|
|
|
|
|
|
present document is to describe the C database structure. |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
The allowed entry types, and the fields recognized for them, are: |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=over 4 |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=item C |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
Required fields: C, C, C, C. |
268
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C. |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=item C |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Required fields: C, C, C. |
273
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C. |
274
|
|
|
|
|
|
|
Constrained fields: exactly one of C, C; at most one of C, C. |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=item C |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Required fields: C. |
279
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C, C. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=item C |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Required fields: C, C. |
284
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C, C. |
285
|
|
|
|
|
|
|
Constrained fields: exactly one of C, C; at least one of C, C; at most one of C, C. |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=item C |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
Required fields: C, C, C, C, C. |
290
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C, C, C, C, C. |
291
|
|
|
|
|
|
|
Constrained fields: at most one of C, C. |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=item C |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=item C |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
Required fields: C, C, C, C. |
298
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C, C, C, C. |
299
|
|
|
|
|
|
|
Constrained fields: at most one of C, C. |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=item C |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Required fields: C. |
304
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C, C, C. |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=item C |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
Required fields: C, C, C, C. |
309
|
|
|
|
|
|
|
Optional fields: C, C, C, C. |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=item C |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
Required fields: none. |
314
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C, C. |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=item C |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Required fields: C, C, C, C. |
319
|
|
|
|
|
|
|
Optional fields: C, C, C, C. |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=item C |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
Required fields: C, C. |
324
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C, C, C. |
325
|
|
|
|
|
|
|
Constrained fields: at most one of C, C. |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=item C |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
Required fields: C, C, C, C. |
330
|
|
|
|
|
|
|
Optional fields: C, C, C, C, C. |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=item C |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
Required fields: C, C, C. |
335
|
|
|
|
|
|
|
Optional fields: C, C. |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=back |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=cut |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
sub describe_entry |
342
|
|
|
|
|
|
|
{ |
343
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
# Advantages of the current scheme (set all fields for a particular |
346
|
|
|
|
|
|
|
# entry type together): |
347
|
|
|
|
|
|
|
# - groups fields more naturally (by entry type) |
348
|
|
|
|
|
|
|
# - might lend itself to structuring things by 'type' in the object |
349
|
|
|
|
|
|
|
# as well, making it easier to determine if a type is valid |
350
|
|
|
|
|
|
|
# - prevents accidentally giving a type optional fields but no |
351
|
|
|
|
|
|
|
# required fields -- currently this mistake would make the type |
352
|
|
|
|
|
|
|
# 'unknown' |
353
|
|
|
|
|
|
|
# |
354
|
|
|
|
|
|
|
# Requirement of any scheme: |
355
|
|
|
|
|
|
|
# - must be easy for derived classes to override/augment the field |
356
|
|
|
|
|
|
|
# lists defined here! (ie. they should be able just to inherit |
357
|
|
|
|
|
|
|
# describe_entry; or explicitly call SUPER::describe_entry and then |
358
|
|
|
|
|
|
|
# undo/change some of its definitions |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
# Things that I don't think are handled by this scheme, but that |
361
|
|
|
|
|
|
|
# bibtex does look out for: |
362
|
|
|
|
|
|
|
# * warns if month but no year |
363
|
|
|
|
|
|
|
# * crossref stuff: |
364
|
|
|
|
|
|
|
# - article can xref article; xref'd entry must have key or journal |
365
|
|
|
|
|
|
|
# - book or inboox can xref book; xref'd entry must have editor, |
366
|
|
|
|
|
|
|
# key, or series |
367
|
|
|
|
|
|
|
# - incollection can xref a book and inproceedings can xref a |
368
|
|
|
|
|
|
|
# proceedings; xref'd entry must have editor, key, or booktitle |
369
|
|
|
|
|
|
|
|
370
|
1
|
|
|
|
|
9
|
$self->set_fields ('article', |
371
|
|
|
|
|
|
|
[qw(author title journal year)], |
372
|
|
|
|
|
|
|
[qw(volume number pages month note)]); |
373
|
1
|
|
|
|
|
11
|
$self->set_fields ('book', |
374
|
|
|
|
|
|
|
[qw(title publisher year)], |
375
|
|
|
|
|
|
|
[qw(series address edition month note)], |
376
|
|
|
|
|
|
|
[1, 1, [qw(author editor)]], |
377
|
|
|
|
|
|
|
[0, 1, [qw(volume number)]]); |
378
|
1
|
|
|
|
|
6
|
$self->set_fields ('booklet', |
379
|
|
|
|
|
|
|
[qw(title)], |
380
|
|
|
|
|
|
|
[qw(author howpublished address month year note)]); |
381
|
1
|
|
|
|
|
19
|
$self->set_fields ('inbook', |
382
|
|
|
|
|
|
|
[qw(publisher year)], |
383
|
|
|
|
|
|
|
[qw(series type address edition month note)], |
384
|
|
|
|
|
|
|
[1, 1, [qw(author editor)]], |
385
|
|
|
|
|
|
|
[1, 2, [qw(chapter pages)]], |
386
|
|
|
|
|
|
|
[0, 1, [qw(volume number)]]); |
387
|
1
|
|
|
|
|
7
|
$self->set_fields ('incollection', |
388
|
|
|
|
|
|
|
[qw(author title booktitle publisher year)], |
389
|
|
|
|
|
|
|
[qw(editor series type chapter pages address |
390
|
|
|
|
|
|
|
edition month note)], |
391
|
|
|
|
|
|
|
[0, 1, [qw(volume number)]]); |
392
|
1
|
|
|
|
|
7
|
$self->set_fields ('inproceedings', |
393
|
|
|
|
|
|
|
[qw(author title booktitle year)], |
394
|
|
|
|
|
|
|
[qw(editor series pages address month |
395
|
|
|
|
|
|
|
organization publisher note)], |
396
|
|
|
|
|
|
|
[0, 1, [qw(volume number)]]); |
397
|
1
|
|
|
|
|
7
|
$self->set_fields ('conference', |
398
|
|
|
|
|
|
|
[qw(author title booktitle year)], |
399
|
|
|
|
|
|
|
[qw(editor series pages address month |
400
|
|
|
|
|
|
|
organization publisher note)], |
401
|
|
|
|
|
|
|
[0, 1, [qw(volume number)]]); |
402
|
1
|
|
|
|
|
6
|
$self->set_fields ('manual', |
403
|
|
|
|
|
|
|
[qw(title)], |
404
|
|
|
|
|
|
|
[qw(author organization address edition |
405
|
|
|
|
|
|
|
month year note)]); |
406
|
1
|
|
|
|
|
7
|
$self->set_fields ('mastersthesis', |
407
|
|
|
|
|
|
|
[qw(author title school year)], |
408
|
|
|
|
|
|
|
[qw(type address month note)]); |
409
|
1
|
|
|
|
|
6
|
$self->set_fields ('misc', |
410
|
|
|
|
|
|
|
[], |
411
|
|
|
|
|
|
|
[qw(author title howpublished month year note)]); |
412
|
1
|
|
|
|
|
6
|
$self->set_fields ('phdthesis', |
413
|
|
|
|
|
|
|
[qw(author title school year)], |
414
|
|
|
|
|
|
|
[qw(type address month note)]); |
415
|
1
|
|
|
|
|
7
|
$self->set_fields ('proceedings', |
416
|
|
|
|
|
|
|
[qw(title year)], |
417
|
|
|
|
|
|
|
[qw(editor series address month |
418
|
|
|
|
|
|
|
organization publisher note)], |
419
|
|
|
|
|
|
|
[0, 1, [qw(volume number)]]); |
420
|
1
|
|
|
|
|
15
|
$self->set_fields ('techreport', |
421
|
|
|
|
|
|
|
[qw(author title institution year)], |
422
|
|
|
|
|
|
|
[qw(type number address month note)]); |
423
|
1
|
|
|
|
|
6
|
$self->set_fields ('unpublished', |
424
|
|
|
|
|
|
|
[qw(author title note)], |
425
|
|
|
|
|
|
|
[qw(month year)]); |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
} # describe_entry |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=head1 STRUCTURED ENTRY CLASS |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
The second class provided by the C module is |
433
|
|
|
|
|
|
|
C (again, a leading C is implied). This being a |
434
|
|
|
|
|
|
|
structured entry class, it derives from C. The |
435
|
|
|
|
|
|
|
conventions and requirements for such a class are documented in |
436
|
|
|
|
|
|
|
L for the benefit of programmers implementing |
437
|
|
|
|
|
|
|
their own structure modules. |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
If you wish to write utilities making use of the C database |
440
|
|
|
|
|
|
|
structure, then you should call one of the "officially supported" |
441
|
|
|
|
|
|
|
methods provided by the C class. Currently, there are only |
442
|
|
|
|
|
|
|
two of these: C and C. These are actually implemented |
443
|
|
|
|
|
|
|
in the C and C classes, respectively, which are base |
444
|
|
|
|
|
|
|
classes of C. Thus, see L and |
445
|
|
|
|
|
|
|
L for details on these two methods. |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=cut |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
package Text::BibTeX::BibEntry; |
450
|
1
|
|
|
1
|
|
9
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
451
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA $VERSION); |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
62
|
|
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
$VERSION = '0.88'; |
454
|
|
|
|
|
|
|
|
455
|
1
|
|
|
1
|
|
463
|
use Text::BibTeX::BibSort; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
456
|
1
|
|
|
1
|
|
456
|
use Text::BibTeX::BibFormat; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
53
|
|
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
@ISA = qw(Text::BibTeX::BibSort Text::BibTeX::BibFormat); |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
1; |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=head1 SEE ALSO |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
L, L, |
466
|
|
|
|
|
|
|
L. |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
=head1 AUTHOR |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
Greg Ward |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=head1 COPYRIGHT |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
Copyright (c) 1997-2000 by Gregory P. Ward. All rights reserved. This file |
475
|
|
|
|
|
|
|
is part of the Text::BibTeX library. This library is free software; you |
476
|
|
|
|
|
|
|
may redistribute it and/or modify it under the same terms as Perl itself. |