-
-
02 Apr 2017 17:56:28 UTC
- Distribution: Template-Caribou
- Module version: v1.2.1
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (3)
- Testers (407 / 1 / 55)
- Kwalitee
Bus factor: 1- 86.00% Coverage
- License: perl_5
- Perl: v5.20.0
- Activity
24 month- Tools
- Download (37.1KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Carp
- Class::Load
- Exporter::Tiny
- List::AllUtils
- Module::Runtime
- Moose::Exporter
- Moose::Role
- Moose::Util
- MooseX::Role::Parameterized
- Path::Tiny
- Ref::Util
- Text::MultiMarkdown
- Tie::Handle
- Try::Tiny
- XML::Writer
- experimental
- overload
- parent
- strict
- warnings
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Template::Caribou::Tags::HTML::Extended - custom HTML tags optimized for DWIMery
VERSION
version 1.2.1
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
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 $type
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.
favicon $url
Generates a favicon link tag.
favicon 'my_icon.png'; # <link rel="shortcut icon" href="my_icon.png" />
submit $value, %attr
submit 'foo'; # <input type="submit" value="foo" />
Shortcut for
input { attr type => submit, value => $value, %attr; }
less $script
Compiles the LESS script into CSS. Requires CSS::LESSp.
javascript $script
javascript q{ console.log( "Hello there!" ) }; # <script type="text/javascript">console.log( "Hello there!" )</script>
Shortcut for
<script type="text/javascript>$script</script>
javascript_include $url
Shortcut for
<script type="text/javascript" src="http://..."> </script>
css_include $url, %args
css_include 'public/bootstrap/css/bootstrap.min.css', media => 'screen'; # <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
image 'kitten.jpg'; # <img src="kitten.jpg" />
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) 2017 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.
Module Install Instructions
To install Template::Caribou, copy and paste the appropriate command in to your terminal.
cpanm Template::Caribou
perl -MCPAN -e shell install Template::Caribou
For more information on module installation, please visit the detailed CPAN module installation guide.