lib/BeamerReveal/Object/BeamerFrame.pm

filter: Statementstmt 11.7% 26 / 221 Branchbran 0.0% 0 / 86 Conditioncond 0.0% 0 / 22 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 53.8% 7 / 13 Podpod 75.0% 3 / 4 totaltotal 10.0% 36 / 360 CC 60 SCAR 70.0
CC
60
Cov
8%
makeSlide
1806.0
new
210.0
extractGenerationContent
12.0
CRAP 1095.6
↑ Summary lib/BeamerReveal/MediaManager.pm »
1 # -*- cperl -*-
2 # ABSTRACT: BeamerFrame object
3  
4  
5 package BeamerReveal::Object::BeamerFrame;
6 1 our $VERSION = '20260208.1851'; # VERSION
7  
8 1 ▶use parent 'BeamerReveal::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use BeamerReveal::TemplateStore;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use BeamerReveal::MediaManager;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use BeamerReveal::Log;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use Digest::SHA;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20  
21 1 our $maxRawPage;
22 1 our $maxNotePage = 0;
23 1 our $embeddedID;
24  
25 0 ▶sub nofdigits { length( "$_[0]" ) }
Subroutine nofdigits: not called CC=1 SCAR=6.9
Pod undocumented
26  
27 sub new {
28 0 ▶ my $class = shift;
Subroutine new: not called CC=14 SCAR=53.5
Pod documented
29 0 my ( $chunkData, $lines, $lineCtr, $rawpage ) = @_;
30
31 0 ▶ $class = (ref $class ? ref $class : $class );
Branch: 1 branch
BranchTrueFalseTotal
ref $class ? : 0 0 0
32 0 my $self = {};
33 0 bless $self, $class;
34  
35 0 my $logger = $BeamerReveal::Log::logger;
36
37 0 $self->{videos} = [];
38 0 $self->{audios} = [];
39 0 $self->{images} = [];
40 0 $self->{iframes} = [];
41 0 $self->{animations} = [];
42 0 $self->{stills} = [];
43 0 $self->{hasnotes} = 0;
44 0 $self->{mtoracle} = MIME::Types->new();
45  
46 0 ++$lineCtr;
47 0 ▶ for ( my $i = 0; $i < @$lines; ++$i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @$lines) 0 0 0
48 0 ▶ ( $lines->[$i] =~ /^-(?<command>\w+):(?<payload>.*)$/ )
Branch: 1 branch
BranchTrueFalseTotal
$lines->[$i] =~ /^-(?<command>\w+):(?<payload>.*)$/ or $logger->fatal("Error: syntax incorrect in rvl file on line $lineCtr '$lines->[$i]'\n") 0 0 0
49 or $logger->fatal( "Error: syntax incorrect in rvl file on line $lineCtr '$lines->[$i]'\n" );
50 0 ▶ if ( $+{command} eq 'parameters' ) {
Branch: 8 branches
BranchTrueFalseTotal
if ($+{'command'} eq 'parameters') { } 0 0 0
elsif ($+{'command'} eq 'video') { } 0 0 0
elsif ($+{'command'} eq 'audio') { } 0 0 0
elsif ($+{'command'} eq 'image') { } 0 0 0
elsif ($+{'command'} eq 'iframe') { } 0 0 0
elsif ($+{'command'} eq 'animation') { } 0 0 0
elsif ($+{'command'} eq 'still') { } 0 0 0
elsif ($+{'command'} eq 'hasnote') { } 0 0 0
51 0 $self->{parameters} = BeamerReveal::Object::readParameterLine( $+{payload} );
52 # The correctness of this relies on the pages appearing in order in the .rvl file
53 # however, the rawpage counter of LaTeX is not all cases a true arabic counter and
54 # therefore not reliable
55 0 $self->{parameters}->{rawpage} = $rawpage;
56 0 $maxRawPage = $rawpage;
57 } elsif ( $+{command} eq 'video' ) {
58 0 push @{$self->{videos}}, BeamerReveal::Object::readParameterLine( $+{payload} );
59 } elsif ( $+{command} eq 'audio' ) {
60 0 push @{$self->{audios}}, BeamerReveal::Object::readParameterLine( $+{payload} );
61 } elsif ( $+{command} eq 'image' ) {
62 0 push @{$self->{images}}, BeamerReveal::Object::readParameterLine( $+{payload} );
63 } elsif ( $+{command} eq 'iframe' ) {
64 0 push @{$self->{iframes}}, BeamerReveal::Object::readParameterLine( $+{payload} );
65 } elsif ( $+{command} eq 'animation' ) {
66 0 push @{$self->{animations}}, BeamerReveal::Object::readParameterLine( $+{payload} );
67 0 $self->{animations}->[-1]->{tex} = $lines->[++$i];
68 } elsif ( $+{command} eq 'still' ) {
69 0 push @{$self->{stills}}, BeamerReveal::Object::readParameterLine( $+{payload} );
70 0 $self->{stills}->[-1]->{tex} = $lines->[++$i];
71 } elsif ( $+{command} eq 'hasnote' ) {
72 0 $self->{hasnotes} = 1;
73 } else {
74 0 $logger->fatal( "Error: unknown BeamerFrame data on line @{[ $lineCtr + $i ]} '$lines->[$i]'\n" );
75 }
76 }
77 0 ▶ ++$maxNotePage if $self->{hasnotes};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"hasnotes"} 0 0 0
78
79 0 ▶ $embeddedID = 0 unless defined( $embeddedID );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $embeddedID 0 0 0
80
81 0 return $self;
82 }
83  
84  
85  
86 sub extractGenerationContent {
87 0 ▶ my $self = shift;
Subroutine extractGenerationContent: not called CC=3 SCAR=24.8
Pod documented
88 0 my ( $i, $mediaManager, $presentation ) = @_;
89  
90 0 my $logger = $BeamerReveal::Log::logger;
91 0 $logger->log( 2, "- extracting generation content from slide $i" );
92  
93 0 my $generatedContent = {
94 animations => [],
95 stills => [],
96 };
97
98 #########################
99 # process all animations
100 0 foreach my $animation (@{$self->{animations}}) {
101 0 $logger->log( 4, "- extracting animation" );
102
103 # 1. Generate the animation
104 0 push @{$generatedContent->{animations}}, $mediaManager->animationRegisterInStore( $animation );
105 }
106  
107 #####################
108 # process all stills
109 0 foreach my $still (@{$self->{stills}}) {
110 0 $logger->log( 4, "- adding still" );
111  
112 # 1. Generate the animation
113 0 push @{$generatedContent->{stills}}, $mediaManager->stillRegisterInStore( $still );
114 }
115  
116 0 return $generatedContent;
117 }
118  
119  
120  
121  
122 sub makeSlide {
123 0 ▶ my $self = shift;
Subroutine makeSlide: not called CC=42 SCAR=75.0
Pod documented
124 0 my ( $i, $mediaManager, $presentation, $generatedContent ) = @_;
125  
126 0 my $logger = $BeamerReveal::Log::logger;
127 0 $logger->log( 2, "- making slide $i" );
128
129 0 my $templateStore = BeamerReveal::TemplateStore->new();
130 0 my $content = '';
131  
132 my $slideEmbed =
133 0 ▶ exists $self->{parameters}->{embed} or exists $presentation->{parameters}->{embed};
Branch: 1 branch
BranchTrueFalseTotal
my $slideEmbed = exists $self->{"parameters"}{"embed"} or exists $presentation->{"parameters"}{"embed"} 0 0 0
134
135 ###############################################
136 # process all video material / can be embedded
137 0 foreach my $video (@{$self->{videos}}) {
138 my %commonStamps = ( X => _topercent( $video->{x} ),
139 Y => _topercent( $video->{y} ),
140 W => _topercent( $video->{width} ),
141 H => _topercent( $video->{height} ),
142 VIDEOID => 'embedded-id-' . $embeddedID++,
143 VIDEOEMBEDDEDB64 => $videoContent,
144 MIMETYPE => $mimeType,
145 FIT => $video->{fit},
146 AUTOPLAY => exists $video->{autoplay} ? 'data-autoplay' : '',
147 CONTROLS => exists $video->{controls} ? 'controls' : '',
148 MUTED => exists $video->{muted} ? 'muted' : '',
149 0 ▶ LOOP => exists $video->{loop} ? 'loop' : '',
Branch: 4 branches
BranchTrueFalseTotal
exists $video->{'autoplay'} ? : 0 0 0
exists $video->{'controls'} ? : 0 0 0
exists $video->{'muted'} ? : 0 0 0
exists $video->{'loop'} ? : 0 0 0
150 );
151 0 my $vStamps;
152 my $vTemplate;
153 0 ▶ if ( exists $video->{embed} or $slideEmbed ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $video->{'embed'} or $slideEmbed) { } 0 0 0
Condition0%0/3
exists $video->{"embed"} or $slideEmbed
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $video->{"embed"} or $slideEmbed
exists $video->{"embed"} $slideEmbed
Truth table0%0/3
A or B
A= exists $video->{"embed"}B= $slideEmbed
ABresult
1X1
011
000
154 0 $logger->log( 4, "- adding embedded video" );
155 0 $vTemplate = $templateStore->fetch( 'html', 'video-embedded.html' );
156 my ( $mimeType ) = $mediaManager->videoFromStore( $video->{file},
157 0 to_embed => 1 );
158 0 $vStamps = { %commonStamps,
159 VIDEOID => 'embedded-id-' . $embeddedID++,
160 VIDEOEMBEDDEDB64 => $videoContent,
161 MIMETYPE => $mimeType,
162 };
163 } else {
164 0 $logger->log( 4, "- adding video" );
165 0 $vTemplate = $templateStore->fetch( 'html', 'video.html' );
166 0 my ( $mimeType, $videoFile ) = $mediaManager->videoFromStore( $video->{file} );
167 0 $vStamps = { %commonStamps,
168 VIDEO => $videoFile
169 };
170 }
171 0 $content .= BeamerReveal::TemplateStore::stampTemplate( $vTemplate, $vStamps);
172 }
173  
174 ###############################################
175 # process all audio material / can be embedded
176 0 foreach my $audio (@{$self->{audios}}) {
177 my %commonStamps = ( X => _topercent( $audio->{x} ),
178 Y => _topercent( $audio->{y} ),
179 W => _topercent( $audio->{width} ),
180 H => _topercent( $audio->{height} ),
181 FIT => $audio->{fit},
182 AUTOPLAY => exists $audio->{autoplay} ? 'data-autoplay' : '',
183 CONTROLS => exists $audio->{controls} ? 'controls' : '',
184 MUTED => exists $audio->{muted} ? 'muted' : '',
185 0 ▶ LOOP => exists $audio->{loop} ? 'loop' : '' );
Branch: 4 branches
BranchTrueFalseTotal
exists $audio->{'autoplay'} ? : 0 0 0
exists $audio->{'controls'} ? : 0 0 0
exists $audio->{'muted'} ? : 0 0 0
exists $audio->{'loop'} ? : 0 0 0
186 0 my $aStamps;
187 my $aTemplate;
188 0 ▶ if ( exists $audio->{embed} or $slideEmbed ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $audio->{'embed'} or $slideEmbed) { } 0 0 0
Condition0%0/3
exists $audio->{"embed"} or $slideEmbed
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $audio->{"embed"} or $slideEmbed
exists $audio->{"embed"} $slideEmbed
Truth table0%0/3
A or B
A= exists $audio->{"embed"}B= $slideEmbed
ABresult
1X1
011
000
189 0 $logger->log( 4, "- adding embedded audio" );
190 0 $aTemplate = $templateStore->fetch( 'html', 'audio-embedded.html' );
191 my ( $mimeType, $audioContent ) = $mediaManager->audioFromStore( $audio->{file},
192 0 to_embed => 1 );
193 0 $aStamps = { %commonStamps,
194 AUDIOID => 'embedded-id-' . $embeddedID++,
195 AUDIOEMBEDDEDB64 => $audioContent,
196 MIMETYPE => $mimeType,
197 };
198 } else {
199 0 $logger->log( 4, "- adding audio" );
200 0 $aTemplate = $templateStore->fetch( 'html', 'audio.html' );
201 0 my ( $mimeType, $audioFile ) = $mediaManager->audioFromStore( $audio->{file} );
202 0 $aStamps = { %commonStamps,
203 AUDIO => $audioFile,
204 };
205 }
206 0 $content .= BeamerReveal::TemplateStore::stampTemplate( $aTemplate, $aStamps );
207 }
208  
209 ###############################################
210 # process all image material / can be embedded
211 0 foreach my $image (@{$self->{images}}) {
212 my %commonStamps = ( X => _topercent( $image->{x} ),
213 Y => _topercent( $image->{y} ),
214 W => _topercent( $image->{width} ),
215 H => _topercent( $image->{height} ),
216 IMAGEID => 'embedded-id-' . $embeddedID++,
217 IMAGEEMBEDDEDB64 => $imageContent,
218 MIMETYPE => $mimeType,
219 FIT => $image->{fit}
220 0 );
221 0 my $iStamps;
222 my $iTemplate;
223 0 ▶ if ( exists $image->{embed} or $slideEmbed ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $image->{'embed'} or $slideEmbed) { } 0 0 0
Condition0%0/3
exists $image->{"embed"} or $slideEmbed
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $image->{"embed"} or $slideEmbed
exists $image->{"embed"} $slideEmbed
Truth table0%0/3
A or B
A= exists $image->{"embed"}B= $slideEmbed
ABresult
1X1
011
000
224 0 $logger->log( 4, "- adding embedded image" );
225 0 $iTemplate = $templateStore->fetch( 'html', 'image-embedded.html' );
226 my( $mimeType, $imageContent ) = $mediaManager->imageFromStore( $image->{file},
227 0 to_embed => 1 );
228 0 $iStamps = { %commonStamps,
229 IMAGEID => 'embedded-id-' . $embeddedID++,
230 IMAGEEMBEDDEDB64 => $imageContent,
231 MIMETYPE => $mimeType,
232 };
233 } else {
234 0 $logger->log( 4, "- adding image" );
235 0 $iTemplate = $templateStore->fetch( 'html', 'image.html' );
236 0 my( $mimeType, $imageFile ) = $mediaManager->imageFromStore( $image->{file} );
237 0 $iStamps = { %commonStamps,
238 IMAGE => $imageFile };
239 }
240 0 $content .= BeamerReveal::TemplateStore::stampTemplate( $iTemplate,
241 $iStamps );
242 }
243  
244 ################################################
245 # process all iframe material / can be embedded
246 0 foreach my $iframe (@{$self->{iframes}}) {
247 my %commonStamps = ( X => _topercent( $iframe->{x} ),
248 Y => _topercent( $iframe->{y} ),
249 W => _topercent( $iframe->{width} ),
250 H => _topercent( $iframe->{height} ),
251 FIT => $iframe->{fit}
252 0 );
253 0 my $iStamps;
254 my $iTemplate;
255 0 ▶ if ( exists $iframe->{embed} or exists $presentation->{parameters}->{embed} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $iframe->{'embed'} or exists $presentation->{'parameters'}{'embed'}) { } 0 0 0
Condition0%0/3
exists $iframe->{"embed"} or exists $presentation->{"parameters"}{"embed"}
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $iframe->{"embed"} or exists $presentation->{"parameters"}{"embed"}
exists $iframe->{"embed"} exists $presentation->{"parameters"}{"embed"}
Truth table0%0/3
A or B
A= exists $iframe->{"embed"}B= exists $presentation->{"parameters"}{"embed"}
ABresult
1X1
011
000
256 0 $logger->log( 4, "- adding embedded iframe" );
257 0 $iTemplate = $templateStore->fetch( 'html', 'iframe-embedded.html' );
258 my ( $mimeType, $iframeContent ) = $mediaManager->iframeFromStore( $iframe->{file},
259 0 to_embed => 1 );
260 0 $iStamps = { %commonStamps,
261 IFRAMEID => 'embedded-id-' . $embeddedID++,
262 IFRAMEEMBEDDEDB64 => $iframeContent,
263 };
264 } else {
265 0 $logger->log( 4, "- adding iframe" );
266 0 $iTemplate = $templateStore->fetch( 'html', 'iframe.html' );
267 0 my ( undef, $iframeFile ) = $mediaManager->iframeFromStore( $iframe->{file} );
268 0 $iStamps = { %commonStamps,
269 IFRAME => $iframeFile,
270 };
271 }
272 0 $content .= BeamerReveal::TemplateStore::stampTemplate( $iTemplate,
273 $iStamps );
274 }
275  
276 ###########################################
277 # process all animations / can be embedded
278 0 my $aCounter = 0;
279 0 foreach my $animation (@{$self->{animations}}) {
280 my %commonStamps = (X => _topercent( $animation->{x} ),
281 Y => _topercent( $animation->{y} ),
282 W => _topercent( $animation->{width} ),
283 H => _topercent( $animation->{height} ),
284 AUTOPLAY => exists $animation->{autoplay} ? 'data-autoplay' : '',
285 CONTROLS => exists $animation->{controls} ? 'controls' : '',
286 LOOP => exists $animation->{loop} ? 'loop' : '',
287 FIT => $animation->{fit},
288 0 ▶ );
Branch: 3 branches
BranchTrueFalseTotal
exists $animation->{'autoplay'} ? : 0 0 0
exists $animation->{'controls'} ? : 0 0 0
exists $animation->{'loop'} ? : 0 0 0
289
290 0 my $aTemplate;
291 my $aStamps;
292 0 ▶ if ( exists $animation->{embed} or $slideEmbed ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $animation->{'embed'} or $slideEmbed) { } 0 0 0
Condition0%0/3
exists $animation->{"embed"} or $slideEmbed
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $animation->{"embed"} or $slideEmbed
exists $animation->{"embed"} $slideEmbed
Truth table0%0/3
A or B
A= exists $animation->{"embed"}B= $slideEmbed
ABresult
1X1
011
000
293 0 $logger->log( 4, "- adding embedded animation" );
294 0 $aTemplate = $templateStore->fetch( 'html', 'animation-embedded.html' );
295 my ( $mimeType, $videoContent ) =
296 0 $mediaManager->animationFromStore( $generatedContent->{animations}->[$aCounter++],
297 to_embed => 1 );
298 $aStamps =
299 {
300 %commonStamps,
301 ANIMATIONID => 'embedded-id-' . $embeddedID++,
302 ANIMATIONEMBEDDEDB64 => $videoContent,
303 MIMETYPE => $mimeType,
304 FIT => $image->{fit}
305 0 };
306 }
307 else {
308 0 $logger->log( 4, "- adding animation: " . $generatedContent->{animations}->[$aCounter] );
309 0 $aTemplate = $templateStore->fetch( 'html', 'animation.html' );
310 my ( $undef, $file ) =
311 0 $mediaManager->animationFromStore( $generatedContent->{animations}->[$aCounter++] );
312
313 0 $aStamps =
314 {
315 %commonStamps,
316 ANIMATION => $file,
317 };
318 }
319 0 $content .= BeamerReveal::TemplateStore::stampTemplate( $aTemplate,
320 $aStamps );
321 }
322  
323 #######################################
324 # process all stills / can be embedded
325 0 my $sCounter = 0;
326 0 foreach my $still (@{$self->{stills}}) {
327 my %commonStamps = ( X => _topercent( $still->{x} ),
328 Y => _topercent( $still->{y} ),
329 W => _topercent( $still->{width} ),
330 H => _topercent( $still->{height} ),
331 FIT => $still->{fit},
332 0 );
333  
334 0 my $sTemplate;
335 my $sStamps;
336 0 ▶ if ( exists $still->{embed} or $slideEmbed ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $still->{'embed'} or $slideEmbed) { } 0 0 0
Condition0%0/3
exists $still->{"embed"} or $slideEmbed
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $still->{"embed"} or $slideEmbed
exists $still->{"embed"} $slideEmbed
Truth table0%0/3
A or B
A= exists $still->{"embed"}B= $slideEmbed
ABresult
1X1
011
000
337 0 $logger->log( 4, "- adding embedded still" );
338 0 $sTemplate = $templateStore->fetch( 'html', 'still-embedded.html' );
339 my ( $mimeType, $videoContent ) =
340 0 $mediaManager->stillFromStore( $generatedContent->{stills}->[$sCounter++],
341 to_embed => 1 );
342 $sStamps =
343 {
344 %commonStamps,
345 STILLID => 'embedded-id-' . $embeddedID++,
346 STILLEMBEDDEDB64 => $videoContent,
347 MIMETYPE => $mimeType,
348 FIT => $image->{fit}
349 0 };
350 }
351 else {
352 0 $logger->log( 4, "- adding still: " . $generatedContent->{stills}->[$sCounter] );
353 0 $sTemplate = $templateStore->fetch( 'html', 'still.html' );
354 my ( undef, $file ) =
355 0 $mediaManager->stillFromStore( $generatedContent->{stills}->[$sCounter++] );
356  
357 0 $sStamps =
358 {
359 %commonStamps,
360 STILL => $file,
361 };
362 }
363 0 $content .= BeamerReveal::TemplateStore::stampTemplate( $sTemplate,
364 $sStamps );
365 }
366  
367 ###########################
368 # process the frame itself
369  
370 # title
371 0 my $title = _modernize( $self->{parameters}->{title} );
372 0 ▶ if ( $title =~ /\\/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($title =~ /\\/) { } 0 0 0
373 0 $logger->fatal( "Error: the title of slide $i contains TeX-like code (observe below between <<< >>>); provide a clean version using \\frametitle[clean-version]{TeX-like code}\n" .
374 "<<< $self->{parameters}->{title} >>>" );
375 } else {
376 0 $self->{parameters}->{title} = $title;
377 }
378 ;
379  
380 # menu entries
381 0 my $menuTitle;
382 0 ▶ if ( exists $self->{parameters}->{toc} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'parameters'}{'toc'}) { } 0 0 0
383 0 ▶ if ( $self->{parameters}->{toc} eq 'titlepage' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($self->{'parameters'}{'toc'} eq 'titlepage') { } 0 0 0
elsif ($self->{'parameters'}{'toc'} eq 'section') { } 0 0 0
elsif ($self->{'parameters'}{'toc'} eq 'subsection') { } 0 0 0
384 0 $menuTitle = "<span class='menu-title'>%s</span>";
385 } elsif ( $self->{parameters}->{toc} eq 'section' ) {
386 0 $menuTitle = "<span class='menu-section'>&bull; %s</span>";
387 } elsif ( $self->{parameters}->{toc} eq 'subsection' ) {
388 0 $menuTitle = "<span class='menu-subsection'>&SmallCircle; %s</span>";
389 } else {
390 0 $logger->fatal( "Error: invalid toc parameter in rvl file" );
391 }
392 } else {
393 0 $menuTitle = "<span class='menu-slide'>&bullet; %s</span>";
394 }
395 $menuTitle = sprintf( $menuTitle,
396 0 $self->{parameters}->{title} );
397  
398 # autoSlide
399 0 my $autoSlide = '';
400 0 ▶ if( exists $self->{parameters}->{autoslide} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"parameters"}{"autoslide"}) 0 0 0
401 0 $autoSlide = 'data-autoslide="' . $self->{parameters}->{autoslide} . '"';
402 }
403
404 # notes
405 0 my $notes = ' '; # the space is important as default, if you remove it, the notes will be sticky!
406
407 0 ▶ if ( $self->{hasnotes} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"hasnotes"}) 0 0 0
408 0 ▶ if ( $slideEmbed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($slideEmbed) { } 0 0 0
409 0 my $nTemplate = $templateStore->fetch( 'html', 'note-embedded.html' );
410
411 # remember: the hasnote entry holds the note number
412 my ( $mimeType, $notesImage ) = $mediaManager->noteFromStore( $self->{hasnotes},
413 0 to_embed => 1 );
414
415 0 my $nStamps =
416 {
417 NOTEID => 'embedded-id-' . $embeddedID++,
418 NOTEEMBEDDEDB64 => $notesImage,
419 MIMETYPE => $mimeType,
420 };
421
422 0 $notes = BeamerReveal::TemplateStore::stampTemplate( $nTemplate, $nStamps );
423 }
424 else {
425 0 my $nTemplate = $templateStore->fetch( 'html', 'note.html' );
426
427 # remember: the hasnote entry holds the note number
428 0 my ( undef, $notesImage ) = $mediaManager->noteFromStore( $self->{hasnotes} );
429
430 0 my $nStamps =
431 {
432 NOTESIMAGE => $notesImage
433 };
434
435 0 $notes = BeamerReveal::TemplateStore::stampTemplate( $nTemplate, $nStamps );
436 }
437 }
438  
439 # generate slide itself
440 0 ▶ if ( $slideEmbed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($slideEmbed) { } 0 0 0
441 0 my $fTemplate = $templateStore->fetch( 'html', 'beamerframe-embedded.html' );
442
443 my ( $mimeType, $slideImage ) = $mediaManager->slideFromStore( $self->{parameters}->{rawpage},
444 0 to_embed => 1 );
445 my $fStamps =
446 {
447 DATAMENUTITLE => $menuTitle,
448 SLIDEID => 'embedded-id-' . $embeddedID++,
449 SLIDEEMBEDDEDB64 => $slideImage,
450 MIMETYPE => $mimeType,
451 SLIDECONTENT => $content,
452 0 ▶ TRANSITION => $self->{parameters}->{transition} || 'fade',
Condition0%0/2
$self->{'parameters'}{'transition'} || 'fade'
l!l
00
MC/DC0%0/1
$self->{'parameters'}{'transition'} || 'fade'
$self->{'parameters'}{'transition'}
Truth table0%0/2
A
A= $self->{'parameters'}{'transition'}
Aresult
11
00
453 AUTOSLIDE => $autoSlide,
454 NOTESIMAGE => $notes
455 };
456
457 0 return BeamerReveal::TemplateStore::stampTemplate( $fTemplate, $fStamps );
458
459 } else {
460 0 my $fTemplate = $templateStore->fetch( 'html', 'beamerframe.html' );
461
462 0 my ( undef, $slideImage ) = $mediaManager->slideFromStore( $self->{parameters}->{rawpage} );
463
464 my $fStamps =
465 {
466 DATAMENUTITLE => $menuTitle,
467 SLIDEIMAGE => $slideImage,
468 SLIDECONTENT => $content,
469 0 ▶ TRANSITION => $self->{parameters}->{transition} || 'fade',
Condition0%0/2
$self->{'parameters'}{'transition'} || 'fade'
l!l
00
MC/DC0%0/1
$self->{'parameters'}{'transition'} || 'fade'
$self->{'parameters'}{'transition'}
Truth table0%0/2
A
A= $self->{'parameters'}{'transition'}
Aresult
11
00
470 AUTOSLIDE => $autoSlide,
471 NOTESIMAGE => $notes
472 };
473
474 0 return BeamerReveal::TemplateStore::stampTemplate( $fTemplate, $fStamps );
475 }
476 }
477  
478 sub _topercent {
479 0 ▶ confess() unless defined $_[0];
Subroutine _topercent: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[0] 0 0 0
480 0 return sprintf( "%.2f%%", $_[0] * 100 );
481 }
482  
483 sub _modernize {
484 0 ▶ my $string = shift;
Subroutine _modernize: not called CC=3 SCAR=24.8
485 0 ▶ defined( $string ) or die();
Branch: 1 branch
BranchTrueFalseTotal
defined $string or die 0 0 0
486 0 my $dictionary = {
487 qr/\\`\{?a\}?/ => 'à',
488 qr/\\'\{?a\}?/ => 'á',
489 qr/\\"\{?a\}?/ => 'ä',
490 qr/\\\^\{?a\}?/ => 'â',
491 qr/\\~\{?a\}?/ => 'ã',
492 qr/\\=\{?a\}?/ => 'ā',
493 qr/\\\.\{?a\}?/ => 'ȧ',
494 qr/\\u\{?a\}?/ => 'ă',
495 qr/\\v\{?a\}?/ => 'ǎ',
496 qr/\\c\{?a\}?/ => 'ą',
497 qr/\\r\{?a\}?/ => 'å',
498 qr/\\`\{?e\}?/ => 'è',
499 qr/\\'\{?e\}?/ => 'é',
500 qr/\\"\{?e\}?/ => 'ë',
501 qr/\\\^\{?e\}?/ => 'ê',
502 qr/\\~\{?e\}?/ => 'ẽ',
503 qr/\\=\{?e\}?/ => 'ē',
504 qr/\\\.\{?e\}?/ => 'ė',
505 qr/\\u\{?e\}?/ => 'ĕ',
506 qr/\\v\{?e\}?/ => 'ě',
507 qr/\\c\{?e\}?/ => 'ę',
508 qr/\\`\{?\\?i(?:\{\})?\}?/ => 'ì',
509 qr/\\'\{?\\?i(?:\{\})?\}?/ => 'í',
510 qr/\\"\{?\\?i(?:\{\})?\}?/ => 'ï',
511 qr/\\\^\{?\\?i(?:\{\})?\}?/ => 'î',
512 qr/\\~\{?\\?i(?:\{\})?\}?/ => 'ĩ',
513 qr/\\=\{?\\?i(?:\{\})?\}?/ => 'ī',
514 qr/\\u\{?\\?i(?:\{\})?\}?/ => 'ĭ',
515 qr/\\v\{?\\?i(?:\{\})?\}?/ => 'ǐ',
516 qr/\\c\{?\\?i(?:\{\})?\}?/ => 'į',
517 qr/\\`\{?o\}?/ => 'ò',
518 qr/\\'\{?o\}?/ => 'ó',
519 qr/\\"\{?o\}?/ => 'ö',
520 qr/\\\^\{?o\}?/ => 'ô',
521 qr/\\~\{?o\}?/ => 'õ',
522 qr/\\=\{?o\}?/ => 'ō',
523 qr/\\\.\{?o\}?/ => 'ȯ',
524 qr/\\u\{?o\}?/ => 'ŏ',
525 qr/\\v\{?o\}?/ => 'ǒ',
526 qr/\\c\{?o\}?/ => 'ǫ',
527 qr/\\`\{?u\}?/ => 'ù',
528 qr/\\'\{?u\}?/ => 'ú',
529 qr/\\"\{?u\}?/ => 'ü',
530 qr/\\\^\{?u\}?/ => 'û',
531 qr/\\~\{?u\}?/ => 'ũ',
532 qr/\\=\{?u\}?/ => 'ū',
533 qr/\\u\{?u\}?/ => 'ŭ',
534 qr/\\v\{?u\}?/ => 'ǔ',
535 qr/\\c\{?u\}?/ => 'ų',
536 qr/\\r\{?u\}?/ => 'ů',
537 qr/\\c\{?c\}?/ => 'ç',
538 qr/\\~\{?n\}?/ => 'ñ',
539 qr/\\oe/ => 'œ',
540 qr/\\OE/ => 'Œ',
541 qr/\\&/ => '&',
542 };
543 0 ▶ while ( my ( $regexp, $rep ) = each ( %$dictionary ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$dictionary) 0 0 0
544 0 $string =~ s/$regexp/$rep/g;
545 }
546 0 return $string;
547 }
548  
549 1 1;
550  
551 __END__
↑ Summary lib/BeamerReveal/MediaManager.pm »