| 1 | # -*- cperl -*- | ||
| 2 | # ABSTRACT: BeamerReveal | ||
| 3 | |||
| 4 | |||
| 5 | package BeamerReveal; | ||
| 6 | our $VERSION = '20261115.1249'; # VERSION | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | use warnings; | ||
| 10 | |||
| 11 | use Carp; | ||
| 12 | |||
| 13 | use BeamerReveal::Object::Presentation; | ||
| 14 | use BeamerReveal::Object::BeamerFrame; | ||
| 15 | |||
| 16 | use BeamerReveal::Log; | ||
| 17 | |||
| 18 | |||
| 19 | sub new { | ||
| 20 | my $class = shift; | ||
| 21 | |||
| 22 | my $self = { | ||
| 23 | rawpage => 0 | ||
| 24 | }; | ||
| 25 | $class = (ref $class ? ref $class : $class ); | ||
| 26 | bless $self, $class; | ||
| 27 | |||
| 28 | return $self; | ||
| 29 | } | ||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | sub reset { | ||
| 34 | my $self = shift; | ||
| 35 | $self->{rawpage} = 0; | ||
| 36 | } | ||
| 37 | |||
| 38 | |||
| 39 | sub createFromChunk { | ||
| 40 | my $self = shift; | ||
| 41 | my ( $chunk, $chunkStartLine ) = @_; | ||
| 42 | |||
| 43 | my ( $chunkLine, @lines ) = split( "\n", $chunk ); | ||
| 44 | my ( $chunkType, $chunkData ) = split( ':', $chunkLine ); | ||
| 45 | |||
| 46 | if( $chunkType eq 'Presentation' ) { | ||
| 47 | return BeamerReveal::Object::Presentation->new( $chunkData, \@lines, $chunkStartLine ); | ||
| 48 | } | ||
| 49 | if( $chunkType eq 'BeamerFrame' ) { | ||
| 50 | return BeamerReveal::Object::BeamerFrame->new( $chunkData, \@lines, $chunkStartLine, ++$self->{rawpage} ); | ||
| 51 | } | ||
| 52 | else { | ||
| 53 | $BeamerReveal::Log::logger->fatal( "Error: unknown chunk type $chunkType on line $chunkStartLine\n" ); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | 1; | ||
| 58 | |||
| 59 | __END__ |