Codebase list liblatex-table-perl / 61eddd1
code cleanup lima1 13 years ago
1 changed file(s) with 8 addition(s) and 13 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 );