line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::RevealJS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
813
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
212
|
use 5.12.0; |
|
1
|
|
|
|
|
14
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.21'; |
8
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Mojo::Home; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
11
|
1
|
|
|
1
|
|
6
|
use Mojo::ByteStream 'b'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
12
|
1
|
|
|
1
|
|
18
|
use Mojo::File; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use File::Basename 'dirname'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
15
|
1
|
|
|
1
|
|
493
|
use File::Share (); |
|
1
|
|
|
|
|
25299
|
|
|
1
|
|
|
|
|
1300
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has home => sub { Mojo::Home->new(File::Share::dist_dir('Mojolicious-Plugin-RevealJS')) }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub register { |
20
|
1
|
|
|
1
|
1
|
53
|
my ($plugin, $app, $conf) = @_; |
21
|
1
|
|
|
|
|
4
|
my $home = $plugin->home; |
22
|
1
|
|
|
|
|
300
|
push @{ $app->static->paths }, $home->child('public'); |
|
1
|
|
|
|
|
10
|
|
23
|
1
|
|
|
|
|
83
|
push @{ $app->renderer->paths }, $home->child('templates'); |
|
1
|
|
|
|
|
9
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
52
|
$app->defaults('revealjs.init' => { |
26
|
|
|
|
|
|
|
controls => \1, |
27
|
|
|
|
|
|
|
progress => \1, |
28
|
|
|
|
|
|
|
history => \1, |
29
|
|
|
|
|
|
|
center => \1, |
30
|
|
|
|
|
|
|
transition => 'slide', #none/fade/slide/convex/concave/zoom |
31
|
|
|
|
|
|
|
}); |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
34
|
$app->helper('revealjs.export' => \&_export); |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
456
|
$app->helper(include_code => \&_include_code); |
36
|
1
|
|
|
|
|
90
|
$app->helper(include_sample => \&_include_sample); |
37
|
1
|
|
|
3
|
|
82
|
$app->helper(section => sub { shift->tag(section => @_) }); |
|
3
|
|
|
|
|
162044
|
|
38
|
|
|
|
|
|
|
$app->helper(markdown_section => sub { |
39
|
3
|
|
|
3
|
|
182
|
my ($c, @args) = @_; |
40
|
|
|
|
|
|
|
return $c->tag(section => data => { markdown => undef } => sub { |
41
|
3
|
|
|
|
|
85
|
return $c->tag(script => (type => 'text/template') => @args); |
42
|
3
|
|
|
|
|
42
|
}); |
43
|
1
|
|
|
|
|
81
|
}); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _include_code { |
47
|
15
|
|
|
15
|
|
1209
|
my ($c, $filename, %opts) = @_; |
48
|
15
|
|
66
|
|
|
49
|
my $file = $c->stash->{'revealjs.private.files'}{$filename} |
49
|
|
|
|
|
|
|
||= $c->app->home->rel_file($filename)->slurp; |
50
|
15
|
|
|
|
|
1876
|
my $mark = qr'^\h*(?:#+|-{2,}|/{2,}| or C<< |