Parser/Section/WikisaurusSection.pm

filter: Statementstmt 34.4% 10 / 29 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 25.4% 13 / 51 CC 6 SCAR 30.8
CC
6
Cov
26%
add_content
42.0
new
2.0
add_word
2.0
CRAP 21.8
« Parser/Section/Pronunciation/Audio.pm ↑ Summary Parser/Section/Translations.pm »
1 package Wiktionary::Parser::Section::WikisaurusSection;
2  
3 3 ▶use Wiktionary::Parser::Section;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Wiktionary::Parser::TemplateParser;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use base qw(Wiktionary::Parser::Section);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
9 0 my $class = shift;
10 0 my %args = @_;
11 0 my $self = bless Wiktionary::Parser::Section->new(%args), $class;
12 0 return $self;
13 }
14  
15 # add a line of content to this section and parse it into its component parts
16 0 ▶sub add_content {
Subroutine add_content: not called CC=6 SCAR=37.4
Pod undocumented
17 0 my $self = shift;
18 0 my $line = shift;
19  
20 # * {{sense|swindler}} [[swindler]], [[cheat]]
21 # * {{l|en|blee}}
22 # * {{l|pt|para|gloss=[[to]], [[for]]}}
23  
24 0 ▶ if (my @templates = $self->get_template_parser()->extract_templates(line => $line)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@templates) = $self->get_template_parser->extract_templates("line", $line)) 0 0 0
25  
26 0 for my $template (@templates) {
27 0 my $meta = $self->get_template_parser()->parse_template(template => $template);
28 0 my $template_type = delete $meta->{template_type};
29  
30 0 ▶ next unless $meta && keys %$meta;
Branch: 1 branch
BranchTrueFalseTotal
unless $meta and keys %$meta 0 0 0
Condition0%0/3
$meta and keys %$meta
!ll&&!rl&&r
000
MC/DC0%0/2
$meta and keys %$meta
$meta keys %$meta
Truth table0%0/3
A and B
A= $metaB= keys %$meta
ABresult
0X0
100
111
31 0 ▶ if ($meta->{word}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta->{"word"}) 0 0 0
32 0 $self->add_word(%$meta);
33 }
34 }
35 }
36 }
37  
38 0 ▶sub add_word {
Subroutine add_word: not called CC=1 SCAR=6.9
Pod undocumented
39 0 my $self = shift;
40 0 my %args = @_;
41
42 0 push @{$self->{words}}, \%args;
43 }
44  
45 0 ▶sub get_words {
Subroutine get_words: not called CC=1 SCAR=6.9
Pod undocumented
46 0 my $self = shift;
47 0 return $self->{words};
48 }
49  
50 3 1;
« Parser/Section/Pronunciation/Audio.pm ↑ Summary Parser/Section/Translations.pm »