| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::revealup::cli::export::html; | 
| 2 | 2 |  |  | 2 |  | 911 | use App::revealup::base; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 13 |  | 
| 3 | 2 |  |  | 2 |  | 401 | use App::revealup::util; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 145 |  | 
| 4 | 2 |  |  | 2 |  | 438 | use App::revealup::builder; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 57 |  | 
| 5 | 2 |  |  | 2 |  | 12 | use Path::Tiny qw/path/; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 90 |  | 
| 6 | 2 |  |  | 2 |  | 11 | use Term::ANSIColor; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 79 |  | 
| 7 | 2 |  |  | 2 |  | 11 | use Pod::Usage; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 959 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | has 'theme'; | 
| 10 |  |  |  |  |  |  | has 'transition'; | 
| 11 |  |  |  |  |  |  | has 'width'; | 
| 12 |  |  |  |  |  |  | has 'height'; | 
| 13 |  |  |  |  |  |  | has 'output' => 'original.html'; | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub run { | 
| 16 | 1 |  |  | 1 | 0 | 8 | my ($self, @args) = @_; | 
| 17 | 1 |  |  |  |  | 2 | my $opt; | 
| 18 |  |  |  |  |  |  | parse_options( | 
| 19 |  |  |  |  |  |  | \@args, | 
| 20 |  |  |  |  |  |  | 'theme=s' => \$opt->{theme}, | 
| 21 |  |  |  |  |  |  | 'transition=s' => \$opt->{transition}, | 
| 22 |  |  |  |  |  |  | 'width=i' => \$opt->{width}, | 
| 23 |  |  |  |  |  |  | 'height=i' => \$opt->{height}, | 
| 24 |  |  |  |  |  |  | 'output=s' => \$opt->{output}, | 
| 25 | 1 |  |  |  |  | 7 | ); | 
| 26 | 1 |  |  |  |  | 27 | for my $key (keys %$opt) { | 
| 27 | 5 |  |  |  |  | 15 | $self->$key( $opt->{$key} ); | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 1 | 50 |  |  |  | 20 | if (path($self->output)->exists) { | 
| 31 | 0 |  |  |  |  | 0 | App::revealup::util::error("@{[$self->output]} exists"); | 
|  | 0 |  |  |  |  | 0 |  | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 1 |  |  |  |  | 40 | my $filename = shift @args; | 
| 35 | 1 | 50 |  |  |  | 3 | if (!path($filename)->exists) { | 
| 36 | 0 |  |  |  |  | 0 | App::revealup::util::error("$filename is not exist"); | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 | 1 |  | 50 |  |  | 39 | my $builder = App::revealup::builder->new( | 
|  |  |  | 50 |  |  |  |  | 
|  |  |  | 50 |  |  |  |  | 
|  |  |  | 50 |  |  |  |  | 
|  |  |  | 50 |  |  |  |  | 
| 40 |  |  |  |  |  |  | filename => $filename || '', | 
| 41 |  |  |  |  |  |  | theme => $self->theme || '', | 
| 42 |  |  |  |  |  |  | transition => $self->transition || '', | 
| 43 |  |  |  |  |  |  | width => $self->width || 0, | 
| 44 |  |  |  |  |  |  | height => $self->height || 0, | 
| 45 |  |  |  |  |  |  | ); | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 1 |  |  |  |  | 4 | my $html = $builder->build_html(); | 
| 48 | 1 | 50 |  |  |  | 4 | die if !$html; | 
| 49 | 1 |  |  |  |  | 4 | path($self->output)->spew_utf8($html); | 
| 50 | 1 |  |  |  |  | 640 | App::revealup::util::info("Generated your HTML to @{[$self->output]}"); | 
|  | 1 |  |  |  |  | 4 |  | 
| 51 | 1 |  |  |  |  | 6 | my $reveal_path = App::revealup::util::share_path([qw/share revealjs/]); | 
| 52 | 1 |  |  |  |  | 24 | App::revealup::util::info("Copy command for the revealjs directory is:"); | 
| 53 | 1 |  |  |  |  | 3 | App::revealup::util::info("cp -r @{[$reveal_path->absolute]} ./revealjs"); | 
|  | 1 |  |  |  |  | 5 |  | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | 1; |