HTML-Auto-0.06/000755 000765 000024 00000000000 12621176412 013040 5ustar00nrcstaff000000 000000 HTML-Auto-0.06/Changes000644 000765 000024 00000001471 12621176311 014334 0ustar00nrcstaff000000 000000 Revision history for HTML-Auto 0.06 Thu Nov 12 20:55:02 WET 2015 Handle paths correctly in Windows too (reported by CHORNY). 0.05 Sun Nov 8 17:27:23 WET 2015 Fix tests to run in recent perl releases (reported by SREZIC). 0.04 Tue Jun 5 16:02:52 WEST 2012 Fixed UTF-8 in POD 0.03 Tue May 22 22:50:31 WEST 2012 Cells can have a hover pop-up. Additional CSS can be provided. Added some tests. 0.02 Sat Apr 21 14:53:52 WEST 2012 Update docs. 0.01 Sun Sep 25 16:45:04 WEST 2011 First version. 0.01_3 Tue Sep 20 23:24:32 WEST 2011 Matrix elements may be scalars. 0.01_2 Sun Jan 30 13:58:32 WET 2011 Fix makefile dependencies. 0.01_1 Fri Jan 28 14:11:09 WET 2011 First devel release. HTML-Auto-0.06/lib/000755 000765 000024 00000000000 12621176412 013606 5ustar00nrcstaff000000 000000 HTML-Auto-0.06/Makefile.PL000644 000765 000024 00000001166 12621175602 015016 0ustar00nrcstaff000000 000000 use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'HTML::Auto', AUTHOR => q{Nuno Carvalho }, VERSION_FROM => 'lib/HTML/Auto.pm', ABSTRACT_FROM => 'lib/HTML/Auto.pm', ($ExtUtils::MakeMaker::VERSION >= 6.3002 ? ('LICENSE'=> 'perl') : ()), PL_FILES => {}, PREREQ_PM => { 'File::Basename' => 0, 'Test::More' => 0, 'Template' => 0 }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'HTML-Auto-*' }, ); HTML-Auto-0.06/MANIFEST000644 000765 000024 00000000467 12621176412 014200 0ustar00nrcstaff000000 000000 Changes MANIFEST Makefile.PL README lib/HTML/Auto.pm lib/HTML/Auto/Templates.pm t/00-load.t t/01-basic.t t/manifest.t t/pod-coverage.t t/pod.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) HTML-Auto-0.06/META.json000644 000765 000024 00000001664 12621176412 014470 0ustar00nrcstaff000000 000000 { "abstract" : "automatic write HTML for common elements", "author" : [ "Nuno Carvalho " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.143240", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "HTML-Auto", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "File::Basename" : "0", "Template" : "0", "Test::More" : "0" } } }, "release_status" : "stable", "version" : "0.06" } HTML-Auto-0.06/META.yml000644 000765 000024 00000001036 12621176412 014311 0ustar00nrcstaff000000 000000 --- abstract: 'automatic write HTML for common elements' author: - 'Nuno Carvalho ' build_requires: ExtUtils::MakeMaker: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.143240' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: HTML-Auto no_index: directory: - t - inc requires: File::Basename: '0' Template: '0' Test::More: '0' version: '0.06' HTML-Auto-0.06/README000644 000765 000024 00000001374 12534333615 013730 0ustar00nrcstaff000000 000000 HTML-Auto This module attempts to provide easy access to some typical structures used in HTML, for example matrices. The module is still in heavy development. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc HTML::Auto You can also look for information at: RT, CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Auto AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/HTML-Auto CPAN Ratings http://cpanratings.perl.org/d/HTML-Auto Search CPAN http://search.cpan.org/dist/HTML-Auto/ HTML-Auto-0.06/t/000755 000765 000024 00000000000 12621176412 013303 5ustar00nrcstaff000000 000000 HTML-Auto-0.06/t/00-load.t000644 000765 000024 00000000245 11520547366 014634 0ustar00nrcstaff000000 000000 #!perl -T use Test::More tests => 1; BEGIN { use_ok( 'HTML::Auto' ) || print "Bail out! "; } diag( "Testing HTML::Auto $HTML::Auto::VERSION, Perl $], $^X" ); HTML-Auto-0.06/t/01-basic.t000644 000765 000024 00000007075 12617702564 015010 0ustar00nrcstaff000000 000000 #!perl -T use Test::More tests => 4; use HTML::Auto qw/matrix h v/; use Data::Dumper; my $tests = { 'simple h test' => { test => "h('l','r')", gold => '
l
r
' }, 'simple v test' => { test => "v('u','d')", gold => '
u
d
' }, 'simple matrix test' => { test => 'matrix([qw/c1 c2/],[qw/l1 l2/],[ [1,0], [0,1] ])', gold => '
C1 C2
L1 1 0
L2 0 1
' }, 'matrix with pop-up test' => { test => 'matrix([qw/c1 c2/],[qw/l1 l2/], [ [1,2], [3, { v=> 4, more_info => "This is a pop-up!" }]])', gold => '
C1 C2
L1 1 2
L2 3 4 This is a pop-up!
', }, }; foreach (keys %$tests) { ok(run($tests->{$_}->{test}) eq $tests->{$_}->{gold}, $_); } sub run { clean(eval $_[0]); } sub clean { my ($str) = @_; $str =~ s/^\s+|\s+$//sg; $str =~ s/\s+/ /sg; return $str; } HTML-Auto-0.06/t/manifest.t000644 000765 000024 00000000420 11474043110 015263 0ustar00nrcstaff000000 000000 #!perl -T use strict; use warnings; use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } eval "use Test::CheckManifest 0.9"; plan skip_all => "Test::CheckManifest 0.9 required" if $@; ok_manifest(); HTML-Auto-0.06/t/pod-coverage.t000644 000765 000024 00000001047 11474043110 016036 0ustar00nrcstaff000000 000000 use strict; use warnings; use Test::More; # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); HTML-Auto-0.06/t/pod.t000644 000765 000024 00000000350 11474043110 014241 0ustar00nrcstaff000000 000000 #!perl -T use strict; use warnings; use Test::More; # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); HTML-Auto-0.06/lib/HTML/000755 000765 000024 00000000000 12621176412 014352 5ustar00nrcstaff000000 000000 HTML-Auto-0.06/lib/HTML/Auto/000755 000765 000024 00000000000 12621176412 015262 5ustar00nrcstaff000000 000000 HTML-Auto-0.06/lib/HTML/Auto.pm000644 000765 000024 00000011027 12621176331 015621 0ustar00nrcstaff000000 000000 package HTML::Auto; use warnings; use strict; use Template; use HTML::Auto::Templates; use Data::Dumper; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(matrix h v); =encoding utf-8 =head1 NAME HTML::Auto - automatic write HTML for common elements =head1 VERSION Version 0.06 =cut our $VERSION = '0.06'; =head1 SYNOPSIS Simple example: use HTML::Auto qw/matrix h v/; my @cols = qw/c1 c2 c3 c4 c5/; my @lines = qw/l1 l2 l3 l4 l5/; my $data = [ [1,2,3,4,5], [6,7,8,9,0], [1,1,1,1,1], [2,2,2,2,2], [3,3,3,3,3] ]; my $m = matrix(\@cols,\@lines,$data); print v( h($m,$m,$m), h($m,$m), ); Using attributes: use HTML::Auto qw/matrix h v/; my @cols = qw/c1 c2/; my @lines = qw/l1 l2/; my $data = [ [ {v => 1, a => { style => 'background: green'}}, 2 ], [ {v => 3, a => {class => 'foo'}}, {v => 4, a => {style => 'color: red'}} ] ]; my $m = matrix(\@cols,\@lines,$data); print v( h($m) ); With mouse-over span: use HTML::Auto qw/matrix h v/; my @cols = qw/c1 c2/; my @lines = qw/l1 l2/; my $data = [[1,2], [3, { v=> 4, more_info => "This is a pop-up!" }] ]; my $m = matrix(\@cols,\@lines,$data); print v( h($m) ); Passing additional CSS: use HTML::Auto qw/matrix h v/; my @cols = qw/c1 c2/; my @lines = qw/l1 l2/; my $data = [ [ {v => 1, a => { class => 'warn'}}, 2 ], [3,4] ]; my $options = { css => '.warn { background-color: yellow !important; }' }; my $m = matrix(\@cols,\@lines,$data,$options); print v( h($m) ); =head1 SUBROUTINES/METHODS =head2 matrix =cut sub matrix { my ($cols,$lines,$data,$options) = @_; # pre-process data foreach (@$cols) { $_ = ucfirst($_); } foreach (@$lines) { $_ = ucfirst($_); } my $vals = []; my $attrs = []; my $more = []; foreach my $row (@$data){ my $vrow = []; my $arow = []; my $mrow = []; foreach(@$row){ if (ref($_)){ push @$vrow, $_->{v}; push @$arow, $_->{a}; push @$mrow, $_->{more_info}; } else { push @$vrow, $_; push @$arow, undef; push @$mrow, undef; } } push @$vals, $vrow; push @$attrs, $arow; push @$more, $mrow; } my $vars = { cols => $cols, lines => $lines, vals => $vals, attrs => $attrs, more => $more, }; $vars->{css} = $options->{css} if $options->{css}; my $template_name = 'matrix'; __process($template_name, $vars); } =head2 h A function to allow horizontal composition. =cut sub h { my (@list) = @_; my $vars = { list => [@list], }; my $template_name = 'h'; __process($template_name, $vars); } =head2 v A function to allow vertical composition. =cut sub v { my (@list) = @_; my $vars = { list => [@list], }; my $template_name = 'v'; __process($template_name, $vars); } sub __process { my ($template_name,$vars) = @_; # build html from template my $template_config = { INCLUDE_PATH => [ 'templates' ], }; my $template = Template->new({ LOAD_TEMPLATES => [ HTML::Auto::Templates->new($template_config) ], }); my $html; $template->process($template_name, $vars, \$html); $html; } =head1 AUTHOR Nuno Carvalho, C<< >> André Santos, C<< >> =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc HTML::Auto You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS =head1 LICENSE AND COPYRIGHT Copyright 2012 Project Natura. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of HTML::Auto HTML-Auto-0.06/lib/HTML/Auto/Templates.pm000644 000765 000024 00000010372 12621176350 017562 0ustar00nrcstaff000000 000000 package HTML::Auto::Templates; use base qw/Template::Provider/; use warnings; use strict; use File::Basename; =head1 NAME HTML::Auto::Templates - this module stores HTML::Auto templates =head1 VERSION Version 0.02 =cut our $VERSION = '0.06'; my $templates = { 'matrix' => <<'EOT' [% FOREACH i IN cols %] [% END %] [% i_c = 0 %] [% FOREACH i IN vals %] [% j_c = 0 %] [% FOREACH j IN i %] [% j_c = j_c + 1 %] [% END %] [% i_c = i_c + 1 %] [% END %]
[% i -%]
[% lines.shift -%][% j %] [% IF more.$i_c.$j_c %] [% more.$i_c.$j_c %] [% END %]
EOT , 'h' => <<'EOT'
[% FOREACH i IN list %]
[% i %]
[% END %]
EOT , 'v' => <<'EOT' [% FOREACH i IN list %]
[% i %]
[% END %] EOT }; =head2 _template_modified TODO =cut sub _template_modified { my($self,$path) = @_; return 1; } =head2 _template_content TODO =cut sub _template_content { my ($self, $path) = @_; $path = basename($path);; $self->debug("get $path") if $self->{DEBUG}; my $data = $templates->{$path}; my $error = "error: $path not found"; my $mod_date = 1; return $data; } =head1 AUTHOR Nuno Carvalho, C<< >> =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc HTML::Auto You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS =head1 LICENSE AND COPYRIGHT Copyright 2012 Project Natura. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of HTML::Auto