| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||
| 2 | package Pod::AxPoint; | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 2 | $Pod::AxPoint::VERSION = 0.04; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Pod::Tree; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # map pod => ax XML | ||||||||||||||||||||||||||||
| 10 | # scheme: http://search.cpan.org/dist/XML-Handler-AxPoint/lib/XML/Handler/AxPoint.pm | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use vars qw(%syntax $ax); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 2 | my %syntax = ( | |||||||||||||||||||||||||||
| 15 | head1 => "title", | ||||||||||||||||||||||||||||
| 16 | head2 => "title", | ||||||||||||||||||||||||||||
| 17 | text => "plain", | ||||||||||||||||||||||||||||
| 18 | verbatim => "source-code", | ||||||||||||||||||||||||||||
| 19 | b => "b", | ||||||||||||||||||||||||||||
| 20 | i => "i", | ||||||||||||||||||||||||||||
| 21 | c => "source-code", | ||||||||||||||||||||||||||||
| 22 | f => "i", | ||||||||||||||||||||||||||||
| 23 | g => "image", | ||||||||||||||||||||||||||||
| 24 | list_number => "list", | ||||||||||||||||||||||||||||
| 25 | list_bullet => "list", | ||||||||||||||||||||||||||||
| 26 | list_text => "list", | ||||||||||||||||||||||||||||
| 27 | item_number => "point", | ||||||||||||||||||||||||||||
| 28 | item_bullet => "point", | ||||||||||||||||||||||||||||
| 29 | item_text => "point", | ||||||||||||||||||||||||||||
| 30 | table => "table", | ||||||||||||||||||||||||||||
| 31 | row => "row", | ||||||||||||||||||||||||||||
| 32 | cell => "col", | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 1 | my ($class, %param) = @_; | |||||||||||||||||||||||||||
| 37 | 1 | ▶ | my $type = ref( $class ) || $class; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 38 | 1 | my $self = \%param; | |||||||||||||||||||||||||||
| 39 | 1 | bless $self, $type; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub syntax { | ||||||||||||||||||||||||||
|
Subroutine
syntax: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 0 | my($this, %syn) = @_; | |||||||||||||||||||||||||||
| 44 | 0 | %syntax = %syn; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 1 | ▶ | sub process { | ||||||||||||||||||||||||||
|
Subroutine
process: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | 1 | my($this, $pod) = @_; | |||||||||||||||||||||||||||
| 49 | 1 | ▶ | if (! $pod) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | croak qq(Required parameter '$pod' missing!\n); | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 1 | $ax = qq(<?xml version="1.0"?>\n<slideshow>\n); | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | ##### start the rendering process | ||||||||||||||||||||||||||||
| 56 | 1 | my $tree = new Pod::Tree; | |||||||||||||||||||||||||||
| 57 | 1 | my $in_slide = 0; # to find end of slice | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 1 | ▶ | $tree->load_string($pod, in_pod => 0) or croak "Could not load POD: $!\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 1 | $tree->walk(\&walker); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 1 | $ax .= qq(</slide></slideshow>\n); | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 1 | return $ax; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 16 | ▶ | sub tag_open { | ||||||||||||||||||||||||||
|
Subroutine
tag_open: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 71 | 16 | my ($name, $param) = @_; | |||||||||||||||||||||||||||
| 72 | 16 | ▶ | if ($param) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 2 | return qq(<$name $param>); | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | else { | ||||||||||||||||||||||||||||
| 76 | 14 | return qq(<$name>); | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 16 | ▶ | sub tag_close { | ||||||||||||||||||||||||||
|
Subroutine
tag_close: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 81 | 16 | my $name = shift; | |||||||||||||||||||||||||||
| 82 | 16 | return "</" . $name . ">"; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 38 | ▶ | sub walker { | ||||||||||||||||||||||||||
|
Subroutine
walker: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 86 | 38 | my $node = shift; | |||||||||||||||||||||||||||
| 87 | 38 | my $type = $node->get_type; | |||||||||||||||||||||||||||
| 88 | 38 | my $sub = "walk_" . $type; | |||||||||||||||||||||||||||
| 89 | 38 | &$sub($node); | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 1 | ▶ | sub walk_root { | ||||||||||||||||||||||||||
|
Subroutine
walk_root: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 94 | 1 | my $node = shift; | |||||||||||||||||||||||||||
| 95 | 1 | &walk_children($node); | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 14 | ▶ | sub walk_children { | ||||||||||||||||||||||||||
|
Subroutine
walk_children: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 100 | 14 | my $node = shift; | |||||||||||||||||||||||||||
| 101 | 14 | my $children = $node->get_children; | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 14 | foreach my $child (@$children) { | |||||||||||||||||||||||||||
| 104 | 35 | &walker($child); | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 1 | ▶ | sub walk_verbatim { | ||||||||||||||||||||||||||
|
Subroutine
walk_verbatim: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | 1 | my $node = shift; | |||||||||||||||||||||||||||
| 110 | 1 | my $text = $node->get_text; | |||||||||||||||||||||||||||
| 111 | 1 | $ax .= &tag_open($syntax{verbatim}); | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 1 | $text =~ s/\s\s*$/ /gs; # remove trailing spaces | |||||||||||||||||||||||||||
| 114 | #$text =~ s/</</gs; # replace < | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 1 | $ax .= $text; | |||||||||||||||||||||||||||
| 117 | 1 | $ax .= &tag_close($syntax{verbatim}); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 4 | ▶ | sub walk_ordinary { | ||||||||||||||||||||||||||
|
Subroutine
walk_ordinary: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 121 | 4 | my $node = shift; | |||||||||||||||||||||||||||
| 122 | 4 | my $text = $node->get_raw; | |||||||||||||||||||||||||||
| 123 | # normal paragraph | ||||||||||||||||||||||||||||
| 124 | 4 | $ax .= &tag_open($syntax{text}); | |||||||||||||||||||||||||||
| 125 | 4 | &walk_children($node); | |||||||||||||||||||||||||||
| 126 | 4 | $ax .= &tag_close($syntax{text}); | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 11 | ▶ | sub walk_command { | ||||||||||||||||||||||||||
|
Subroutine
walk_command: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 130 | 11 | my $node = shift; | |||||||||||||||||||||||||||
| 131 | 11 | my $command = lc($node->get_command); | |||||||||||||||||||||||||||
| 132 | 11 | ▶ | if ($command =~ /head([1-2])/) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 133 | 8 | my $level = $1; | |||||||||||||||||||||||||||
| 134 | # start of a new section | ||||||||||||||||||||||||||||
| 135 | 8 | ▶ | if ($in_slide) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | # finish previous section | ||||||||||||||||||||||||||||
| 137 | 7 | $ax .= qq(</slide>\n); | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | else { | ||||||||||||||||||||||||||||
| 140 | # first section | ||||||||||||||||||||||||||||
| 141 | 1 | $in_slide = 1; | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | 8 | $ax .= qq(<slide>\n); | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 8 | $ax .= &tag_open($syntax{$command}); | |||||||||||||||||||||||||||
| 146 | 8 | &walk_children($node); | |||||||||||||||||||||||||||
| 147 | 8 | $ax .= &tag_close($syntax{$command}); | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | elsif ($command =~ /over/) { | ||||||||||||||||||||||||||||
| 150 | 0 | &walk_list($node); | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub walk_letter { | ||||||||||||||||||||||||||
|
Subroutine
walk_letter: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 155 | # workaround for node-type 'letter', which | ||||||||||||||||||||||||||||
| 156 | # is handled in walk_sequence() | ||||||||||||||||||||||||||||
| 157 | 0 | &walk_sequence(@_); | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 2 | ▶ | sub walk_sequence { | ||||||||||||||||||||||||||
|
Subroutine
walk_sequence: called CC=5 SCAR=19.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 161 | 2 | my $node = shift; | |||||||||||||||||||||||||||
| 162 | 2 | my $letter = lc($node->get_letter); | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 2 | ▶ | if ($letter =~ /i|b|c|f/) { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 165 | # format element | ||||||||||||||||||||||||||||
| 166 | 0 | $ax .= &tag_open($syntax{$letter}); | |||||||||||||||||||||||||||
| 167 | 0 | &walk_children($node); | |||||||||||||||||||||||||||
| 168 | 0 | $ax .= &tag_close($syntax{$letter}); | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | elsif ($letter =~ /g/) { | ||||||||||||||||||||||||||||
| 171 | # graphic element | ||||||||||||||||||||||||||||
| 172 | 0 | my ($image, $parameter) = split/\|/, $node->get_deep_text; | |||||||||||||||||||||||||||
| 173 | # for now we ignore $parameter but might use it for scaling in the future | ||||||||||||||||||||||||||||
| 174 | 0 | $ax .= qq(<image>$image</image>\n); | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | # currently unsupported - convert to unicode xml entities? | ||||||||||||||||||||||||||||
| 177 | # eg Õ - FIXME | ||||||||||||||||||||||||||||
| 178 | #elsif ($letter =~ /e/) { | ||||||||||||||||||||||||||||
| 179 | # # character entity, html unicode and pod entities are supported | ||||||||||||||||||||||||||||
| 180 | # my $entity = $node->get_deep_text; | ||||||||||||||||||||||||||||
| 181 | # print "&" .$entity . ";"; | ||||||||||||||||||||||||||||
| 182 | #} | ||||||||||||||||||||||||||||
| 183 | elsif ($letter =~ /l/) { | ||||||||||||||||||||||||||||
| 184 | 2 | my ($uri, $name); | |||||||||||||||||||||||||||
| 185 | 2 | my $target = $node->get_target; | |||||||||||||||||||||||||||
| 186 | 2 | my $linkpage = $target->get_page; | |||||||||||||||||||||||||||
| 187 | 2 | ▶ | if($linkpage =~ /\s/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | 0 | ($uri, $name) = split /\s\s*/, $linkpage, 2; | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | else { | ||||||||||||||||||||||||||||
| 191 | 2 | $uri = $linkpage; | |||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||
| 193 | 2 | $section = $target->get_section; | |||||||||||||||||||||||||||
| 194 | # $name unsupported | ||||||||||||||||||||||||||||
| 195 | 2 | $ax .= qq(<color name="blue"><u>$uri</u></color>); | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 13 | ▶ | sub walk_text { | ||||||||||||||||||||||||||
|
Subroutine
walk_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 201 | 13 | my $node = shift; | |||||||||||||||||||||||||||
| 202 | 13 | my $text = $node->get_text; | |||||||||||||||||||||||||||
| 203 | 13 | $ax .= $text; | |||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 0 | ▶ | sub table_opt { | ||||||||||||||||||||||||||
|
Subroutine
table_opt: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 207 | 0 | my $opt = shift; | |||||||||||||||||||||||||||
| 208 | 0 | ▶ | if (! $opt) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 209 | 0 | return ""; | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | else { | ||||||||||||||||||||||||||||
| 212 | 0 | $opt =~ s/^\s*//gs; | |||||||||||||||||||||||||||
| 213 | 0 | $opt =~ s/\s*$//gs; | |||||||||||||||||||||||||||
| 214 | 0 | $opt =~ s/,/ /g; | |||||||||||||||||||||||||||
| 215 | 0 | $opt = " $opt"; | |||||||||||||||||||||||||||
| 216 | 0 | return $opt; | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | ▶ | sub walk_table { | ||||||||||||||||||||||||||
|
Subroutine
walk_table: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 221 | 0 | my $node = shift; | |||||||||||||||||||||||||||
| 222 | 0 | my $options = &table_opt($node->get_arg); | |||||||||||||||||||||||||||
| 223 | 0 | $ax .= &tag_open($syntax{table} . $options); | |||||||||||||||||||||||||||
| 224 | 0 | &walk_children($node); | |||||||||||||||||||||||||||
| 225 | 0 | $ax .= &tag_close($syntax{table}); | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub walk_row { | ||||||||||||||||||||||||||
|
Subroutine
walk_row: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 229 | 0 | my $node = shift; | |||||||||||||||||||||||||||
| 230 | 0 | my $options = &table_opt($node->get_arg); | |||||||||||||||||||||||||||
| 231 | 0 | $ax .= &tag_open($syntax{row} . $options); | |||||||||||||||||||||||||||
| 232 | 0 | &walk_children($node); | |||||||||||||||||||||||||||
| 233 | 0 | $ax .= &tag_close($syntax{row}); | |||||||||||||||||||||||||||
| 234 | 0 | &walk_siblings($node); | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub walk_cell { | ||||||||||||||||||||||||||
|
Subroutine
walk_cell: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 238 | 0 | my $node = shift; | |||||||||||||||||||||||||||
| 239 | 0 | my $tag = "cell"; | |||||||||||||||||||||||||||
| 240 | 0 | my $options = &table_opt($node->get_arg); | |||||||||||||||||||||||||||
| 241 | 0 | ▶ | if ($options) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | # removed + match | ||||||||||||||||||||||||||||
| 243 | 0 | $options =~ s/type=head//; | |||||||||||||||||||||||||||
| 244 | 0 | $tag = "headcell"; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | 0 | $ax .= &tag_open($syntax{$tag} . $options); | |||||||||||||||||||||||||||
| 247 | 0 | $ax .= $node->get_deep_text; | |||||||||||||||||||||||||||
| 248 | 0 | &walk_siblings($node); | |||||||||||||||||||||||||||
| 249 | 0 | $ax .= &tag_close($syntax{$tag}); | |||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 1 | ▶ | sub walk_list { | ||||||||||||||||||||||||||
|
Subroutine
walk_list: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 254 | 1 | my $node = shift; | |||||||||||||||||||||||||||
| 255 | 1 | my $indent = $node->get_arg; | |||||||||||||||||||||||||||
| 256 | 1 | my $list_type = $node->get_list_type; | |||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 1 | $ax .= &tag_open($syntax{"list_" . $list_type}); | |||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 1 | &walk_children($node); # text of the =over paragraph | |||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 1 | $ax .= &tag_close($syntax{"list_" . $list_type}); | |||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 2 | ▶ | sub walk_item { | ||||||||||||||||||||||||||
|
Subroutine
walk_item: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 267 | 2 | my $node = shift; | |||||||||||||||||||||||||||
| 268 | 2 | my $item_type = $node->get_item_type; | |||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | # we must add the level here | ||||||||||||||||||||||||||||
| 271 | # http://axkit.org/archive/message/48/42 | ||||||||||||||||||||||||||||
| 272 | 2 | $ax .= &tag_open($syntax{"item_" . $item_type}, q(level="1")); | |||||||||||||||||||||||||||
| 273 | 2 | ▶ | if ($item_type ne "bullet" && $item_type ne "number") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$item_type ne "bullet" and $item_type ne "number"
MC/DC0%0/2
$item_type ne "bullet" and $item_type ne "number"
$item_type ne "bullet"
$item_type ne "number"
Truth table33%1/3
A and B
A= $item_type ne "bullet"B= $item_type ne "number"
| |||||||||||||||||||||||||||||
| 274 | # bullet types do not have content on the =item line beside the bullet | ||||||||||||||||||||||||||||
| 275 | 0 | &walk_children($node); # text of the =item paragraph | |||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | 2 | &walk_siblings($node); | |||||||||||||||||||||||||||
| 278 | 2 | $ax .= &tag_close($syntax{"item_" . $item_type}); | |||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 2 | ▶ | sub walk_siblings { | ||||||||||||||||||||||||||
|
Subroutine
walk_siblings: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 282 | 2 | my $node = shift; | |||||||||||||||||||||||||||
| 283 | 2 | my $siblings = $node->get_siblings; | |||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 2 | for my $sibling (@$siblings) { | |||||||||||||||||||||||||||
| 286 | 2 | &walker($sibling); | |||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 2 | ▶ | sub walk_for { | ||||||||||||||||||||||||||
|
Subroutine
walk_for: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 291 | 2 | my $node = shift; | |||||||||||||||||||||||||||
| 292 | 2 | my $formatter = $node->get_arg; | |||||||||||||||||||||||||||
| 293 | 2 | my $text = $node->get_text; | |||||||||||||||||||||||||||
| 294 | 2 | $formatter =~ s/\s//g; | |||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | # call the generalized formatter | ||||||||||||||||||||||||||||
| 297 | 2 | my $sub = "formatter_" . $formatter; | |||||||||||||||||||||||||||
| 298 | 2 | &$sub($text); | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 1 | ▶ | sub walk_code { | ||||||||||||||||||||||||||
|
Subroutine
walk_code: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 302 | # perl code and comments - ignore | ||||||||||||||||||||||||||||
| 303 | 1 | return; | |||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 1 | ▶ | sub formatter_text { | ||||||||||||||||||||||||||
|
Subroutine
formatter_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 307 | 1 | my($text) = @_; | |||||||||||||||||||||||||||
| 308 | 1 | local $_ = $text; | |||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | 1 | s/\s\s*$/ /gs; # remove trailing spaces | |||||||||||||||||||||||||||
| 311 | 1 | s/</</gs; # replace < | |||||||||||||||||||||||||||
| 312 | 1 | $ax .= qq(<source-code>$_</source-code>); # 1:1 txt content | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 1 | ▶ | sub formatter_xml { | ||||||||||||||||||||||||||
|
Subroutine
formatter_xml: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 316 | 1 | my($text) = @_; | |||||||||||||||||||||||||||
| 317 | # keep the input as is | ||||||||||||||||||||||||||||
| 318 | 1 | $ax .= $text; | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | __END__ | ||||||||||||||||||||||||||||