| 1 | package HTML::Auto::Templates; | ||||||||||
| 2 | 3 | ▶ | use base qw/Template::Provider/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use File::Basename; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | =head1 NAME | ||||||||||
| 10 | |||||||||||
| 11 | HTML::Auto::Templates - this module stores HTML::Auto templates | ||||||||||
| 12 | |||||||||||
| 13 | =head1 VERSION | ||||||||||
| 14 | |||||||||||
| 15 | Version 0.02 | ||||||||||
| 16 | |||||||||||
| 17 | =cut | ||||||||||
| 18 | |||||||||||
| 19 | 3 | our $VERSION = '0.06'; | |||||||||
| 20 | |||||||||||
| 21 | 3 | my $templates = { | |||||||||
| 22 | |||||||||||
| 23 | 'matrix' => <<'EOT' | ||||||||||
| 24 | <style type="text/css"> | ||||||||||
| 25 | span.vertical { | ||||||||||
| 26 | -webkit-transform: rotate(-90deg); | ||||||||||
| 27 | -moz-transform: rotate(-90deg); | ||||||||||
| 28 | writing-mode: tb-rl; | ||||||||||
| 29 | filter: flipv fliph; | ||||||||||
| 30 | display: block; | ||||||||||
| 31 | width: 20px; | ||||||||||
| 32 | white-space: nowrap; | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | table.auto th { | ||||||||||
| 36 | padding-top: 70px; | ||||||||||
| 37 | padding-bottom: 10px; | ||||||||||
| 38 | padding-left: 5px; | ||||||||||
| 39 | padding-right: 5px; | ||||||||||
| 40 | width: 20px; | ||||||||||
| 41 | background-color: #aaaaaa; | ||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | table.auto td { | ||||||||||
| 45 | text-align: center; | ||||||||||
| 46 | width: 30px; | ||||||||||
| 47 | background-color: #eeeeee; | ||||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | table.auto td.fst { | ||||||||||
| 51 | width: 80px; | ||||||||||
| 52 | font-weight: bold; | ||||||||||
| 53 | background-color: #aaaaaa; | ||||||||||
| 54 | padding: 5px; | ||||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | th.empty { | ||||||||||
| 58 | background-color: white !important; | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | table.auto td.mid { | ||||||||||
| 62 | background-color: #cccccc; | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | td:hover { | ||||||||||
| 66 | background-color: #aaaaaa; | ||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | td.more_info { | ||||||||||
| 70 | position:relative; | ||||||||||
| 71 | z-index:24; | ||||||||||
| 72 | text-decoration:none; | ||||||||||
| 73 | cursor: default; | ||||||||||
| 74 | color: black; | ||||||||||
| 75 | width: 80px; | ||||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | td.more_info:hover{ | ||||||||||
| 79 | z-index:25; | ||||||||||
| 80 | } | ||||||||||
| 81 | |||||||||||
| 82 | td.more_info td { | ||||||||||
| 83 | width: auto; | ||||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | td.more_info span { | ||||||||||
| 87 | display: none; | ||||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | td.more_info:hover span { | ||||||||||
| 91 | display:block; | ||||||||||
| 92 | position:absolute; | ||||||||||
| 93 | border:1px solid #ccc; | ||||||||||
| 94 | min-width:24em; | ||||||||||
| 95 | background-color:#fff; | ||||||||||
| 96 | color:#000; | ||||||||||
| 97 | text-align: left; | ||||||||||
| 98 | font-size: 80%; | ||||||||||
| 99 | text-decoration: none; | ||||||||||
| 100 | } | ||||||||||
| 101 | |||||||||||
| 102 | [% IF css %] | ||||||||||
| 103 | [% css %] | ||||||||||
| 104 | [% END %] | ||||||||||
| 105 | </style> | ||||||||||
| 106 | |||||||||||
| 107 | <table class="auto"> | ||||||||||
| 108 | <tr> | ||||||||||
| 109 | <th class="empty"> </th> | ||||||||||
| 110 | [% FOREACH i IN cols %] | ||||||||||
| 111 | <th> <span class="vertical">[% i -%]</span></th> | ||||||||||
| 112 | [% END %] | ||||||||||
| 113 | </tr> | ||||||||||
| 114 | [% i_c = 0 %] | ||||||||||
| 115 | [% FOREACH i IN vals %] | ||||||||||
| 116 | <tr> | ||||||||||
| 117 | <td class="fst">[% lines.shift -%]</td> | ||||||||||
| 118 | [% j_c = 0 %] | ||||||||||
| 119 | [% FOREACH j IN i %] | ||||||||||
| 120 | <td | ||||||||||
| 121 | [% class = "" %] | ||||||||||
| 122 | [% IF i_c == j_c %] | ||||||||||
| 123 | [% class = "mid" %] | ||||||||||
| 124 | [% END %] | ||||||||||
| 125 | [% IF more.$i_c.$j_c %] | ||||||||||
| 126 | [% class = "more_info " _ class %] | ||||||||||
| 127 | [% END %] | ||||||||||
| 128 | [% IF attrs.$i_c.$j_c.class %] | ||||||||||
| 129 | [% class = class _ " " _ attrs.$i_c.$j_c.class %] | ||||||||||
| 130 | [% END %] | ||||||||||
| 131 | [% attrs.$i_c.$j_c.delete('class') %] | ||||||||||
| 132 | [% IF class.length != 0 %] | ||||||||||
| 133 | class="[% class %]" | ||||||||||
| 134 | [% END %] | ||||||||||
| 135 | [% FOREACH att IN attrs.$i_c.$j_c.keys %] | ||||||||||
| 136 | [% att %]="[% attrs.$i_c.$j_c.$att %]" | ||||||||||
| 137 | [% END %] | ||||||||||
| 138 | >[% j %] | ||||||||||
| 139 | [% IF more.$i_c.$j_c %] | ||||||||||
| 140 | <span>[% more.$i_c.$j_c %]</span> | ||||||||||
| 141 | [% END %] | ||||||||||
| 142 | </td> | ||||||||||
| 143 | [% j_c = j_c + 1 %] | ||||||||||
| 144 | [% END %] | ||||||||||
| 145 | </tr> | ||||||||||
| 146 | [% i_c = i_c + 1 %] | ||||||||||
| 147 | [% END %] | ||||||||||
| 148 | </table> | ||||||||||
| 149 | EOT | ||||||||||
| 150 | , | ||||||||||
| 151 | 'h' => <<'EOT' | ||||||||||
| 152 | <div> | ||||||||||
| 153 | [% FOREACH i IN list %] | ||||||||||
| 154 | <div style="float: left;">[% i %]</div> | ||||||||||
| 155 | [% END %] | ||||||||||
| 156 | <span style="clear: both;"></div> | ||||||||||
| 157 | </div> | ||||||||||
| 158 | EOT | ||||||||||
| 159 | , | ||||||||||
| 160 | 'v' => <<'EOT' | ||||||||||
| 161 | [% FOREACH i IN list %] | ||||||||||
| 162 | <div>[% i %]</div> | ||||||||||
| 163 | [% END %] | ||||||||||
| 164 | EOT | ||||||||||
| 165 | |||||||||||
| 166 | }; | ||||||||||
| 167 | |||||||||||
| 168 | =head2 _template_modified | ||||||||||
| 169 | |||||||||||
| 170 | TODO | ||||||||||
| 171 | |||||||||||
| 172 | =cut | ||||||||||
| 173 | |||||||||||
| 174 | sub _template_modified { | ||||||||||
| 175 | 12 | ▶ | my($self,$path) = @_; | ||||||||
|
Subroutine
_template_modified: called CC=1 SCAR=0.0
| |||||||||||
| 176 | |||||||||||
| 177 | 12 | return 1; | |||||||||
| 178 | } | ||||||||||
| 179 | |||||||||||
| 180 | =head2 _template_content | ||||||||||
| 181 | |||||||||||
| 182 | TODO | ||||||||||
| 183 | |||||||||||
| 184 | =cut | ||||||||||
| 185 | |||||||||||
| 186 | sub _template_content { | ||||||||||
| 187 | 4 | ▶ | my ($self, $path) = @_; | ||||||||
|
Subroutine
_template_content: called CC=2 SCAR=7.0
| |||||||||||
| 188 | |||||||||||
| 189 | 4 | $path = basename($path);; | |||||||||
| 190 | 4 | ▶ | $self->debug("get $path") if $self->{DEBUG}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 191 | |||||||||||
| 192 | 4 | my $data = $templates->{$path}; | |||||||||
| 193 | 4 | my $error = "error: $path not found"; | |||||||||
| 194 | 4 | my $mod_date = 1; | |||||||||
| 195 | |||||||||||
| 196 | 4 | return $data; | |||||||||
| 197 | } | ||||||||||
| 198 | |||||||||||
| 199 | |||||||||||
| 200 | =head1 AUTHOR | ||||||||||
| 201 | |||||||||||
| 202 | Nuno Carvalho, C<< <smash at cpan.org> >> | ||||||||||
| 203 | |||||||||||
| 204 | =head1 BUGS | ||||||||||
| 205 | |||||||||||
| 206 | Please report any bugs or feature requests to C<bug-html-auto at rt.cpan.org>, or through | ||||||||||
| 207 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Auto>. I will be notified, and then you'll | ||||||||||
| 208 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 209 | |||||||||||
| 210 | |||||||||||
| 211 | |||||||||||
| 212 | |||||||||||
| 213 | =head1 SUPPORT | ||||||||||
| 214 | |||||||||||
| 215 | You can find documentation for this module with the perldoc command. | ||||||||||
| 216 | |||||||||||
| 217 | perldoc HTML::Auto | ||||||||||
| 218 | |||||||||||
| 219 | |||||||||||
| 220 | You can also look for information at: | ||||||||||
| 221 | |||||||||||
| 222 | =over 4 | ||||||||||
| 223 | |||||||||||
| 224 | =item * RT: CPAN's request tracker | ||||||||||
| 225 | |||||||||||
| 226 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Auto> | ||||||||||
| 227 | |||||||||||
| 228 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 229 | |||||||||||
| 230 | L<http://annocpan.org/dist/HTML-Auto> | ||||||||||
| 231 | |||||||||||
| 232 | =item * CPAN Ratings | ||||||||||
| 233 | |||||||||||
| 234 | L<http://cpanratings.perl.org/d/HTML-Auto> | ||||||||||
| 235 | |||||||||||
| 236 | =item * Search CPAN | ||||||||||
| 237 | |||||||||||
| 238 | L<http://search.cpan.org/dist/HTML-Auto/> | ||||||||||
| 239 | |||||||||||
| 240 | =back | ||||||||||
| 241 | |||||||||||
| 242 | |||||||||||
| 243 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 244 | |||||||||||
| 245 | |||||||||||
| 246 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 247 | |||||||||||
| 248 | Copyright 2012 Project Natura. | ||||||||||
| 249 | |||||||||||
| 250 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 251 | under the terms of either: the GNU General Public License as published | ||||||||||
| 252 | by the Free Software Foundation; or the Artistic License. | ||||||||||
| 253 | |||||||||||
| 254 | See http://dev.perl.org/licenses/ for more information. | ||||||||||
| 255 | |||||||||||
| 256 | |||||||||||
| 257 | =cut | ||||||||||
| 258 | |||||||||||
| 259 | 3 | 1; # End of HTML::Auto | |||||||||