line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# --*-Perl-*-- |
2
|
|
|
|
|
|
|
# $Id: ReferenceStyle.pm 11 2004-11-22 23:56:20Z tandler $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package PBib::ReferenceStyle; |
6
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
7
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
8
|
|
|
|
|
|
|
#use English; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# for debug: |
11
|
|
|
|
|
|
|
#use Data::Dumper; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
BEGIN { |
14
|
1
|
|
|
1
|
|
6
|
use vars qw($Revision $VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
102
|
|
15
|
1
|
50
|
|
1
|
|
2
|
my $major = 1; q$Revision: 11 $ =~ /: (\d+)/; my ($minor) = ($1); $VERSION = "$major." . ($minor<10 ? '0' : '') . $minor;
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
23
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# superclass |
19
|
1
|
|
|
1
|
|
1285
|
use PBib::Style; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
58
|
|
20
|
1
|
|
|
1
|
|
18
|
use base qw(PBib::Style); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
763
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# used modules |
23
|
|
|
|
|
|
|
#use ZZZZ; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# module variables |
26
|
|
|
|
|
|
|
#use vars qw(mmmm); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
# access methods |
32
|
|
|
|
|
|
|
# |
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
|
35
|
506
|
|
|
506
|
0
|
512
|
sub options { my $self = shift; return $self->converter()->refOptions(); } |
|
506
|
|
|
|
|
1025
|
|
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
0
|
0
|
0
|
sub referenceSeparator { my ($self) = @_; |
38
|
|
|
|
|
|
|
# if defined, use this char to separate references within one field |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
# |
44
|
|
|
|
|
|
|
# methods |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub text { |
49
|
|
|
|
|
|
|
# |
50
|
|
|
|
|
|
|
# return the replacement text |
51
|
|
|
|
|
|
|
# the refField is unquoted (i.e. the standard char set), |
52
|
|
|
|
|
|
|
# |
53
|
116
|
|
|
116
|
0
|
144
|
my ($self, $refField) = @_; |
54
|
116
|
|
|
|
|
104
|
my $options; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# check for options ... |
57
|
116
|
100
|
|
|
|
267
|
if( $refField =~ s/^\s*:\s*([^\|\[\]]*)\s*\|\s*// ) { |
58
|
8
|
|
|
|
|
40
|
$options = $self->parseFieldOptions($1); |
59
|
8
|
|
|
|
|
19
|
$self->{'fieldOptions'} = $options; |
60
|
|
|
|
|
|
|
# print "-- field options: $options\n"; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# print STDERR "\tfield [$refField]\n"; |
64
|
116
|
|
|
|
|
212
|
$refField = $self->formatField($refField, $options); |
65
|
|
|
|
|
|
|
# print STDERR "\t--> $refField\n"; |
66
|
116
|
|
|
|
|
301
|
return $refField; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub formatField { |
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
# return the replacement text for the field |
72
|
|
|
|
|
|
|
# can be overwritten by subclasses |
73
|
|
|
|
|
|
|
# to implement more sophisticated styles |
74
|
|
|
|
|
|
|
# default is the nice style with brackets [...] |
75
|
|
|
|
|
|
|
# |
76
|
116
|
|
|
116
|
0
|
134
|
my ($self, $refField, $options) = @_; |
77
|
116
|
|
|
|
|
282
|
$refField = $self->labelStyle()->formatSeparators($refField, $options); |
78
|
116
|
|
|
|
|
256
|
my $refPattern = $self->converter()->refPattern(); |
79
|
|
|
|
|
|
|
# print "ref pattern: $refPattern\n"; |
80
|
116
|
|
|
|
|
2886
|
$refField =~ s/\[($refPattern)\]/ |
81
|
141
|
|
|
|
|
532
|
$self->{'refID'} = $1, |
82
|
|
|
|
|
|
|
$self->formatReference($1, $options) /ge; |
83
|
116
|
|
|
|
|
370
|
$refField = $self->labelStyle()->formatField($refField, $options); |
84
|
116
|
|
|
|
|
340
|
return $refField; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub formatReference { |
88
|
|
|
|
|
|
|
# |
89
|
|
|
|
|
|
|
# return the replacement text for one reference |
90
|
|
|
|
|
|
|
# can be overwritten by subclasses |
91
|
|
|
|
|
|
|
# to implement more sophisticated styles |
92
|
|
|
|
|
|
|
# nevertheless, it should call formatLabel to get a label |
93
|
|
|
|
|
|
|
# |
94
|
0
|
|
|
0
|
0
|
0
|
my ($self, $refID, $options) = @_; |
95
|
0
|
|
|
|
|
0
|
return $self->formatLabel($refID, $options); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub formatLabel { |
99
|
141
|
|
|
141
|
0
|
188
|
my ($self, $refID, $options) = @_; |
100
|
141
|
|
|
|
|
302
|
return $self->labelStyle()->text($refID, $options); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub bookmarkID { |
104
|
|
|
|
|
|
|
# return an ID that can be used as bookmark or undef |
105
|
0
|
|
|
0
|
0
|
|
my ($self, $id) = @_; |
106
|
0
|
|
|
|
|
|
return undef; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# |
113
|
|
|
|
|
|
|
# $Log: ReferenceStyle.pm,v $ |
114
|
|
|
|
|
|
|
# Revision 1.5 2002/08/08 08:21:38 Diss |
115
|
|
|
|
|
|
|
# - parsing of options moved to PBib::Style |
116
|
|
|
|
|
|
|
# |
117
|
|
|
|
|
|
|
# Revision 1.4 2002/03/27 10:23:15 Diss |
118
|
|
|
|
|
|
|
# small fixes ... |
119
|
|
|
|
|
|
|
# |
120
|
|
|
|
|
|
|
# Revision 1.3 2002/03/27 10:00:51 Diss |
121
|
|
|
|
|
|
|
# new module structure, not yet included in LitRefs/LitUI (R2) |
122
|
|
|
|
|
|
|
# |
123
|
|
|
|
|
|
|
# Revision 1.2 2002/03/22 17:31:01 Diss |
124
|
|
|
|
|
|
|
# small changes |
125
|
|
|
|
|
|
|
# |
126
|
|
|
|
|
|
|
# Revision 1.1 2002/03/18 11:15:50 Diss |
127
|
|
|
|
|
|
|
# major additions: replace [] refs, generate bibliography using [{}], ... |
128
|
|
|
|
|
|
|
# |