line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EPublisher::Target::Plugin::OTRSDoc; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Create HTML version of OTRS documentation |
4
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
1391789
|
use strict; |
|
8
|
|
|
|
|
67
|
|
|
8
|
|
|
|
|
268
|
|
6
|
8
|
|
|
8
|
|
58
|
use warnings; |
|
8
|
|
|
|
|
29
|
|
|
8
|
|
|
|
|
288
|
|
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
40
|
use File::Basename; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
544
|
|
9
|
8
|
|
|
8
|
|
66
|
use File::Path qw(make_path); |
|
8
|
|
|
|
|
32
|
|
|
8
|
|
|
|
|
526
|
|
10
|
8
|
|
|
8
|
|
6286
|
use HTML::Template::Compiled; |
|
8
|
|
|
|
|
443443
|
|
|
8
|
|
|
|
|
56
|
|
11
|
8
|
|
|
8
|
|
4068
|
use Pod::Simple::XHTML; |
|
8
|
|
|
|
|
280623
|
|
|
8
|
|
|
|
|
308
|
|
12
|
|
|
|
|
|
|
|
13
|
8
|
|
|
8
|
|
3731
|
use EPublisher; |
|
8
|
|
|
|
|
70680
|
|
|
8
|
|
|
|
|
281
|
|
14
|
8
|
|
|
8
|
|
3327
|
use EPublisher::Target::Base; |
|
8
|
|
|
|
|
2221
|
|
|
8
|
|
|
|
|
250
|
|
15
|
8
|
|
|
8
|
|
894
|
use parent qw(EPublisher::Target::Base); |
|
8
|
|
|
|
|
590
|
|
|
8
|
|
|
|
|
64
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = 1.01; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub deploy { |
20
|
6
|
|
|
6
|
1
|
16638
|
my ($self, $sources) = @_; |
21
|
|
|
|
|
|
|
|
22
|
6
|
100
|
|
|
|
14
|
my @pods = @{ $sources || [] }; |
|
6
|
|
|
|
|
49
|
|
23
|
6
|
100
|
|
|
|
22
|
if ( !@pods ) { |
24
|
5
|
100
|
|
|
|
22
|
@pods = @{ $self->_config->{source} || [] }; |
|
5
|
|
|
|
|
19
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
6
|
100
|
|
|
|
89
|
return if !@pods; |
28
|
|
|
|
|
|
|
|
29
|
5
|
|
100
|
|
|
20
|
my $encoding = $self->_config->{encoding} || 'utf-8'; |
30
|
5
|
|
100
|
|
|
63
|
my $base_url = $self->_config->{base_url} || ''; |
31
|
5
|
|
|
|
|
46
|
my $version = 0; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my @TOC = map{ |
34
|
5
|
|
|
|
|
15
|
(my $name = $_->{title}) =~ s/::/_/g; |
|
5
|
|
|
|
|
21
|
|
35
|
5
|
|
|
|
|
46
|
{ target => join( '/', $base_url, lc( $name ) . '.html'), name => $_->{title} }; |
36
|
|
|
|
|
|
|
} @pods; |
37
|
|
|
|
|
|
|
|
38
|
5
|
|
|
|
|
18
|
my $output = $self->_config->{output}; |
39
|
5
|
100
|
100
|
|
|
298
|
make_path $output if $output && !-d $output; |
40
|
|
|
|
|
|
|
|
41
|
5
|
|
|
|
|
19
|
for my $pod ( @pods ) { |
42
|
5
|
|
|
|
|
55
|
my $parser = Pod::Simple::XHTML->new; |
43
|
5
|
|
|
|
|
870
|
$parser->index(0); |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
43
|
(my $name = $pod->{title}) =~ s/::/_/g; |
46
|
|
|
|
|
|
|
|
47
|
5
|
|
|
|
|
40
|
$parser->output_string( \my $xhtml ); |
48
|
5
|
|
|
|
|
5156
|
$parser->parse_string_document( $pod->{pod} ); |
49
|
|
|
|
|
|
|
|
50
|
5
|
|
|
|
|
1855
|
my $template = $self->_config->{template}; |
51
|
|
|
|
|
|
|
my %opts = $template ? |
52
|
|
|
|
|
|
|
( filename => $template ) : |
53
|
5
|
100
|
|
|
|
58
|
( scalarref => \do { local $/; } ); |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
103
|
|
54
|
|
|
|
|
|
|
|
55
|
5
|
|
|
|
|
62
|
my $tmpl = HTML::Template::Compiled->new( |
56
|
|
|
|
|
|
|
%opts, |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
5
|
|
|
|
|
30411
|
$xhtml =~ s{ |