aboutsummaryrefslogtreecommitdiff
path: root/slides/website-slides
blob: e1ae31b9289fb10552c3eb4f932b7cac3392e2cd (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env nix-shell
#!nix-shell -i perl -p less git perl --pure -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.09.tar.gz

=head1 NAME

website slides - Create new HTML slide presentations from org-mode template.

=head1 SYNOPSIS

website slides [options]

  Options:
    --help            Show the manpage.
    --name            The name of the folder containing the slideshow.

=head1 OPTIONS

=over 4

=item B<-h, --help>

Prints the manual page and exits.

=item B<-n, --name>

The name of the folder containing the slideshow.

=back

=head1 DESCRIPTION

B<website slides> creates an slideshow org-mode text files, that are later processed to produce HTML to be deployed statically.

=cut

use strict;
use warnings;
use Getopt::Long qw(:config no_ignore_case bundling);
use Pod::Usage qw(pod2usage);
use File::Basename qw(dirname);
use File::Path qw(make_path);
use File::Copy qw(copy);

my $help = 0;
my $name = '';
GetOptions(
  'help|h|?' => \$help,
  'name|n=s' => \$name
) or pod2usage(-verbose => 1, -exitval => 2);
pod2usage(-verbose => 2, -exitval => 0) if $help;
pod2usage(
  -verbose => 1,
  -exitval => 2,
  -message => "Missing required --name argument."
) if !$name;

my $dirname = dirname(__FILE__);
chdir $dirname ;
make_path "$name/reveal.js/";

chdir "reveal.js/";
`git --work-tree="../$name/reveal.js" checkout HEAD -- .`;
`git checkout \$(cat "../$name/reveal.js/VERSION" &> /dev/null || printf ".")`;
`git rev-parse HEAD > "../$name/VERSION"`;
chdir "../";

copy("base.org", "$name/index.org") or die "Failed to copy base.org file: $!";

print `realpath $name/index.org`;