#!/usr/bin/perl use lib "../lib"; my ($VERSION) = ( '$Revision: 1.6 $' =~ /(\d+\.\d+)/ ) ; my $yaml = shift || die "Usage: $0 pres.yaml [Path] [Template] [OutputDir] [1Page]\n"; my $path = shift || '.'; my $plantilla = shift || 'normal.tmpl'; my $outputdir = shift || "output"; my $modo = shift || "0"; use YAML::Yuyu; my $yuyu = YAML::Yuyu->new( path => $path, plantilla => $plantilla, contenido => $yaml ); -d $outputdir || mkdir( $outputdir ) || die "Can't open dir $outputdir\n"; if ( ! $modo ) { print "Generando portada\n"; open( F, ">$outputdir/index.html") || die "Can't open $outputdir/index.html"; my $portada = $yuyu->portada(); $portada=~ s/\?slide=(\d+)/slide$1.html/g; print F $portada; close F; print "Generando índice\n"; open( F, ">$outputdir/indice.html")|| die "Can't open $outputdir/indice.html"; my $indice = $yuyu->indice(); $indice =~ s/\?slide=(\d+)/slide$1.html/g; print F $indice; close F; print "Generando slides...\n"; for ( 0..$yuyu->{_size}) { print "$_\n"; open( F, ">$outputdir/slide$_.html")|| die "Can't open $outputdir/slide$_.html"; my $slide = $yuyu->slide($_); $slide =~ s/\?slide=(\d+)/slide$1.html/g; $slide =~ s/\?indice=1/index.html/g; print F $slide; close F; } } else { print "Generando portada\n"; my $contenido = ''; open( F, ">$outputdir/index.html") || die "Can't open $outputdir/index.html"; my $portada = $yuyu->portada(); $contenido .= $portada; print "Generando slides...\n"; for ( 0..$yuyu->{_size}) { print "$_\n"; my $slide = $yuyu->slide($_); $slide =~ s/\?slide=(\d+)/slide$1.html/g; $slide =~ s/\?indice=1/index.html/g; $contenido .= $slide; } print F $contenido; close F; }