| 1 | package Markdent::Handler::HTMLStream::Document; | ||||||||||
| 2 | |||||||||||
| 3 | 31 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 31 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 31 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 31 | our $VERSION = '0.41'; | |||||||||
| 8 | |||||||||||
| 9 | 31 | ▶ | use Markdent::Types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 31 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 31 | ▶ | use MooseX::SemiAffordanceAccessor; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 31 | with 'Markdent::Role::HTMLStream'; | |||||||||
| 15 | |||||||||||
| 16 | 31 | has title => ( | |||||||||
| 17 | is => 'ro', | ||||||||||
| 18 | isa => t('Str'), | ||||||||||
| 19 | required => 1, | ||||||||||
| 20 | ); | ||||||||||
| 21 | |||||||||||
| 22 | 31 | has charset => ( | |||||||||
| 23 | is => 'ro', | ||||||||||
| 24 | isa => t('Str'), | ||||||||||
| 25 | predicate => '_has_charset', | ||||||||||
| 26 | ); | ||||||||||
| 27 | |||||||||||
| 28 | 31 | has language => ( | |||||||||
| 29 | is => 'ro', | ||||||||||
| 30 | isa => t('Str'), | ||||||||||
| 31 | predicate => '_has_language', | ||||||||||
| 32 | ); | ||||||||||
| 33 | |||||||||||
| 34 | 31 | my $Doctype = <<'EOF'; | |||||||||
| 35 | <!DOCTYPE html> | ||||||||||
| 36 | EOF | ||||||||||
| 37 | |||||||||||
| 38 | 1 | ▶ | sub start_document { | ||||||||
|
Subroutine
start_document: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||
| 39 | 1 | my $self = shift; | |||||||||
| 40 | |||||||||||
| 41 | 1 | $self->_stream_raw($Doctype); | |||||||||
| 42 | 1 | ▶ | $self->_stream_start_tag( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 'html', { | ||||||||||
| 44 | $self->_has_language ? ( lang => $self->language ) : (), | ||||||||||
| 45 | }, | ||||||||||
| 46 | ); | ||||||||||
| 47 | 1 | $self->_stream_start_tag('head'); | |||||||||
| 48 | 1 | ▶ | $self->_stream_start_tag( 'meta', { charset => $self->charset } ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | if $self->_has_charset; | ||||||||||
| 50 | 1 | $self->_stream_start_tag('title'); | |||||||||
| 51 | 1 | $self->_stream_text( $self->title ); | |||||||||
| 52 | 1 | $self->_stream_end_tag('title'); | |||||||||
| 53 | 1 | $self->_stream_end_tag('head'); | |||||||||
| 54 | 1 | $self->_stream_start_tag('body'); | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 1 | ▶ | sub end_document { | ||||||||
|
Subroutine
end_document: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 58 | 1 | my $self = shift; | |||||||||
| 59 | |||||||||||
| 60 | 1 | $self->_stream_end_tag('body'); | |||||||||
| 61 | 1 | $self->_stream_end_tag('html'); | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 31 | __PACKAGE__->meta->make_immutable; | |||||||||
| 65 | |||||||||||
| 66 | 31 | 1; | |||||||||
| 67 | |||||||||||
| 68 | # ABSTRACT: Turns Markdent events into a complete HTML document | ||||||||||
| 69 | |||||||||||
| 70 | __END__ | ||||||||||