line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Linear::Path::Colors; |
2
|
|
|
|
|
|
|
# ABSTRACT: color schemes to render HTML::Linear::Path |
3
|
64
|
|
|
64
|
|
1023
|
use strict; |
|
64
|
|
|
|
|
117
|
|
|
64
|
|
|
|
|
2221
|
|
4
|
64
|
|
|
64
|
|
356
|
use utf8; |
|
64
|
|
|
|
|
133
|
|
|
64
|
|
|
|
|
549
|
|
5
|
64
|
|
|
64
|
|
1726
|
use warnings qw(all); |
|
64
|
|
|
|
|
124
|
|
|
64
|
|
|
|
|
2240
|
|
6
|
|
|
|
|
|
|
|
7
|
64
|
|
|
64
|
|
81539
|
use HTML::Entities; |
|
64
|
|
|
|
|
478359
|
|
|
64
|
|
|
|
|
8137
|
|
8
|
64
|
|
|
64
|
|
103707
|
use Term::ANSIColor qw(:constants :constants256); |
|
64
|
|
|
|
|
688830
|
|
|
64
|
|
|
|
|
391488
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
## no critic (ProhibitPackageVars) |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.019'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our %scheme = ( |
16
|
|
|
|
|
|
|
default => { |
17
|
|
|
|
|
|
|
array => ['' => ''], |
18
|
|
|
|
|
|
|
attribute => ['' => ''], |
19
|
|
|
|
|
|
|
equal => ['' => ''], |
20
|
|
|
|
|
|
|
number => ['' => ''], |
21
|
|
|
|
|
|
|
separator => ['' => ''], |
22
|
|
|
|
|
|
|
sigil => ['' => ''], |
23
|
|
|
|
|
|
|
tag => ['' => ''], |
24
|
|
|
|
|
|
|
value => ['' => ''], |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
terminal => { |
27
|
|
|
|
|
|
|
array => [BOLD . CYAN, RESET], |
28
|
|
|
|
|
|
|
attribute => [BOLD . BRIGHT_YELLOW, RESET], |
29
|
|
|
|
|
|
|
equal => [BOLD . YELLOW, RESET], |
30
|
|
|
|
|
|
|
number => [BOLD . BRIGHT_GREEN, RESET], |
31
|
|
|
|
|
|
|
separator => [BOLD . RED, RESET], |
32
|
|
|
|
|
|
|
sigil => [BOLD . MAGENTA, RESET], |
33
|
|
|
|
|
|
|
tag => [BOLD . BRIGHT_BLUE, RESET], |
34
|
|
|
|
|
|
|
value => [BOLD . BRIGHT_WHITE, RESET], |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
terminal256 => { |
37
|
|
|
|
|
|
|
array => [BOLD . RGB155, RESET], |
38
|
|
|
|
|
|
|
attribute => [BOLD . RGB551, RESET], |
39
|
|
|
|
|
|
|
equal => [BOLD . RGB110, RESET], |
40
|
|
|
|
|
|
|
number => [BOLD . RGB151, RESET], |
41
|
|
|
|
|
|
|
separator => [BOLD . RGB511, RESET], |
42
|
|
|
|
|
|
|
sigil => [BOLD . RGB515, RESET], |
43
|
|
|
|
|
|
|
tag => [BOLD . RGB115, RESET], |
44
|
|
|
|
|
|
|
value => [BOLD . RGB555, RESET], |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
html => { |
47
|
|
|
|
|
|
|
array => [q() => q()], |
48
|
|
|
|
|
|
|
attribute => [q() => q()], |
49
|
|
|
|
|
|
|
equal => [q() => q()], |
50
|
|
|
|
|
|
|
number => [q() => q()], |
51
|
|
|
|
|
|
|
separator => [q() => q()], |
52
|
|
|
|
|
|
|
sigil => [q() => q()], |
53
|
|
|
|
|
|
|
tag => [q() => q()], |
54
|
|
|
|
|
|
|
value => [q() => q()], |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
our @html = (<<'BOILERPLATE_HTML_HEADER', |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
BOILERPLATE_HTML_HEADER |
71
|
|
|
|
|
|
|
<<'BOILERPLATE_HTML_FOOTER'); |
72
|
|
|
|
|
|
|
| |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
BOILERPLATE_HTML_FOOTER |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub wrap_xpath { |
79
|
98
|
|
|
98
|
1
|
181
|
my ($xpath) = @_; |
80
|
|
|
|
|
|
|
|
81
|
98
|
|
|
|
|
1103
|
$xpath =~ s{ |
82
|
|
|
|
|
|
|
(<[^>]+>)(.*?)([^>]+>) |
83
|
|
|
|
|
|
|
}{ |
84
|
2098
|
|
|
|
|
43232
|
$1 . encode_entities($2) . $3 |
85
|
|
|
|
|
|
|
}egsx; |
86
|
|
|
|
|
|
|
|
87
|
98
|
|
|
|
|
72289
|
return $xpath; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub wrap_content { |
92
|
357
|
|
|
357
|
1
|
645
|
my ($content, $html) = @_; |
93
|
|
|
|
|
|
|
|
94
|
357
|
100
|
100
|
|
|
1333
|
if ($html // 0) { |
95
|
188
|
|
|
|
|
480
|
$content = encode_entities($content); |
96
|
188
|
|
|
|
|
5525
|
$content =~ s{ |
97
|
|
|
|
|
|
|
(^\s+|(?<=\n)\s+|\s+(?=\n)|\s+$) |
98
|
|
|
|
|
|
|
}{ |
99
|
8
|
|
|
|
|
29
|
my $s = $1; |
100
|
8
|
|
|
|
|
49
|
$s =~ s/\s/ /gsx; |
101
|
8
|
|
|
|
|
100
|
qq($s) |
102
|
|
|
|
|
|
|
}egsx; |
103
|
188
|
|
|
|
|
424
|
$content =~ s{\r?\n}{ }gsx; |
104
|
188
|
|
|
|
|
2146
|
$content =~ s{\s}{ }gsx; |
105
|
|
|
|
|
|
|
} else { |
106
|
169
|
|
|
|
|
2295
|
$content =~ s{ |
107
|
|
|
|
|
|
|
(^\s+|(?<=\n)\s+|\s+(?=\n)|\s+$) |
108
|
|
|
|
|
|
|
}{ |
109
|
9
|
|
|
|
|
122
|
ON_RED . $1 . RESET |
110
|
|
|
|
|
|
|
}egsx; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
357
|
|
|
|
|
10165
|
return $content; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
__END__ |