blib/lib/Pod/DokuWiki.pm

filter: Statementstmt 91.0% 193 / 212 Branchbran 73.2% 63 / 86 Conditioncond 43.1% 41 / 95 MC/DCmcdc 14.2% 7 / 49 Subroutinesub 100% 34 / 34 Podpod 100% 3 / 3 totaltotal 71.1% 341 / 479 CC 80 SCAR 17.2
CC
80
Cov
76%
__ANON__
11.2
__ANON__
9.4
__ANON__
8.0
CRAP 5.6
↑ Summary
1 1 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Pod::DokuWiki 0.02;
3 1 ▶use parent qw(Pod::Simple);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use URI::Escape qw(uri_escape_utf8);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 53 ▶sub _dokuwiki_escape($text) {
Subroutine _dokuwiki_escape: called CC=1 SCAR=0.0
8 53 $text =~ s{%%}{%%<nowiki>%%</nowiki>%%}g;
9 53 $text = '%%' . $text . '%%';
10 53 $text =~ s/%%%%//g;
11 53 $text
12 }
13  
14 5 ▶sub resolve_pod_link($module, $section) {
Subroutine resolve_pod_link: called CC=5 SCAR=16.1
Pod documented
15 5 ▶ my $to = $module // '';
Condition100%2/2
$module // ""
l!l
41
MC/DC100%1/1
$module // ""
$module
Truth table100%2/2
A
A= $module
Aresult
11
00
16 5 ▶ if (length $to) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $to) 4 1 5
17 4 ▶ if ($to =~ /\Aperl\w*\z/a) {
Branch: 1 branch
BranchTrueFalseTotal
if ($to =~ /\Aperl\w*\z/a) { } 2 2 4
18 2 $to = "https://perldoc.perl.org/$to";
19 } else {
20 2 $to = "https://metacpan.org/pod/" . uri_escape_utf8($to);
21 }
22 }
23 5 ▶ if (length $section) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $section) 3 2 5
24 3 $to .= '#' . $section =~ tr[a-zA-Z0-9_/\-][-]csr;
25 }
26 $to
27 5 }
28  
29 1 ▶sub resolve_man_link($n, $page, $section) {
Subroutine resolve_man_link: called CC=2 SCAR=7.6
Pod documented
30 1 my $to = "https://www.man7.org/linux/man-pages/man$n/" . uri_escape_utf8($page) . ".$n.html";
31 1 ▶ if (length $section) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $section) 0 1 1
32 0 $to .= '#' . uri_escape_utf8($section);
33 }
34 $to
35 1 }
36  
37 2 ▶sub new($class, %args) {
Subroutine new: called CC=4 SCAR=13.9
Pod documented
38 2 ▶ my $resolve_pod_link = delete $args{resolve_pod_link} // \&resolve_pod_link;
Condition100%2/2
delete $args{"resolve_pod_link"} // \&Pod::DokuWiki::resolve_pod_link
l!l
11
MC/DC100%1/1
delete $args{"resolve_pod_link"} // \&Pod::DokuWiki::resolve_pod_link
delete $args{"resolve_pod_link"}
Truth table100%2/2
A
A= delete $args{"resolve_pod_link"}
Aresult
11
00
39 2 ▶ my $resolve_man_link = delete $args{resolve_man_link} // \&resolve_man_link;
Condition100%2/2
delete $args{"resolve_man_link"} // \&Pod::DokuWiki::resolve_man_link
l!l
11
MC/DC100%1/1
delete $args{"resolve_man_link"} // \&Pod::DokuWiki::resolve_man_link
delete $args{"resolve_man_link"}
Truth table100%2/2
A
A= delete $args{"resolve_man_link"}
Aresult
11
00
40 2 ▶ croak "Unrecognized constructor parameter(s) " . join(', ', map "'$_'", sort keys %args)
Branch: 1 branch
BranchTrueFalseTotal
if %args 0 2 2
41 if %args;
42 2 my $self = $class->SUPER::new;
43 2 $self->nbsp_for_S(1);
44 2 $self->accept_targets('dokuwiki', 'highlighter');
45 2 ▶ $self->strip_verbatim_indent(sub ($lines) {
Subroutine __ANON__: called CC=5 SCAR=16.1
46 2 my $lvl = ~0;
47 2 for my $line (@$lines) {
48 14 ▶ $line =~ /\S/ or next;
Branch: 1 branch
BranchTrueFalseTotal
$line =~ /\S/u or next 12 2 14
49 12 my $c = $-[0];
50 12 ▶ $lvl = $c
Branch: 1 branch
BranchTrueFalseTotal
if $c < $lvl 2 10 12
51 if $c < $lvl;
52 }
53 substr($_, 0, $lvl) = ''
54 2 for @$lines;
55 undef
56 2 });
57 2 $self->{_dw_stack} = [];
58 2 $self->{_dw_plain} = 0;
59 2 $self->{_dw_passthrough} = 0;
60 2 $self->{_dw_highlighter} = 0;
61 2 $self->{_dw_list} = '';
62 2 $self->{_dw_buf} = '';
63 2 $self->{_dw_code_language} = '';
64 2 $self->{_dw_ccolumn} = 0;
65 2 $self->{_dw_coffset} = 0;
66 2 $self->{_dw_resolve_pod_link} = $resolve_pod_link;
67 2 $self->{_dw_resolve_man_link} = $resolve_man_link;
68 2 $self
69 }
70  
71 156 ▶sub _emit($self, $text) {
Subroutine _emit: called CC=3 SCAR=11.0
72 156 my $n = length $text;
73 156 $self->{_dw_coffset} += $n;
74 156 ▶ if ((my $p = rindex $text, "\n") >= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ((my $p = rindex($text, "\n")) >= 0) { } 47 109 156
75 47 $self->{_dw_ccolumn} = $n - $p - 1;
76 } else {
77 109 $self->{_dw_ccolumn} += $n;
78 }
79  
80 156 ▶ my $fh = $self->output_fh // return;
Condition50%1/2
$self->output_fh // (return)
l!l
1560
MC/DC0%0/1
$self->output_fh // (return)
$self->output_fh
Truth table50%1/2
A
A= $self->output_fh
Aresult
11
00
81 156 print $fh $text;
82 }
83  
84 24 ▶sub _at_bol($self) {
Subroutine _at_bol: called CC=1 SCAR=0.0
85 24 $self->{_dw_ccolumn} == 0
86 }
87  
88 84 ▶sub _extract_buf_verbatim($self) {
Subroutine _extract_buf_verbatim: called CC=1 SCAR=0.0
89 84 my $text = $self->{_dw_buf};
90 84 $self->{_dw_buf} = '';
91 84 $text
92 }
93  
94 81 ▶sub _extract_buf($self) {
Subroutine _extract_buf: called CC=1 SCAR=0.0
95 81 $self->_extract_buf_verbatim =~ tr/\r\n/ /r
96 }
97  
98 13 ▶sub _emit_item_marker($self) {
Subroutine _emit_item_marker: called CC=1 SCAR=0.0
99 13 $self->_emit(" " x length($self->{_dw_list}) . substr($self->{_dw_list}, -1) . " ");
100 }
101  
102 25 ▶sub _emit_block_start($self) {
Subroutine _emit_block_start: called CC=4 SCAR=14.0
103 25 ▶ if (!$self->{_dw_list}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_dw_list"}) 24 1 25
104 24 ▶ $self->_emit("\n\n") if $self->{_dw_coffset};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_dw_coffset"} 22 2 24
105 24 return;
106 }
107  
108 1 ▶ if ($self->_at_bol) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_at_bol) { } 0 1 1
109 0 $self->_emit_item_marker;
110 } else {
111 1 $self->_emit(" \\\\ ");
112 }
113 }
114  
115 sub _nop (@) {}
116  
117 1 my (%handler_start, %handler_end);
118  
119 73 ▶sub _handle_element_start($self, $elem, $attr, @) {
Subroutine _handle_element_start: called CC=2 SCAR=7.1
120 73 push $self->{_dw_stack}->@*, [$elem];
121 73 ▶ my $fn = $handler_start{$elem} // die "Internal error: unhandled element '$elem'";
Condition50%1/2
$handler_start{$elem} // die("Internal error: unhandled element '${elem}'")
l!l
730
MC/DC0%0/1
$handler_start{$elem} // die("Internal error: unhandled element '${elem}'")
$handler_start{$elem}
Truth table50%1/2
A
A= $handler_start{$elem}
Aresult
11
00
122 73 $self->$fn($attr);
123 }
124  
125 73 ▶sub _handle_element_end($self, $elem, @) {
Subroutine _handle_element_end: called CC=2 SCAR=7.1
126 73 ▶ my $fn = $handler_end{$elem} // die "Internal error: unhandled element '$elem' (end)";
Condition50%1/2
$handler_end{$elem} // die("Internal error: unhandled element '${elem}' (end)")
l!l
730
MC/DC0%0/1
$handler_end{$elem} // die("Internal error: unhandled element '${elem}' (end)")
$handler_end{$elem}
Truth table50%1/2
A
A= $handler_end{$elem}
Aresult
11
00
127 73 $self->$fn();
128 73 pop $self->{_dw_stack}->@*;
129 }
130  
131 78 ▶sub _handle_text($self, $text, @) {
Subroutine _handle_text: called CC=3 SCAR=11.0
132 78 ▶ if ($self->{_dw_highlighter} || !$self->{_dw_passthrough}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_dw_highlighter'} or not $self->{'_dw_passthrough'}) { } 77 1 78
Condition100%3/3
$self->{"_dw_highlighter"} or not $self->{"_dw_passthrough"}
l!l&&r!l&&!r
1761
MC/DC100%2/2
$self->{"_dw_highlighter"} or not $self->{"_dw_passthrough"}
$self->{"_dw_highlighter"} not $self->{"_dw_passthrough"}
Truth table100%3/3
A or not(B)
A= $self->{"_dw_highlighter"}B= not $self->{"_dw_passthrough"}
ABresult
1X1
011
000
133 77 $self->{_dw_buf} .= $text;
134 } else {
135 1 $self->_emit($text);
136 }
137 }
138  
139 1 $handler_start{Document} = \&_nop;
140 2 ▶$handler_end{Document} = sub ($self) {
Subroutine __ANON__: called CC=2 SCAR=7.2
141 2 ▶ if (!$self->_at_bol) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->_at_bol) 2 0 2
142 2 $self->_emit("\n");
143 }
144 1 };
145  
146 2 ▶$handler_start{for} = sub ($self, $attr) {
Subroutine __ANON__: called CC=3 SCAR=11.1
147 2 my $ctx = $self->{_dw_stack}[-1];
148 2 ▶ if ($attr->{target} eq 'highlighter') {
Branch: 2 branches
BranchTrueFalseTotal
if ($attr->{'target'} eq 'highlighter') { } 1 1 2
elsif ($attr->{'target'} eq 'dokuwiki') { } 1 0 1
149 1 $ctx->[1] = $attr->{target};
150 1 $ctx->[2] = $self->_extract_buf_verbatim;
151 1 $self->{_dw_highlighter}++;
152 } elsif ($attr->{target} eq 'dokuwiki') {
153 1 $ctx->[1] = $attr->{target};
154 1 $self->{_dw_passthrough}++;
155 1 $self->_emit("\n\n");
156 } else {
157 0 die "Internal error: unhandled =for target '$attr->{target}'";
158 }
159 1 };
160  
161 2 ▶$handler_end{for} = sub ($self) {
Subroutine __ANON__: called CC=5 SCAR=16.7
162 2 my $ctx = $self->{_dw_stack}[-1];
163 2 ▶ if ($ctx->[1] eq 'highlighter') {
Branch: 2 branches
BranchTrueFalseTotal
if ($ctx->[1] eq 'highlighter') { } 1 1 2
elsif ($ctx->[1] eq 'dokuwiki') { } 1 0 1
164 1 my $data = $self->_extract_buf;
165 1 $self->{_dw_buf} = $ctx->[2];
166 1 $self->{_dw_highlighter}--;
167 1 ▶ my %settings =
Branch: 1 branch
BranchTrueFalseTotal
/\A([^=]*)=(.*)\z/su ? : 1 0 1
168 map /\A([^=]*)=(.*)\z/s
169 ? ($1 => $2)
170 : (language => $_),
171 split ' ', $data;
172 1 ▶ $self->{_dw_code_language} = $settings{language} // '';
Condition50%1/2
$settings{"language"} // ""
l!l
10
MC/DC0%0/1
$settings{"language"} // ""
$settings{"language"}
Truth table50%1/2
A
A= $settings{"language"}
Aresult
11
00
173 } elsif ($ctx->[1] eq 'dokuwiki') {
174 1 $self->{_dw_passthrough}--;
175 } else {
176 0 die "Internal error: unhandled =for target '$ctx->[1]' (end)";
177 }
178 1 };
179  
180 1 $handler_start{Data} = \&_nop;
181 1 $handler_end{Data} = \&_nop;
182  
183 1 for my $i (1 .. 6) {
184 15 ▶ $handler_start{'head' . $i} = sub ($self, $) {
Subroutine __ANON__: called CC=4 SCAR=17.9
185 15 my $plain = $self->{_dw_plain}++;
186 15 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $plain) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain) 0 15 15
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain
l!l&&r!l&&!r
0015
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0015
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $plain
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $plain
ABCresult
1XX1
01X1
0011
0000
187 0 return;
188 }
189 15 $self->_emit_block_start;
190 6 };
191  
192 15 ▶ $handler_end{'head' . $i} = sub ($self) {
Subroutine __ANON__: called CC=6 SCAR=19.9
193 15 $self->{_dw_plain}--;
194 15 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 15 15
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
0015
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0015
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
195 0 return;
196 }
197  
198 15 my $text = $self->_extract_buf;
199  
200 15 ▶ if ($i == 6 || $self->{_dw_list}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i == 6 or $self->{'_dw_list'}) { } 1 14 15
Condition66%2/3
$i == 6 or $self->{"_dw_list"}
l!l&&r!l&&!r
1014
MC/DC50%1/2
$i == 6 or $self->{"_dw_list"}
$i == 6 $self->{"_dw_list"}
Truth table66%2/3
A or B
A= $i == 6B= $self->{"_dw_list"}
ABresult
1X1
011
000
201 1 $self->_emit('//' . _dokuwiki_escape($text) . '//');
202 } else {
203 14 my $marker = '=' x (7 - $i);
204 14 $self->_emit("$marker $text $marker");
205 }
206 6 };
207 }
208  
209 10 ▶$handler_start{Para} = sub ($self, $) {
Subroutine __ANON__: called CC=4 SCAR=18.9
210 10 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 10 10
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
0010
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0010
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
211 0 return;
212 }
213  
214 10 $self->_emit_block_start;
215 1 };
216  
217 10 ▶$handler_end{Para} = sub ($self) {
Subroutine __ANON__: called CC=4 SCAR=17.9
218 10 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 10 10
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
0010
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0010
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
219 0 return;
220 }
221  
222 10 my $text = $self->_extract_buf;
223 10 $self->_emit(_dokuwiki_escape($text));
224 1 };
225  
226  
227 2 ▶$handler_start{Verbatim} = sub ($self, $) {
Subroutine __ANON__: called CC=6 SCAR=24.2
228 2 my $plain = $self->{_dw_plain}++;
229 2 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $plain) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain) 0 2 2
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain
l!l&&r!l&&!r
002
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
002
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $plain
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $plain
ABCresult
1XX1
01X1
0011
0000
230 0 return;
231 }
232  
233 2 ▶ if ($self->{_dw_list}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'_dw_list'}) { } 0 2 2
elsif ($self->_at_bol) { } 0 2 2
234 0 $self->_emit(" ");
235 } elsif ($self->_at_bol) {
236 0 $self->_emit("\n");
237 } else {
238 2 $self->_emit("\n\n");
239 }
240 1 };
241  
242 2 ▶$handler_end{Verbatim} = sub ($self) {
Subroutine __ANON__: called CC=7 SCAR=20.7
243 2 $self->{_dw_plain}--;
244 2 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 2 2
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
002
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
002
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
245 0 return;
246 }
247  
248 2 my $text = $self->_extract_buf_verbatim;
249  
250 2 ▶ my $attr = $self->{_dw_code_language} ? " $self->{_dw_code_language}" : '';
Branch: 1 branch
BranchTrueFalseTotal
$self->{'_dw_code_language'} ? : 1 1 2
251 2 my $tag;
252 2 ▶ if ($text =~ m{</code>} && $text !~ m{</file>}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($text =~ m[</code>]u and not $text =~ m[</file>]u) { } 1 1 2
Condition66%2/3
$text =~ m[</code>]u and not $text =~ m[</file>]u
!ll&&!rl&&r
101
MC/DC50%1/2
$text =~ m[</code>]u and not $text =~ m[</file>]u
$text =~ m[</code>]u not $text =~ m[</file>]u
Truth table66%2/3
A and not(B)
A= $text =~ m[</code>]uB= not $text =~ m[</file>]u
ABresult
0X0
100
111
253 1 $tag = 'file';
254 } else {
255 1 $tag = 'code';
256 1 $text =~ s{</code\K(?=>)}{\N{U+200B}}g;
257 }
258 2 $self->_emit("<$tag$attr>\n$text\n</$tag>");
259 1 };
260  
261 13 ▶$handler_start{L} = sub ($self, $attr) {
Subroutine __ANON__: called CC=8 SCAR=22.4
262 13 my $plain = $self->{_dw_plain}++;
263 13 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $plain) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain) 0 13 13
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain
l!l&&r!l&&!r
0013
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0013
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $plain
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $plain
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $plain
ABCresult
1XX1
01X1
0011
0000
264 0 return;
265 }
266  
267 13 my $text = $self->_extract_buf;
268 13 $self->_emit(_dokuwiki_escape($text) . '[[');
269  
270 13 my $type = $attr->{type};
271 13 my $to = $attr->{to};
272 13 ▶ if ($type eq 'url') {
Branch: 3 branches
BranchTrueFalseTotal
if ($type eq 'url') { } 2 11 13
elsif ($type eq 'man') { } 3 8 11
elsif ($type eq 'pod') { } 8 0 8
273 } elsif ($type eq 'man') {
274 3 ▶ $to =~ s/\((\d+)\)\z//a or die "Internal error: unhandled 'man' link target '$to'";
Branch: 1 branch
BranchTrueFalseTotal
$to =~ s/\((\d+)\)\z//a or die "Internal error: unhandled 'man' link target '${to}'" 3 0 3
275 3 $to = $self->{_dw_resolve_man_link}($1, $to, $attr->{section});
276 } elsif ($type eq 'pod') {
277 8 $to = $self->{_dw_resolve_pod_link}($to, $attr->{section});
278 } else {
279 0 die "Internal error: unhandled link type '$type'";
280 }
281  
282 13 $to =~ s/\[/%5B/g;
283 13 $to =~ s/\]/%5D/g;
284 13 $to =~ s/\|/%7C/g;
285  
286 13 $self->_emit("$to|");
287 1 };
288  
289 13 ▶$handler_end{L} = sub ($self) {
Subroutine __ANON__: called CC=4 SCAR=17.2
290 13 $self->{_dw_plain}--;
291 13 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 13 13
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
0013
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0013
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
292 0 return;
293 }
294  
295 13 my $text = $self->_extract_buf;
296 13 $self->_emit($text =~ s/\]\K(?=\])/\N{U+200B}/gr . ']]');
297 1 };
298  
299 {
300 1 my %markup = (
301 B => "**",
302 C => "''",
303 I => "//",
304 U => "__",
305 );
306  
307 1 for my $fmt (keys %markup) {
308 4 my $marker = $markup{$fmt};
309 16 ▶ $handler_start{$fmt} = $handler_end{$fmt} = sub ($self, @) {
Subroutine __ANON__: called CC=4 SCAR=17.9
310 16 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 16 16
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
0016
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0016
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
311 0 return;
312 }
313 16 my $text = $self->_extract_buf;
314 16 $self->_emit(_dokuwiki_escape($text) . $marker);
315 4 };
316 }
317 }
318  
319 {
320 1 my %marker = (
321 number => '-',
322 bullet => '*',
323 text => '*',
324 );
325
326 1 for my $list_type (keys %marker) {
327 3 my $marker = $marker{$list_type};
328  
329 6 ▶ $handler_start{"over-$list_type"} = sub ($self, $) {
Subroutine __ANON__: called CC=1 SCAR=0.0
330 6 $self->{_dw_list} .= $marker;
331 3 };
332  
333 6 ▶ $handler_end{"over-$list_type"} = sub ($self) {
Subroutine __ANON__: called CC=5 SCAR=18.9
334 6 chop $self->{_dw_list};
335 6 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 6 6
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
006
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
006
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
336 0 return;
337 }
338 6 ▶ if (!$self->_at_bol) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->_at_bol) 5 1 6
339 5 $self->_emit("\n");
340 }
341 3 };
342  
343 13 ▶ $handler_start{"item-$list_type"} = sub ($self, $) {
Subroutine __ANON__: called CC=6 SCAR=19.6
344 13 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 13 13
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
0013
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0013
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
345 0 return;
346 }
347 13 ▶ if (!$self->_at_bol) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_at_bol) 12 1 13
348 12 $self->_emit("\n");
349 }
350 13 $self->_emit_item_marker;
351  
352 13 ▶ if ($list_type eq 'text') {
Branch: 1 branch
BranchTrueFalseTotal
if ($list_type eq "text") 1 12 13
353 1 $self->_emit("//");
354 }
355 3 };
356  
357 13 ▶ $handler_end{"item-$list_type"} = sub ($self) {
Subroutine __ANON__: called CC=5 SCAR=18.4
358 13 ▶ if ($self->{_dw_passthrough} || $self->{_dw_highlighter} || $self->{_dw_plain}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}) 0 13 13
Condition33%2/6
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
l!l&&r!l&&!r
0013
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"}
l!l&&r!l&&!r
0013
MC/DC0%0/3
$self->{"_dw_passthrough"} or $self->{"_dw_highlighter"} or $self->{"_dw_plain"}
$self->{"_dw_passthrough"} $self->{"_dw_highlighter"} $self->{"_dw_plain"}
Truth table25%1/4
A or B or C
A= $self->{"_dw_passthrough"}B= $self->{"_dw_highlighter"}C= $self->{"_dw_plain"}
ABCresult
1XX1
01X1
0011
0000
359 0 return;
360 }
361 13 my $text = $self->_extract_buf;
362 13 $self->_emit(_dokuwiki_escape($text));
363 13 ▶ if ($list_type eq 'text') {
Branch: 1 branch
BranchTrueFalseTotal
if ($list_type eq "text") 1 12 13
364 1 $self->_emit("//");
365 }
366 3 };
367 }
368 }
369  
370 'ok'
371  
372 1 __END__
↑ Summary