Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (38 sloc) 1.05 KB
#!/usr/bin/perl
use strict;
use warnings;
use feature ':5.10';
use Getopt::Long;
use Perl6BookLatex;
use Template;
main();
sub main {
my $paper;
GetOptions(
# Should be one of: a4, letter,
# Or a string of width_height like '666pt,909pt'
'paper:s' => \$paper,
) or die;
my $output;
for (@ARGV) {
my $parser = Perl6BookLatex->new();
$parser->emit_environments( sidebar => "sidebar" );
$parser->codes_in_verbatim(1);
$parser->output_string( \$output );
$parser->parse_file($_);
}
my $tt = Template->new( { INCLUDE_PATH => 'lib', } );
# Parse paper if needed
my ($paper_width,$paper_height);
if( $paper =~ /^([0-9\.]+(?:in|cm|pt|mm)),([0-9\.]+(?:in|cm|pt|mm))$/ ){
( $paper_width , $paper_height ) = ( $1, $2 );
$paper = undef;
}
$tt->process(
'book.sty', {
content => $output,
paper => $paper,
paper_width => $paper_width,
paper_height => $paper_height
} );
} ## end sub main
Something went wrong with that request. Please try again.