line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::PseudoPod::Index; |
2
|
1
|
|
|
1
|
|
568
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
3
|
1
|
|
|
1
|
|
6
|
use Carp (); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
18
|
|
4
|
1
|
|
|
1
|
|
4
|
use base qw( Pod::PseudoPod ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
262
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use vars qw( $VERSION ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
535
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.19'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
7
|
|
|
7
|
1
|
2838
|
my $self = shift; |
13
|
7
|
|
|
|
|
9
|
my $index = shift; |
14
|
7
|
|
|
|
|
17
|
my $new = $self->SUPER::new(@_); |
15
|
7
|
|
50
|
|
|
39
|
$new->{'output_fh'} ||= *STDOUT{IO}; |
16
|
7
|
|
|
|
|
24
|
$new->accept_targets_as_text( qw(author blockquote comment caution |
17
|
|
|
|
|
|
|
editor epigraph example figure important note production |
18
|
|
|
|
|
|
|
programlisting screen sidebar table tip warning) ); |
19
|
|
|
|
|
|
|
|
20
|
7
|
|
|
|
|
407
|
$new->nix_Z_codes(1); |
21
|
7
|
|
100
|
|
|
17
|
$new->{'index'} = $index || {}; |
22
|
7
|
|
|
|
|
11
|
$new->{'scratch'} = ''; |
23
|
7
|
|
|
|
|
10
|
$new->{'Indent'} = 0; |
24
|
7
|
|
|
|
|
7
|
$new->{'Indentstring'} = ' '; |
25
|
7
|
|
|
|
|
55
|
return $new; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
7
|
0
|
10
|
sub start_X { $_[0]{'X'} = 1; } |
31
|
|
|
|
|
|
|
sub end_X { |
32
|
7
|
|
|
7
|
0
|
8
|
my $self = shift; |
33
|
7
|
|
|
|
|
9
|
my $text = $self->{'scratch'}; |
34
|
7
|
|
|
|
|
8
|
$self->{'scratch'} = ''; |
35
|
|
|
|
|
|
|
|
36
|
7
|
|
33
|
|
|
18
|
my $cross_ref = $self->{'index_file'} || $self->set_filename; |
37
|
7
|
|
|
|
|
19
|
&_build_index($self->{'index'},$cross_ref,split(';', $text)); |
38
|
7
|
|
|
|
|
13
|
$self->{'X'} = 0; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _build_index { |
42
|
7
|
|
|
7
|
|
11
|
my ($node,$cross_ref,@elems) = @_; |
43
|
7
|
|
|
|
|
11
|
foreach my $entry (@elems,undef) { |
44
|
15
|
100
|
|
|
|
18
|
if (defined $entry) { |
45
|
8
|
50
|
|
|
|
22
|
$node->{$entry} = {} unless (defined $node->{$entry}); |
46
|
8
|
|
|
|
|
10
|
$node = $node->{$entry}; |
47
|
|
|
|
|
|
|
} else { |
48
|
7
|
50
|
|
|
|
14
|
$node->{'page'} = [] unless (defined $node->{'page'}); |
49
|
7
|
|
|
|
|
7
|
push @{$node->{'page'}}, $cross_ref; |
|
7
|
|
|
|
|
16
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
51
|
100
|
|
51
|
0
|
100
|
sub handle_text { $_[0]{'scratch'} .= $_[1] if $_[0]{'X'}; } |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
0
|
0
|
0
|
sub get_index { return $_[0]{'index'} } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub output_text { |
59
|
5
|
|
|
5
|
0
|
82
|
my $self = shift; |
60
|
5
|
|
|
|
|
10
|
$self->_print_index($self->{'index'},''); |
61
|
5
|
|
|
|
|
7
|
print {$self->{'output_fh'}} $self->{'scratch'}; |
|
5
|
|
|
|
|
15
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# recursively print out index tree structure |
65
|
|
|
|
|
|
|
sub _print_index { |
66
|
13
|
|
|
13
|
|
18
|
my ($self,$node,$indent) = @_; |
67
|
13
|
|
|
|
|
13
|
foreach my $key (sort {lc($a) cmp lc($b)} keys %{$node}) { |
|
2
|
|
|
|
|
9
|
|
|
13
|
|
|
|
|
29
|
|
68
|
15
|
100
|
|
|
|
22
|
if ($key eq 'page') { |
69
|
7
|
|
|
|
|
8
|
$self->{'scratch'} .= ', '. join(", ", @{$node->{'page'}}); |
|
7
|
|
|
|
|
19
|
|
70
|
|
|
|
|
|
|
} else { |
71
|
8
|
|
|
|
|
11
|
$self->{'scratch'} .= "\n". $indent. $key; |
72
|
8
|
|
|
|
|
55
|
$self->_print_index($node->{$key}, $indent.' '); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub set_filename { |
78
|
7
|
|
|
7
|
0
|
7
|
my $self = shift; |
79
|
7
|
|
50
|
|
|
16
|
my $file = $self->{'source_filename'} || ''; |
80
|
7
|
|
|
|
|
7
|
$file =~ /(\w+)\.pod$/; |
81
|
7
|
|
50
|
|
|
27
|
$self->{'index_file'} = $1 || "0"; |
82
|
7
|
|
|
|
|
15
|
return $self->{'index_file'}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |