NAME
Tags::HTML::Page::Begin - Tags helper for HTML page begin.
SYNOPSIS
METHODS
new
my
$obj
= Tags::HTML::Page::Begin->new(
%params
);
Constructor.
application-name
Application name.
Default name is undef.
author
Author name.
Default value is undef.
base_href
Base link (<base href="https://skim.cz" />.
Default value is undef.
base_target
Base target. It's used in if 'base_href' parameter exists.
Default value is undef.
css
'CSS::Struct::Output' object for process_css processing.
Default value is undef.
css_init
Initialization of CSS.
Default value is:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
CSS is handled by
_process_css()
method in this module, which is abstract method of Tags::HTML.css_src
List of CSS link structures.
Structure is something like:
{
'link'
=>
'/foo.css'
,
'media'
=>
'screen'
,
}
Default value is [].
charset
Document character set.
Parameter is required.
Default value is 'UTF-8'.
description
Document description.
Default value is undef.
doctype
Document doctype string.
Default value is '<!DOCTYPE html>'.
favicon
Favorite icon image link. Supported images are 'ICO', 'PNG', 'GIF', 'SVG' and 'JPG' files.
Default value is undef.
generator
Generator value.
Default value is 'Perl module: Tags::HTML::Page::Begin, Version: __MODULE_VERSION__'.
html_lang
HTML element lang attribute. Creates html element in form: <html lang="en">
Default value is 'en'.
http_equiv_content_type
http-equiv content-type meta element. If defined creates meta in form: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> Unless defined creates meta in form: <meta charset="UTF-8" />
Defaut value is 'text/html'.
keywords
Document keywords.
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'
refresh
Page refresh time in seconds.
Default value is undef.
robots
Robots meta.
Default value is undef.
rss
RSS link.
Default value is undef.
script_js
List of JavaScript scripts.
Default value is reference to blank array.
script_js_src
List of JavaScript links.
Default value is reference to blank array.
tags
'Tags::Output' object.
It's required.
Default value is undef.
viewport
Document viewport.
It's optional.
Default value is 'width=device-width, initial-scale=1.0'.
process
$obj
->process;
Process Tags structure for output.
Returns undef.
ERRORS
new():
Parameter
'css'
must be a
'CSS::Struct::Output::*'
class.
Parameter
'css_src'
must be a array.
Parameter
'css_src'
must be a array of hash structures.
Parameter
'charset'
is required.
Parameter
'script_js'
must be a array.
Parameter
'script_js_src'
must be a array.
Parameter
'tags'
must be a
'Tags::Output::*'
class.
From Class::Utils::set_params():
Unknown parameter
'%s'
.
EXAMPLE1
use
strict;
use
warnings;
use
Tags::Output::Indent;
# Object.
my
$tags
= Tags::Output::Indent->new(
'preserved'
=> [
'style'
],
'xml'
=> 1,
);
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;
$css
->put(
[
's'
,
'div'
],
[
'd'
,
'color'
,
'red'
],
[
'd'
,
'background-color'
,
'black'
],
[
'e'
],
);
$begin
->process;
$tags
->put(
[
'b'
,
'div'
],
[
'd'
,
'Hello world!'
],
[
'e'
,
'div'
],
);
$end
->process;
# Print out.
$tags
->flush;
# Output like:
# <!DOCTYPE html>
# <html lang="en">
# <head>
# <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
# <meta name="generator" content=
# "Perl module: Tags::HTML::Page::Begin, Version: 0.16" />
# <meta name="viewport" content="width=device-width, initial-scale=1.0" />
# <title>
# Page title
# </title>
# <style type="text/css">
# * {
# box-sizing: border-box;
# margin: 0;
# padding: 0;
# }
# div {
# color: red;
# background-color: black;
# }
# </style>
# </head>
# <body>
# <div>
# Hello world!
# </div>
# </body>
# </html>
DEPENDENCIES
Class::Utils, Error::Pure, List::Util, Readonly, Tags::HTML.
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
LICENSE AND COPYRIGHT
© Michal Josef Špaček 2020-2024
BSD 2-Clause License
VERSION
0.17