Codebase list liblatex-table-perl / a82fa43
pull lima1 12 years ago
3 changed file(s) with 10 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
77
88 use version; our $VERSION = qv('1.0.6');
99
10 my $line_id = 0;
1110 my @input;
12 my $paramline;
1311
1412 while ( my $line = <> ) {
1513 chomp $line;
16 $line =~ s{\s+}{ }xmsg;
14
15 # remove leading and trailing blanks
1716 $line =~ s{\A \s* | \s* \z}{}xmsg;
1817
1918 # remove trailing \\, we do that later
2019 $line =~ s{\A \\\\ \z}{}xmsg;
2120
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;
2922 }
3023
3124 # remove trailing empty lines
3427 }
3528
3629 # uncomment original input
37 _say( join q{}, map {"\n % $_"} ( $paramline, @input ) );
30 _say( join q{}, map {"\n % $_"} ( @input ) );
31
32 my $paramline = shift @input;
3833
3934 # create rows/column array[array_ref], remove leading and trailing spaces
4035 @input = map {
4540 my %params = map { _parse_param($_) } split m{ ; }xms, $paramline;
4641
4742 my $table = LaTeX::Table->new(
48 { header => [ $input[0] ],
49 data => [ @input[ 1 .. $#input ] ],
43 { header => [ shift @input ],
44 data => \@input,
5045 %params,
5146 }
5247 );
99 % theme=Meyrin;label=test;position=htb
1010 % Item:2c & Price
1111 % Gnat& per gram& 13.65
12 % & each& 0.01
12 % & each& 0.01
1313 %
1414 % Gnu& stuffed& 92.59
1515 % Emu& stuffed& 33.33
00 theme=Meyrin;label=test;position=htb
11 Item:2c & Price
22 Gnat& per gram& 13.65
3 & each& 0.01
3 & each& 0.01
44
55 Gnu& stuffed& 92.59
66 Emu& stuffed& 33.33