#!/usr/bin/perl -s -I /home/mp/new_site/mp =encoding utf8 =head1 NAME historiaDeVida2smallbook - a perl script to make booklets for duplex printers =head1 SYNOPSIS historiaDeVida2smallbook [-a6|-a5|-a4] [-tit=...] [-autor=...] [-pre=preambulp] [-end=endings] [-q] [-single] [-proj=....] [-nodest] doc.xml ... =head1 DESCRIPTION This command accepts a set of documents following C and makes a smallbook with them (including, frontpage, table of contents, etc). Default title (Histórias de vida) can be changed with C<-tit="...">. Default author (Museu da pessoa) can be changed with C<-autor="..."> Output is sent to C. Option C<-nodest> to ignore C tag. Option C<-q> is used to run in nonstop mode. Option C<-single> -- single story (title and project extrated from the story) =head1 Dependencies This commands need LaTeX psmallbook psutils =head1 AUTHOR José João Almeida Museu da Pessoa (http://alfarrabio.di.uminho.pt/mp) =head2 DTD mp => tup(ascendencia, infancia, identificacao, percursoprofissional, namoro, lazer, sonhos, oficio, educacao, descendencia, casamento) episodio => seq(p) * titulo p => text ascendencia => seq(p) * titulo infancia => seq(p) * titulo percursoprofissional => mtup(episodio, p+) * titulo identificacao => seq(p) * titulo lazer => seq(p) * titulo namoro => seq(p) * titulo sonhos => seq(p) * titulo oficio => tup(admissao, orgulho, saida, relacoes, carreira, actividade) * titulo educacao => seq(p) * titulo descendencia => seq(p) * titulo casamento => seq(p) * titulo admissao => seq(p) * titulo saida => seq(p) * titulo orgulho => seq(p) * titulo carreira => seq(p) * titulo relacoes => seq(p) * titulo actividade => mtup(episodio+, p+) * titulo =cut use mp; my $f2 = "$ARGV[0].pdf"; $f = "_hv_$$"; mp::historiaDeVida2latex({ output => $f, ($pre ? ( pre => scalar `cat $pre` ):()), ($end ? ( end => scalar `cat $end` ):()), ($single ? ( single => 1 ):()), ($nodest ? ( nodest => 1 ):()), ($a5 ? ( size => "a5" ):()), ($ag ? ( size => "agbookheader" ):()), ($a6 ? ( size => "a6" ):()), ($a4 ? ( size => "a4" ):()), ($proj ? ( projecto => $proj ):()), ($tit ? ( tit => $tit ):()), ($author||$autor ? ( autor => "$author$autor" ):()),}, @ARGV); system ("pdflatex $f.tex"); if($q) { $q=' -q '} else {$q=''} if ($a5) {system ("psmallbook $q -a5 -o=$f2 $f.tex");} elsif ($a6) {system ("psmallbook $q -a6 -o=$f2 $f.tex");} elsif ($a4) {system ("pdflatex $f.tex"); rename("$f.pdf",$f2);} else {system ("psmallbook $q -ag -o=$f2 $f.tex");} $remove = "_hv_$$.*"; system( "rm $remove" ) unless $dontrm;