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