Template::Caribou::Tags::HTML::Extended - custom HTML tags optimized for DWIMery
version 1.2.2
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'; }; } } };
Whereas Template::Caribou::Tags::HTML offers straight function equivalents to their HTML tags, this module provides a more DWIM interface, and shortcut for often used patterns.
doctype 'html5'; # <!DOCTYPE html>
Prints the doctype declaration for the given type.
For the moment, only html 5 (or html5) is supported as a type.
Generates a favicon link tag.
favicon 'my_icon.png'; # <link rel="shortcut icon" href="my_icon.png" />
submit 'foo'; # <input type="submit" value="foo" />
Shortcut for
input { attr type => submit, value => $value, %attr; }
Compiles the LESS script into CSS. Requires CSS::LESSp.
javascript q{ console.log( "Hello there!" ) }; # <script type="text/javascript">console.log( "Hello there!" )</script>
<script type="text/javascript>$script</script>
<script type="text/javascript" src="http://..."> </script>
css_include 'public/bootstrap/css/bootstrap.min.css', media => 'screen'; # <link href="public/bootstrap/css/bootstrap.min.css" rel="stylesheet" # media="screen" />
Wraps the $text in a style element.
<style type="text/css">$text</style>
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 'kitten.jpg'; # <img src="kitten.jpg" />
Shortcut for <img>.
Converts the markdown $text into its html equivalent.
Uses Text::MultiMarkdown.
Yanick Champoux <yanick@cpan.org>
This software is copyright (c) 2023 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.
To install Template::Caribou, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Caribou
CPAN shell
perl -MCPAN -e shell install Template::Caribou
For more information on module installation, please visit the detailed CPAN module installation guide.