Yanick Champoux > Template-Caribou-0.2.2 > Template::Caribou::Tags::HTML::Extended

Download:
Template-Caribou-0.2.2.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: v0.2.2   Source   Latest Release: Template-Caribou-0.2.4

NAME ^

Template::Caribou::Tags::HTML::Extended - custom HTML tags optimized for DWIMery

VERSION ^

version 0.2.2

SYNOPSIS ^

    package MyTemplate;

    use Moose;

    use Template::Caribou::Tags::HTML;
    use Template::Caribou::Tags::HTML::Extended;

    with 'Template::Caribou';

    template 'page' => sub {
        html {
            head { 
                css q{
                    color: magenta;
                };
            };
            body {
                markdown q{Ain't Markdown **grand**?};
                
                anchor "http://foo.com" => sub {
                    image 'http://foo.com/bar.jpg', alt => 'Foo logo';
                };
            }

        }
    };

DESCRIPTION ^

Template::Caribou::Tags::HTML::Extended provides utility tags that provides shortcuts for typical HTML constructs.

doctype $type

Prints the doctype declaration for the given type.

For the moment, only html 5 is supported as a type.

favicon $url

Generates the favicon tag.

    favicon 'my_icon.png';

will generates

    <link rel="shortcut icon" href="my_icon.png" />

submit $value, %attr

Shortcut for

    input { attr type => submit, value => 'value', %attr; }

If you don't want value to be passed, the first argument might be set to undef.

less $script

Compile the LESS script into CSS.

javascript $script

Shortcut for

    <script type="text/javascript>$script</script>

javascript_include $url

Shortcut for

    <script type="text/javascript" src="http://..."> </script>

css_include <link href="public/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen" />

css $text

Wraps the $text in a style element.

    <style type="text/css">$text</style>

anchor $url, $inner

Shortcut for <a>. $inner can be either a string, or a subref.

    anchor 'http://foo.com' => 'linkie';

is equivalent to

    a {
        attr href => 'http://foo.com';
        'linkie';
    }

image $src, @attr

Shortcut for <img>.

markdown $text

Converts the markdown $text into its html equivalent.

Uses Text::MultiMarkdown.

AUTHOR ^

Yanick Champoux <yanick@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Yanick Champoux.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: