File Coverage

blib/lib/Markdent/Handler/HTMLStream/Fragment.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 22 24 91.6


line stmt bran cond sub pod time code
1             package Markdent::Handler::HTMLStream::Fragment;
2              
3 33     33   287726 use strict;
  33         96  
  33         1212  
4 33     33   257 use warnings;
  33         82  
  33         1229  
5 33     33   779 use namespace::autoclean;
  33         19396  
  33         311  
6              
7             our $VERSION = '0.40';
8              
9 33     33   5505 use Moose;
  33         1557249  
  33         292  
10 33     33   256100 use MooseX::SemiAffordanceAccessor;
  33         43587  
  33         309  
11              
12             with 'Markdent::Role::HTMLStream';
13              
14       4 0   sub start_document { }
15       2 0   sub end_document { }
16              
17             __PACKAGE__->meta->make_immutable;
18              
19             1;
20              
21             # ABSTRACT: Turns Markdent events into an HTML fragment
22              
23             __END__
24              
25             =pod
26              
27             =encoding UTF-8
28              
29             =head1 NAME
30              
31             Markdent::Handler::HTMLStream::Fragment - Turns Markdent events into an HTML fragment
32              
33             =head1 VERSION
34              
35             version 0.40
36              
37             =head1 DESCRIPTION
38              
39             This class takes an event stream and turns it into an HTML document, without a
40             doctype, C<< <html> >>, C<< <head> >> or C<< <body> >> tags.
41              
42             =head1 METHODS
43              
44             This role provides the following methods:
45              
46             =head2 Markdent::Handler::HTMLStream::Document->new(...)
47              
48             This method creates a new handler. It accepts the following parameters:
49              
50             =over 4
51              
52             =item * output => $fh
53              
54             The file handle or object to which HTML output will be streamed. If you want to
55             capture the output in a string, you can open a filehandle to a string:
56              
57             my $buffer = q{};
58             open my $fh, '>', \$buffer;
59              
60             If you pass a file handle (or L<IO::Handle> object), then all calls to
61             C<print()> will be checked, and an error will be thrown.
62              
63             You can pass an object of any other class, it must implement its own C<print()>
64             method, and error handling is left up to this method.
65              
66             =back
67              
68             =head1 ROLES
69              
70             This class does the L<Markdent::Role::HTMLStream>,
71             L<Markdent::Role::EventsAsMethods>, and L<Markdent::Role::Handler> roles.
72              
73             =head1 BUGS
74              
75             See L<Markdent> for bug reporting details.
76              
77             Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>.
78              
79             I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
80              
81             =head1 SOURCE
82              
83             The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>.
84              
85             =head1 AUTHOR
86              
87             Dave Rolsky <autarch@urth.org>
88              
89             =head1 COPYRIGHT AND LICENSE
90              
91             This software is copyright (c) 2021 by Dave Rolsky.
92              
93             This is free software; you can redistribute it and/or modify it under
94             the same terms as the Perl 5 programming language system itself.
95              
96             The full text of the license can be found in the
97             F<LICENSE> file included with this distribution.
98              
99             =cut