Markdent/Handler/HTMLFilter.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 97.3% 37 / 38 CC 2 SCAR 2.2
CC
2
Cov
100%
filter_event
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Markdent/Handler/Multiplexer.pm ↑ Summary Markdent/CapturedEvents.pm »
1 package Markdent::Handler::HTMLFilter;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.39';
8  
9 1 ▶use Markdent::CapturedEvents;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 with 'Markdent::Role::FilterHandler';
15  
16 sub filter_event {
17 14 ▶ my $self = shift;
Subroutine filter_event: called CC=2 SCAR=6.9
Pod undocumented
18 14 my $event = shift;
19  
20 return
21 14 ▶ if grep { $event->isa( 'Markdent::Event::' . $_ ) }
Branch: 1 branch
BranchTrueFalseTotal
if grep {$event->isa('Markdent::Event::' . $_);} "HTMLBlock", "HTMLComment", "HTMLCommentBlock", "HTMLTag", "StartHTMLTag", "EndHTMLTag" 4 10 14
22 qw(
23 HTMLBlock
24 HTMLComment
25 HTMLCommentBlock
26 HTMLTag
27 StartHTMLTag
28 EndHTMLTag
29 );
30  
31 10 $self->handler->handle_event($event);
32  
33 10 return;
34 }
35  
36 1 __PACKAGE__->meta->make_immutable;
37  
38 1 1;
39  
40 # ABSTRACT: Filters out HTML events from the event stream
41  
42 __END__
43  
44 =pod
45  
46 =encoding UTF-8
47  
48 =head1 NAME
49  
50 Markdent::Handler::HTMLFilter - Filters out HTML events from the event stream
51  
52 =head1 VERSION
53  
54 version 0.39
55  
56 =head1 SYNOPSIS
57  
58 my $html = Markdent::Handler::HTMLStream->new( ... );
59  
60 my $filter = Markdent::Handler::HTMLFilter->new( handler => $html );
61  
62 my $parser = Markdent::Parser->new( handler => $filter ):
63  
64 $parser->parse( markdown => ... );
65  
66 =head1 DESCRIPTION
67  
68 This class implements an event filter which drops all HTML events I<except>
69 for HTML entities.
70  
71 =head1 METHODS
72  
73 This class provides the following methods:
74  
75 =head2 Markdent::Handler::HTMLFilter->new
76  
77 This method creates a new handler.
78  
79 =head1 ROLES
80  
81 This class does the L<Markdent::Role::Handler> role.
82  
83 =head1 BUGS
84  
85 See L<Markdent> for bug reporting details.
86  
87 Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>.
88  
89 I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
90  
91 =head1 SOURCE
92  
93 The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>.
94  
95 =head1 AUTHOR
96  
97 Dave Rolsky <autarch@urth.org>
98  
99 =head1 COPYRIGHT AND LICENSE
100  
101 This software is copyright (c) 2021 by Dave Rolsky.
102  
103 This is free software; you can redistribute it and/or modify it under
104 the same terms as the Perl 5 programming language system itself.
105  
106 The full text of the license can be found in the
107 F<LICENSE> file included with this distribution.
108  
109 =cut
« Markdent/Handler/Multiplexer.pm ↑ Summary Markdent/CapturedEvents.pm »