Import upstream version 1.0.6+git20120221.1.2eb33ac
Debian Janitor
1 year, 4 months ago
15 | 15 | 'Module::Pluggable' => 0, |
16 | 16 | 'Scalar::Util' => 0, |
17 | 17 | 'Carp' => 0, |
18 | 'version' => 0, | |
19 | 18 | 'Template' => 0, |
20 | 19 | 'Cwd' => 0, |
21 | 20 | }, |
21 | configure_requires => { 'Module::Build' => 0 }, | |
22 | 22 | build_requires => { |
23 | 23 | 'Test::More' => 0, |
24 | 24 | 'Test::NoWarnings' => 0, |
0 | 0 | Revision history for LaTeX-Table |
1 | 1 | |
2 | 1.1 Tue Feb 21 2012 | |
3 | - Removed version dependency | |
4 | - Allowed undef values in data and header (thanks Dan, closes #75203) | |
5 | ||
2 | 6 | 1.0.6 Mon Oct 25 2010 |
3 | 7 | - eor option (thanks Jens) |
4 | 8 | - POD: Ascii tables of classic themes. |
0 | { | |
1 | "abstract" : "Perl extension for the automatic generation of LaTeX tables.", | |
2 | "author" : [ | |
3 | "<limaone@cpan.org>" | |
4 | ], | |
5 | "dynamic_config" : 1, | |
6 | "generated_by" : "Module::Build version 0.4231", | |
7 | "license" : [ | |
8 | "perl_5" | |
9 | ], | |
10 | "meta-spec" : { | |
11 | "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", | |
12 | "version" : 2 | |
13 | }, | |
14 | "name" : "LaTeX-Table", | |
15 | "prereqs" : { | |
16 | "build" : { | |
17 | "requires" : { | |
18 | "File::Spec" : "0", | |
19 | "Test::More" : "0", | |
20 | "Test::NoWarnings" : "0" | |
21 | } | |
22 | }, | |
23 | "configure" : { | |
24 | "requires" : { | |
25 | "Module::Build" : "0" | |
26 | } | |
27 | }, | |
28 | "runtime" : { | |
29 | "recommends" : { | |
30 | "Getopt::Long" : "0", | |
31 | "LaTeX::Driver" : "0", | |
32 | "LaTeX::Encode" : "0", | |
33 | "Number::Format" : "0", | |
34 | "Text::CSV" : "0", | |
35 | "autodie" : "0" | |
36 | }, | |
37 | "requires" : { | |
38 | "Carp" : "0", | |
39 | "Cwd" : "0", | |
40 | "English" : "0", | |
41 | "Module::Pluggable" : "0", | |
42 | "Moose" : "0.76", | |
43 | "MooseX::FollowPBP" : "0.03", | |
44 | "Scalar::Util" : "0", | |
45 | "Template" : "0", | |
46 | "perl" : "v5.8.0" | |
47 | } | |
48 | } | |
49 | }, | |
50 | "provides" : { | |
51 | "LaTeX::Table" : { | |
52 | "file" : "lib/LaTeX/Table.pm", | |
53 | "version" : "1.1" | |
54 | }, | |
55 | "LaTeX::Table::Themes::Beamer" : { | |
56 | "file" : "lib/LaTeX/Table/Themes/Beamer.pm", | |
57 | "version" : "1.1" | |
58 | }, | |
59 | "LaTeX::Table::Themes::Booktabs" : { | |
60 | "file" : "lib/LaTeX/Table/Themes/Booktabs.pm", | |
61 | "version" : "1.1" | |
62 | }, | |
63 | "LaTeX::Table::Themes::Classic" : { | |
64 | "file" : "lib/LaTeX/Table/Themes/Classic.pm", | |
65 | "version" : "1.1" | |
66 | }, | |
67 | "LaTeX::Table::Themes::Modern" : { | |
68 | "file" : "lib/LaTeX/Table/Themes/Modern.pm", | |
69 | "version" : "1.1" | |
70 | }, | |
71 | "LaTeX::Table::Themes::ThemeI" : { | |
72 | "file" : "lib/LaTeX/Table/Themes/ThemeI.pm", | |
73 | "version" : "1.1" | |
74 | }, | |
75 | "LaTeX::Table::Types::Ctable" : { | |
76 | "file" : "lib/LaTeX/Table/Types/Ctable.pm", | |
77 | "version" : "1.1" | |
78 | }, | |
79 | "LaTeX::Table::Types::Longtable" : { | |
80 | "file" : "lib/LaTeX/Table/Types/Longtable.pm", | |
81 | "version" : "1.1" | |
82 | }, | |
83 | "LaTeX::Table::Types::Std" : { | |
84 | "file" : "lib/LaTeX/Table/Types/Std.pm", | |
85 | "version" : "1.1" | |
86 | }, | |
87 | "LaTeX::Table::Types::TypeI" : { | |
88 | "file" : "lib/LaTeX/Table/Types/TypeI.pm", | |
89 | "version" : "1.1" | |
90 | }, | |
91 | "LaTeX::Table::Types::Xtab" : { | |
92 | "file" : "lib/LaTeX/Table/Types/Xtab.pm", | |
93 | "version" : "1.1" | |
94 | } | |
95 | }, | |
96 | "release_status" : "stable", | |
97 | "resources" : { | |
98 | "license" : [ | |
99 | "http://dev.perl.org/licenses/" | |
100 | ], | |
101 | "repository" : { | |
102 | "url" : "http://github.com/lima1/p5-latex-table" | |
103 | } | |
104 | }, | |
105 | "version" : "1.1", | |
106 | "x_serialization_backend" : "JSON::PP version 4.07" | |
107 | } |
0 | 0 | --- |
1 | 1 | abstract: 'Perl extension for the automatic generation of LaTeX tables.' |
2 | 2 | author: |
3 | - '<limaone@cpan.org>' | |
3 | - <limaone@cpan.org> | |
4 | 4 | build_requires: |
5 | File::Spec: 0 | |
6 | Test::More: 0 | |
7 | Test::NoWarnings: 0 | |
5 | File::Spec: '0' | |
6 | Test::More: '0' | |
7 | Test::NoWarnings: '0' | |
8 | 8 | configure_requires: |
9 | Module::Build: 0.36 | |
10 | generated_by: 'Module::Build version 0.3607' | |
9 | Module::Build: '0' | |
10 | dynamic_config: 1 | |
11 | generated_by: 'Module::Build version 0.4231, CPAN::Meta::Converter version 2.150010' | |
11 | 12 | license: perl |
12 | 13 | meta-spec: |
13 | 14 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
14 | version: 1.4 | |
15 | version: '1.4' | |
15 | 16 | name: LaTeX-Table |
16 | 17 | provides: |
17 | 18 | LaTeX::Table: |
18 | 19 | file: lib/LaTeX/Table.pm |
19 | version: v1.0.6 | |
20 | version: '1.1' | |
20 | 21 | LaTeX::Table::Themes::Beamer: |
21 | 22 | file: lib/LaTeX/Table/Themes/Beamer.pm |
22 | version: v1.0.6 | |
23 | version: '1.1' | |
23 | 24 | LaTeX::Table::Themes::Booktabs: |
24 | 25 | file: lib/LaTeX/Table/Themes/Booktabs.pm |
25 | version: v1.0.6 | |
26 | version: '1.1' | |
26 | 27 | LaTeX::Table::Themes::Classic: |
27 | 28 | file: lib/LaTeX/Table/Themes/Classic.pm |
28 | version: v1.0.6 | |
29 | version: '1.1' | |
29 | 30 | LaTeX::Table::Themes::Modern: |
30 | 31 | file: lib/LaTeX/Table/Themes/Modern.pm |
31 | version: v1.0.6 | |
32 | version: '1.1' | |
32 | 33 | LaTeX::Table::Themes::ThemeI: |
33 | 34 | file: lib/LaTeX/Table/Themes/ThemeI.pm |
34 | version: v1.0.6 | |
35 | version: '1.1' | |
35 | 36 | LaTeX::Table::Types::Ctable: |
36 | 37 | file: lib/LaTeX/Table/Types/Ctable.pm |
37 | version: v1.0.6 | |
38 | version: '1.1' | |
38 | 39 | LaTeX::Table::Types::Longtable: |
39 | 40 | file: lib/LaTeX/Table/Types/Longtable.pm |
40 | version: v1.0.6 | |
41 | version: '1.1' | |
41 | 42 | LaTeX::Table::Types::Std: |
42 | 43 | file: lib/LaTeX/Table/Types/Std.pm |
43 | version: v1.0.6 | |
44 | version: '1.1' | |
44 | 45 | LaTeX::Table::Types::TypeI: |
45 | 46 | file: lib/LaTeX/Table/Types/TypeI.pm |
46 | version: v1.0.6 | |
47 | version: '1.1' | |
47 | 48 | LaTeX::Table::Types::Xtab: |
48 | 49 | file: lib/LaTeX/Table/Types/Xtab.pm |
49 | version: v1.0.6 | |
50 | version: '1.1' | |
50 | 51 | recommends: |
51 | Getopt::Long: 0 | |
52 | LaTeX::Driver: 0 | |
53 | LaTeX::Encode: 0 | |
54 | Number::Format: 0 | |
55 | Text::CSV: 0 | |
56 | autodie: 0 | |
52 | Getopt::Long: '0' | |
53 | LaTeX::Driver: '0' | |
54 | LaTeX::Encode: '0' | |
55 | Number::Format: '0' | |
56 | Text::CSV: '0' | |
57 | autodie: '0' | |
57 | 58 | requires: |
58 | Carp: 0 | |
59 | Cwd: 0 | |
60 | English: 0 | |
61 | Module::Pluggable: 0 | |
62 | Moose: 0.76 | |
63 | MooseX::FollowPBP: 0.03 | |
64 | Scalar::Util: 0 | |
65 | Template: 0 | |
59 | Carp: '0' | |
60 | Cwd: '0' | |
61 | English: '0' | |
62 | Module::Pluggable: '0' | |
63 | Moose: '0.76' | |
64 | MooseX::FollowPBP: '0.03' | |
65 | Scalar::Util: '0' | |
66 | Template: '0' | |
66 | 67 | perl: v5.8.0 |
67 | version: 0 | |
68 | 68 | resources: |
69 | 69 | license: http://dev.perl.org/licenses/ |
70 | 70 | repository: http://github.com/lima1/p5-latex-table |
71 | version: v1.0.6 | |
71 | version: '1.1' | |
72 | x_serialization_backend: 'CPAN::Meta::YAML version 0.018' |
21 | 21 | 'Module::Pluggable' => 0, |
22 | 22 | 'Carp' => 0, |
23 | 23 | 'Scalar::Util' => 0, |
24 | 'version' => 0, | |
25 | 24 | 'Template' => 0, |
26 | 25 | 'Text::CSV' => 0, |
27 | 26 | 'Cwd' => 0, |
0 | LaTeX-Table version 1.0.6 | |
0 | LaTeX-Table version 1.1 | |
1 | 1 | |
2 | 2 | This module supports multipage tables via the xtab and the longtable package. |
3 | 3 | For publication quality tables it utilizes the booktabs package. It also |
18 | 18 | use LaTeX::Encode; |
19 | 19 | use LaTeX::Driver; |
20 | 20 | |
21 | use version; our $VERSION = qv('1.0.6'); | |
21 | our $VERSION = '1.1'; | |
22 | 22 | |
23 | 23 | my ( $infile, $outfile, $outfiletex, $help, $man, $version ); |
24 | 24 | |
259 | 259 | |
260 | 260 | =head1 LICENSE AND COPYRIGHT |
261 | 261 | |
262 | Copyright (c) 2006-2010, C<< <limaone@cpan.org> >>. | |
262 | Copyright (c) 2006-2011, C<< <limaone@cpan.org> >>. | |
263 | 263 | |
264 | 264 | This program is free software; you can redistribute it and/or |
265 | 265 | modify it under the same terms as Perl itself. See L<perlartistic>. |
5 | 5 | use LaTeX::Table; |
6 | 6 | use Carp; |
7 | 7 | |
8 | use version; our $VERSION = qv('1.0.6'); | |
9 | ||
10 | my $line_id = 0; | |
8 | our $VERSION = '1.1'; | |
9 | ||
11 | 10 | my @input; |
12 | my $paramline; | |
13 | 11 | |
14 | 12 | while ( my $line = <> ) { |
15 | 13 | chomp $line; |
16 | $line =~ s{\s+}{ }xmsg; | |
14 | ||
15 | # remove leading and trailing blanks | |
17 | 16 | $line =~ s{\A \s* | \s* \z}{}xmsg; |
18 | 17 | |
19 | 18 | # remove trailing \\, we do that later |
20 | 19 | $line =~ s{\A \\\\ \z}{}xmsg; |
21 | 20 | |
22 | if ( $line_id == 0 ) { #first line contains the parameters | |
23 | $paramline = $line; | |
24 | } | |
25 | else { | |
26 | push @input, $line; | |
27 | } | |
28 | $line_id++; | |
21 | push @input, $line; | |
29 | 22 | } |
30 | 23 | |
31 | 24 | # remove trailing empty lines |
34 | 27 | } |
35 | 28 | |
36 | 29 | # uncomment original input |
37 | _say( join q{}, map {"\n % $_"} ( $paramline, @input ) ); | |
30 | _say( join q{}, map {"\n % $_"} ( @input ) ); | |
31 | ||
32 | my $paramline = shift @input; | |
38 | 33 | |
39 | 34 | # create rows/column array[array_ref], remove leading and trailing spaces |
40 | 35 | @input = map { |
45 | 40 | my %params = map { _parse_param($_) } split m{ ; }xms, $paramline; |
46 | 41 | |
47 | 42 | my $table = LaTeX::Table->new( |
48 | { header => [ $input[0] ], | |
49 | data => [ @input[ 1 .. $#input ] ], | |
43 | { header => [ shift @input ], | |
44 | data => \@input, | |
50 | 45 | %params, |
51 | 46 | } |
52 | 47 | ); |
176 | 171 | |
177 | 172 | =head1 LICENSE AND COPYRIGHT |
178 | 173 | |
179 | Copyright (c) 2006-2010, C<< <limaone@cpan.org> >>. | |
174 | Copyright (c) 2006-2011, C<< <limaone@cpan.org> >>. | |
180 | 175 | |
181 | 176 | This program is free software; you can redistribute it and/or |
182 | 177 | modify it under the same terms as Perl itself. See L<perlartistic>. |
Binary diff not shown
2 | 2 | |
3 | 3 | with 'LaTeX::Table::Themes::ThemeI'; |
4 | 4 | |
5 | use version; our $VERSION = qv('1.0.6'); | |
5 | our $VERSION = '1.1'; | |
6 | 6 | |
7 | 7 | sub _definition { |
8 | 8 | my $themes = { |
136 | 136 | |
137 | 137 | =head1 LICENSE AND COPYRIGHT |
138 | 138 | |
139 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
139 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
140 | 140 | |
141 | 141 | This module is free software; you can redistribute it and/or |
142 | 142 | modify it under the same terms as Perl itself. See L<perlartistic>. |
2 | 2 | |
3 | 3 | with 'LaTeX::Table::Themes::ThemeI'; |
4 | 4 | |
5 | use version; our $VERSION = qv('1.0.6'); | |
5 | our $VERSION = '1.1'; | |
6 | 6 | |
7 | 7 | sub _definition { |
8 | 8 | my $themes = { |
61 | 61 | |
62 | 62 | =head1 LICENSE AND COPYRIGHT |
63 | 63 | |
64 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
64 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
65 | 65 | |
66 | 66 | This module is free software; you can redistribute it and/or |
67 | 67 | modify it under the same terms as Perl itself. See L<perlartistic>. |
2 | 2 | |
3 | 3 | with 'LaTeX::Table::Themes::ThemeI'; |
4 | 4 | |
5 | use version; our $VERSION = qv('1.0.6'); | |
5 | our $VERSION = '1.1'; | |
6 | 6 | |
7 | 7 | sub _definition { |
8 | 8 | my $themes = { |
127 | 127 | |
128 | 128 | =head1 LICENSE AND COPYRIGHT |
129 | 129 | |
130 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
130 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
131 | 131 | |
132 | 132 | This module is free software; you can redistribute it and/or |
133 | 133 | modify it under the same terms as Perl itself. See L<perlartistic>. |
2 | 2 | |
3 | 3 | with 'LaTeX::Table::Themes::ThemeI'; |
4 | 4 | |
5 | use version; our $VERSION = qv('1.0.6'); | |
5 | our $VERSION = '1.1'; | |
6 | 6 | |
7 | 7 | sub _definition { |
8 | 8 | my $themes = { |
63 | 63 | |
64 | 64 | =head1 LICENSE AND COPYRIGHT |
65 | 65 | |
66 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
66 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
67 | 67 | |
68 | 68 | This module is free software; you can redistribute it and/or |
69 | 69 | modify it under the same terms as Perl itself. See L<perlartistic>. |
4 | 4 | |
5 | 5 | use Moose::Role; |
6 | 6 | |
7 | use version; our $VERSION = qv('1.0.6'); | |
7 | our $VERSION = '1.1'; | |
8 | 8 | |
9 | 9 | requires '_definition'; |
10 | 10 | |
214 | 214 | |
215 | 215 | =head1 LICENSE AND COPYRIGHT |
216 | 216 | |
217 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
217 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
218 | 218 | |
219 | 219 | This module is free software; you can redistribute it and/or |
220 | 220 | modify it under the same terms as Perl itself. See L<perlartistic>. |
2 | 2 | |
3 | 3 | with 'LaTeX::Table::Types::TypeI'; |
4 | 4 | |
5 | use version; our $VERSION = qv('1.0.6'); | |
5 | our $VERSION = '1.1'; | |
6 | 6 | |
7 | 7 | my $template = <<'EOT' |
8 | 8 | {[% DEFINE_COLORS_CODE %][% IF FONTSIZE %]\[% FONTSIZE %] |
60 | 60 | |
61 | 61 | =head1 LICENSE AND COPYRIGHT |
62 | 62 | |
63 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
63 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
64 | 64 | |
65 | 65 | This module is free software; you can redistribute it and/or |
66 | 66 | modify it under the same terms as Perl itself. See L<perlartistic>. |
2 | 2 | |
3 | 3 | with 'LaTeX::Table::Types::TypeI'; |
4 | 4 | |
5 | use version; our $VERSION = qv('1.0.6'); | |
5 | our $VERSION = '1.1'; | |
6 | 6 | |
7 | 7 | my $template = <<'EOT' |
8 | 8 | { |
77 | 77 | |
78 | 78 | =head1 LICENSE AND COPYRIGHT |
79 | 79 | |
80 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
80 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
81 | 81 | |
82 | 82 | This module is free software; you can redistribute it and/or |
83 | 83 | modify it under the same terms as Perl itself. See L<perlartistic>. |
2 | 2 | |
3 | 3 | with 'LaTeX::Table::Types::TypeI'; |
4 | 4 | |
5 | use version; our $VERSION = qv('1.0.6'); | |
5 | our $VERSION = '1.1'; | |
6 | 6 | |
7 | 7 | my $template = <<'EOT' |
8 | 8 | [%IF CONTINUED %]\addtocounter{table}{-1}[% END %][% DEFINE_COLORS_CODE %][% IF ENVIRONMENT %]\begin{[% IF SIDEWAYS %]sidewaystable[% ELSE %][% ENVIRONMENT %][% END %][% IF STAR %]*[% END %]}[% IF POSITION %][[% POSITION %]][% END %] |
46 | 46 | |
47 | 47 | =head1 LICENSE AND COPYRIGHT |
48 | 48 | |
49 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
49 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
50 | 50 | |
51 | 51 | This module is free software; you can redistribute it and/or |
52 | 52 | modify it under the same terms as Perl itself. See L<perlartistic>. |
5 | 5 | use Moose::Role; |
6 | 6 | use Template; |
7 | 7 | |
8 | use version; our $VERSION = qv('1.0.6'); | |
8 | our $VERSION = '1.1'; | |
9 | 9 | |
10 | 10 | use Carp; |
11 | 11 | |
401 | 401 | |
402 | 402 | =head1 LICENSE AND COPYRIGHT |
403 | 403 | |
404 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
404 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
405 | 405 | |
406 | 406 | This module is free software; you can redistribute it and/or |
407 | 407 | modify it under the same terms as Perl itself. See L<perlartistic>. |
2 | 2 | |
3 | 3 | with 'LaTeX::Table::Types::TypeI'; |
4 | 4 | |
5 | use version; our $VERSION = qv('1.0.6'); | |
5 | our $VERSION = '1.1'; | |
6 | 6 | |
7 | 7 | my $template = <<'EOT' |
8 | 8 | { |
58 | 58 | |
59 | 59 | =head1 LICENSE AND COPYRIGHT |
60 | 60 | |
61 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
61 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
62 | 62 | |
63 | 63 | This module is free software; you can redistribute it and/or |
64 | 64 | modify it under the same terms as Perl itself. See L<perlartistic>. |
6 | 6 | use Moose::Util::TypeConstraints; |
7 | 7 | use MooseX::FollowPBP; |
8 | 8 | |
9 | use version; our $VERSION = qv('1.0.6'); | |
9 | our $VERSION = '1.1'; | |
10 | 10 | |
11 | 11 | use LaTeX::Table::Types::Std; |
12 | 12 | use LaTeX::Table::Types::Xtab; |
87 | 87 | has 'resizebox' => ( is => 'rw', isa => 'ArrayRef[Str]' ); |
88 | 88 | has 'columns_like_header' => ( is => 'rw', isa => 'ArrayRef[Int]' ); |
89 | 89 | has 'header' => |
90 | ( is => 'rw', isa => 'ArrayRef[ArrayRef[Value]]', default => sub { [] } ); | |
90 | ( is => 'rw', isa => 'ArrayRef[ArrayRef]', default => sub { [] } ); | |
91 | 91 | has 'data' => |
92 | ( is => 'rw', isa => 'ArrayRef[ArrayRef[Value]]', default => sub { [] } ); | |
92 | ( is => 'rw', isa => 'ArrayRef[ArrayRef]', default => sub { [] } ); | |
93 | 93 | has 'predef_themes' => |
94 | 94 | ( is => 'rw', isa => 'HashRef[HashRef]', default => sub { {} } ); |
95 | 95 | has 'custom_themes' => |
248 | 248 | my $i = 0; |
249 | 249 | COL: |
250 | 250 | for my $col ( @{$row} ) { |
251 | next COL if $col =~ $strategy->{MISSING_VALUE}; | |
251 | next COL if !defined $col || $col =~ $strategy->{MISSING_VALUE}; | |
252 | 252 | |
253 | 253 | for my $coltype (@coltypes) { |
254 | 254 | if ( $col =~ $strategy->{$coltype} ) { |
534 | 534 | |
535 | 535 | sub _get_mc_def { |
536 | 536 | my ( $self, $value ) = @_; |
537 | return { value => undef } if (!defined $value); | |
537 | 538 | return $value =~ m{ \A (.*)\:(\d+)([clr]) \s* \z }xms |
538 | 539 | ? { |
539 | 540 | value => $1, |
655 | 656 | |
656 | 657 | =head1 VERSION |
657 | 658 | |
658 | This document describes LaTeX::Table version 1.0.6 | |
659 | This document describes LaTeX::Table version 1.1 | |
659 | 660 | |
660 | 661 | =head1 SYNOPSIS |
661 | 662 | |
1442 | 1443 | |
1443 | 1444 | =head1 LICENSE AND COPYRIGHT |
1444 | 1445 | |
1445 | Copyright (c) 2006-2010 C<< <limaone@cpan.org> >> | |
1446 | Copyright (c) 2006-2011 C<< <limaone@cpan.org> >> | |
1446 | 1447 | |
1447 | 1448 | This module is free software; you can redistribute it and/or |
1448 | 1449 | modify it under the same terms as Perl itself. See L<perlartistic>. |
0 | use Test::More tests => 21; | |
0 | use Test::More tests => 22; | |
1 | 1 | use Test::NoWarnings; |
2 | 2 | |
3 | 3 | use LaTeX::Table; |
676 | 676 | 'theme with colordef and resizebox' |
677 | 677 | ) || diag $output; |
678 | 678 | |
679 | ||
679 | $test_header | |
680 | = [ [ 'Name', 'Beers:2c' ], [ '', 'before 4pm', 'after 4pm' ] ]; | |
681 | $test_data = [ | |
682 | [ 'Lisa', '0', '0' ], | |
683 | [ 'Marge', '0', '1' ], | |
684 | [ 'Wiggum', '0', '5' ], | |
685 | [ 'Otto', '1', '3' ], | |
686 | [ 'Homer', '2', '6' ], | |
687 | [ 'Barney', '8', undef ], | |
688 | ]; | |
689 | ||
690 | $table = LaTeX::Table->new( | |
691 | { | |
692 | environment => 0, | |
693 | header => $test_header, | |
694 | data => $test_data, | |
695 | callback => sub { | |
696 | my ( $row, $col, $value, $is_header ) = @_; | |
697 | if (!defined $value) { | |
698 | $value = 'NA'; | |
699 | } | |
700 | return $value; | |
701 | } | |
702 | } | |
703 | ); | |
704 | ||
705 | $expected_output = <<'EOT' | |
706 | \begin{tabular}{lrr} | |
707 | \toprule | |
708 | Name & \multicolumn{2}{c}{Beers} \\ | |
709 | & before 4pm & after 4pm \\ | |
710 | \midrule | |
711 | Lisa & 0 & 0 \\ | |
712 | Marge & 0 & 1 \\ | |
713 | Wiggum & 0 & 5 \\ | |
714 | Otto & 1 & 3 \\ | |
715 | Homer & 2 & 6 \\ | |
716 | Barney & 8 & NA \\ | |
717 | \bottomrule | |
718 | \end{tabular} | |
719 | EOT | |
720 | ; | |
721 | ||
722 | ||
723 | $output = $table->generate_string(); | |
724 | ||
725 | is_deeply( | |
726 | [ split( "\n", $output ) ], | |
727 | [ split( "\n", $expected_output ) ], | |
728 | 'undefined columns' | |
729 | ) || diag $output; |
0 | use Test::More tests => 35; | |
0 | use Test::More tests => 33; | |
1 | 1 | use Test::NoWarnings; |
2 | 2 | |
3 | 3 | use LaTeX::Table; |
109 | 109 | 'header[0] is not an array reference' |
110 | 110 | ) || diag $EVAL_ERROR; |
111 | 111 | |
112 | eval { $table->set_header( [ [ 'A', ['B'] ] ] ); }; | |
113 | like( $EVAL_ERROR, qr{Attribute \(header\)}, 'header[0][1] is not a scalar' ) | |
114 | || diag $EVAL_ERROR; | |
115 | ||
116 | 112 | # data tests |
117 | 113 | eval { |
118 | 114 | $table = LaTeX::Table->new( |
130 | 126 | qr{Attribute \(data\)}, |
131 | 127 | 'data[1] is not an array reference' |
132 | 128 | ) || diag $EVAL_ERROR; |
133 | ||
134 | eval { $table->set_data( [ [ 'A', 'B' ], [ 'A', undef ] ] ); }; | |
135 | like( $EVAL_ERROR, qr{Attribute \(data\)}, 'undef value' ) | |
136 | || diag $EVAL_ERROR; | |
137 | 129 | |
138 | 130 | $table->set_data($data); |
139 | 131 | eval { $table->set_coldef_strategy(1); }; |