line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::Handler::HTMLFilter; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12843
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
498
|
use namespace::autoclean; |
|
1
|
|
|
|
|
17772
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.38'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
500
|
use Markdent::CapturedEvents; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
69
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
10
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
12
|
1
|
|
|
1
|
|
7152
|
use MooseX::StrictConstructor; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Markdent::Role::FilterHandler'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub filter_event { |
17
|
14
|
|
|
14
|
0
|
28
|
my $self = shift; |
18
|
14
|
|
|
|
|
16
|
my $event = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return |
21
|
14
|
100
|
|
|
|
27
|
if grep { $event->isa( 'Markdent::Event::' . $_ ) } |
|
84
|
|
|
|
|
367
|
|
22
|
|
|
|
|
|
|
qw( |
23
|
|
|
|
|
|
|
HTMLBlock |
24
|
|
|
|
|
|
|
HTMLComment |
25
|
|
|
|
|
|
|
HTMLCommentBlock |
26
|
|
|
|
|
|
|
HTMLTag |
27
|
|
|
|
|
|
|
StartHTMLTag |
28
|
|
|
|
|
|
|
EndHTMLTag |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
10
|
|
|
|
|
341
|
$self->handler()->handle_event($event); |
32
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
398
|
return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
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.38 |
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) 2020 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 |