| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Wiktionary::Parser::Section::WikisaurusSection; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 3 |  |  | 3 |  | 17 | use Wiktionary::Parser::Section; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 75 |  | 
| 4 | 3 |  |  | 3 |  | 20 | use Wiktionary::Parser::TemplateParser; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 73 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 3 |  |  | 3 |  | 16 | use base qw(Wiktionary::Parser::Section); | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 1009 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub new { | 
| 9 | 0 |  |  | 0 | 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 |  |  |  |  |  |  | sub add_content { | 
| 17 | 0 |  |  | 0 | 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 | 0 |  |  |  |  | if (my @templates = $self->get_template_parser()->extract_templates(line => $line)) { | 
| 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 | 0 | 0 |  |  |  | next unless $meta && keys %$meta; | 
| 31 | 0 | 0 |  |  |  |  | if ($meta->{word}) { | 
| 32 | 0 |  |  |  |  |  | $self->add_word(%$meta); | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | sub add_word { | 
| 39 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 40 | 0 |  |  |  |  |  | my %args = @_; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 0 |  |  |  |  |  | push @{$self->{words}}, \%args; | 
|  | 0 |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | sub get_words { | 
| 46 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 47 | 0 |  |  |  |  |  | return $self->{words}; | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | 1; |