NAME

Tags::HTML::Page::Begin - Tags helper for HTML page begin.

SYNOPSIS

use Tags::HTML::Page::Begin;

my $obj = Tags::HTML::Page::Begin->new(%params);
$obj->process;
$obj->process_css;

METHODS

new

my $obj = Tags::HTML::Stars->new(%params);

Constructor.

  • doctype

    Document doctype string.

    Default value is '<!DOCTYPE html>'.

  • css

    'CSS::Struct::Output' object for process_css processing.

    It's required.

    Default value is undef.

  • lang

    Hash with language information for output. Keys are: 'title'.

    Default value is reference to hash with these value: 'title' => 'Page title'

  • tags

    'Tags::Output' object.

    It's required.

    Default value is undef.

process

$obj->process;

Process Tags structure for output.

Returns undef.

process_css

$obj->process_css;

Process CSS::Struct structure for output. This processing must be before process, because in process is output used.

Returns undef.

ERRORS

new():
        From Class::Utils::set_params():
                Unknown parameter '%s'.

EXAMPLE1

use strict;
use warnings;

use CSS::Struct::Output::Indent;
use Tags::HTML::Page::Begin;
use Tags::HTML::Page::End;
use Tags::Output::Indent;

# Object.
my $tags = Tags::Output::Indent->new(
        'preserved' => ['style'],
);
my $css = CSS::Struct::Output::Indent->new;
my $begin = Tags::HTML::Page::Begin->new(
        'css' => $css,
        'tags' => $tags,
);
my $end = Tags::HTML::Page::End->new(
        'tags' => $tags,
);

# Process page
$begin->process_css;
$begin->process;
$tags->put(
       ['b', 'div'],
       ['d', 'Hello world!'],
       ['e', 'div'],
);
$end->process;

# Print out.
print $tags->flush;

# Output:
# <!DOCTYPE html>
# <html>
#   <head>
#     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
#     </meta>
#     <title>
#       Page title
#     </title>
#     <style type="text/css">
# .okay {
# 	background: #9f9;
# }
# .warning {
# 	background: #ff9;
# }
# .alert {
# 	background: #f99;
# }
# .offline {
# 	color: #999;
# }
# </style>
#   </head>
#   <body>
#     <div>
#       Hello world!
#     </div>
#   </body>
# </html>

DEPENDENCIES

Class::Utils, Error::Pure, List::Utils, MIME::Base64, Readonly.

SEE ALSO

Tags::HTML::Page::End

Tags helper for HTML page end.

REPOSITORY

https://github.com/michal-josef-spacek/Tags-HTML-Page-Begin

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© Michal Josef Špaček 2020

BSD 2-Clause License

VERSION

0.01