| 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
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
$meta and keys %$meta
MC/DC0%0/2
$meta and keys %$meta
$meta
keys %$meta
Truth table0%0/3
A and B
A= $metaB= keys %$meta
| |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | if ($meta->{word}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||