aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpastebin/website-pastebin8
-rwxr-xr-xslides/new.sh23
-rwxr-xr-xslides/website-slides66
3 files changed, 70 insertions, 27 deletions
diff --git a/pastebin/website-pastebin b/pastebin/website-pastebin
index 6dacdfe..8512490 100755
--- a/pastebin/website-pastebin
+++ b/pastebin/website-pastebin
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
-#!nix-shell -i perl -p gettext less perl --pure -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.09.tar.gz
+#!nix-shell -i perl -p less perl --pure -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.09.tar.gz
=head1 NAME
@@ -29,7 +29,7 @@ The title of the pastebin. This string will be slugified and the output is used
=head1 DESCRIPTION
-B<website pastebin> creates pastebin org-mode text files, that are later processed to produce HTML to be deployed statically.
+B<website pastebin> creates a pastebin org-mode text files, that are later processed to produce HTML to be deployed statically.
=cut
@@ -37,8 +37,8 @@ use strict;
use warnings;
use Getopt::Long qw(:config no_ignore_case bundling);
use Pod::Usage qw(pod2usage);
-use Unicode::Normalize;
-use File::Basename;
+use Unicode::Normalize qw(NFKD);
+use File::Basename qw(dirname);
my $help = 0;
my $title = '';
diff --git a/slides/new.sh b/slides/new.sh
deleted file mode 100755
index b3d15dc..0000000
--- a/slides/new.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env bash
-set -eo pipefail
-
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-cd $SCRIPT_DIR
-
-function update-reveal-js(){
- pushd reveal.js/ > /dev/null
- git --work-tree="../$1/reveal.js" checkout HEAD -- .
- git checkout $(cat "../$1/reveal.js/VERSION" &> /dev/null || printf ".")
- git rev-parse HEAD > "../$1/VERSION"
- popd > /dev/null
-}
-
-[ -n "$1" ] || {
- echo "Missing folder name as argument."
- exit 1
-}
-
-outdir="$1"
-mkdir -p "$outdir/reveal.js"
-cp base.org "$outdir/index.org"
-update-reveal-js $outdir
diff --git a/slides/website-slides b/slides/website-slides
new file mode 100755
index 0000000..a6a774c
--- /dev/null
+++ b/slides/website-slides
@@ -0,0 +1,66 @@
+#!/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;
+
+if (!$name) {
+ die "Missing required --name argument.";
+}
+
+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: $!";