| 1 | package Template::Caribou::Tags::HTML; | ||
| 2 | 4 | our $AUTHORITY = 'cpan:YANICK'; | |
| 3 | # ABSTRACT: Basic HTML tag library | ||
| 4 | 4 | $Template::Caribou::Tags::HTML::VERSION = '1.1.0'; | |
| 5 | |||
| 6 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 4 | ▶ | use parent 'Exporter::Tiny'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 4 | our @EXPORT; | |
| 12 | 4 | our @UNFORMATED_TAGS; | |
| 13 | 4 | our @FORMATED_TAGS; | |
| 14 | |||
| 15 | BEGIN { | ||
| 16 | 4 | ▶ | @UNFORMATED_TAGS = qw/ i emphasis b strong span small sup /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 4 | @FORMATED_TAGS = qw/ | |
| 18 | p html head h1 h2 h3 h4 h5 h6 body div | ||
| 19 | style title li ol ul a | ||
| 20 | label link img section article | ||
| 21 | table thead tbody th td | ||
| 22 | fieldset legend form input select option button | ||
| 23 | textarea | ||
| 24 | /; | ||
| 25 | } | ||
| 26 | |||
| 27 | BEGIN { | ||
| 28 | |||
| 29 | 4 | ▶ | @EXPORT = @Template::Caribou::Tags::HTML::TAGS = ( @UNFORMATED_TAGS, @FORMATED_TAGS ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 4 | push @EXPORT, 'table_row'; | |
| 31 | } | ||
| 32 | |||
| 33 | use Template::Caribou::Tags | ||
| 34 | mytag => { -as => 'table_row', tag => 'tr' }, | ||
| 35 | 140 | ( map { ( mytag => { -as => $_, tag => $_ } ) } @FORMATED_TAGS ), | |
| 36 | 4 | ▶ | ( map { ( mytag => { -as => $_, tag => $_, indent => 0 } ) } @UNFORMATED_TAGS ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | |||
| 38 | 4 | 1; | |
| 39 | |||
| 40 | __END__ | ||
| 41 | |||
| 42 | =pod | ||
| 43 | |||
| 44 | =encoding UTF-8 | ||
| 45 | |||
| 46 | =head1 NAME | ||
| 47 | |||
| 48 | Template::Caribou::Tags::HTML - Basic HTML tag library | ||
| 49 | |||
| 50 | =head1 VERSION | ||
| 51 | |||
| 52 | version 1.1.0 | ||
| 53 | |||
| 54 | =head1 SYNOPSIS | ||
| 55 | |||
| 56 | package MyTemplate; | ||
| 57 | |||
| 58 | use Template::Caribou; | ||
| 59 | |||
| 60 | use Template::Caribou::Tags::HTML; | ||
| 61 | |||
| 62 | template main => sub { | ||
| 63 | html { | ||
| 64 | head { title { "Website X" } }; | ||
| 65 | body { | ||
| 66 | h1 { "Some Title" }; | ||
| 67 | div { | ||
| 68 | "Blah blah"; | ||
| 69 | }; | ||
| 70 | }; | ||
| 71 | }; | ||
| 72 | }; | ||
| 73 | |||
| 74 | =head1 DESCRIPTION | ||
| 75 | |||
| 76 | Exports tag blocks for regular HTML tags. | ||
| 77 | |||
| 78 | =head1 TAG FUNCTIONS EXPORTED | ||
| 79 | |||
| 80 | p html head h1 h2 h3 h4 h5 h6 body emphasis div sup style title span li ol ul i b strong a label link img section article table thead tbody th td table_row fieldset legend form input select option button small textarea | ||
| 81 | |||
| 82 | All function names are the same than their tag name, except for C<table_row>, which is for C<tr> (which is an already taken Perl keyword). | ||
| 83 | |||
| 84 | =head1 AUTHOR | ||
| 85 | |||
| 86 | Yanick Champoux <yanick@cpan.org> | ||
| 87 | |||
| 88 | =head1 COPYRIGHT AND LICENSE | ||
| 89 | |||
| 90 | This software is copyright (c) 2017 by Yanick Champoux. | ||
| 91 | |||
| 92 | This is free software; you can redistribute it and/or modify it under | ||
| 93 | the same terms as the Perl 5 programming language system itself. | ||
| 94 | |||
| 95 | =cut | ||