diff options
author | Matias Linares <matiaslina@openmailbox.org> | 2017-04-01 13:20:01 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@openmailbox.org> | 2017-04-01 13:20:01 -0300 |
commit | 8c0e57d054cf0facd034f16c01032199b787415c (patch) | |
tree | b585e736d3eed4644e842a963cd834b52b8c1953 /ssg | |
parent | d6450b7165d9e87c07f1e16497decc1a698ca995 (diff) | |
download | ssg-8c0e57d054cf0facd034f16c01032199b787415c.tar.gz |
Add sidebar option
Diffstat (limited to 'ssg')
-rwxr-xr-x | ssg | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -15,9 +15,11 @@ my $outdir; my $VERSION = "v0.1"; my @exlude_files = ( - qr/TIL\/\w+\/*/ + qr/log\/\w+\/*/ ); +my $with_sidebar = 1; + sub help { print<<EOF $0 [switches] input-directory @@ -52,7 +54,10 @@ sub markdown { sub generate_page { my $file = $_[0]; - my $sidebar = transverse($indir, $file); + my $sidebar = ""; + if($with_sidebar) { + $sidebar = transverse($indir, $file); + } my $styles = styles; my $body = markdown $file; my $page = <<EOF @@ -70,7 +75,7 @@ $styles <body> <div class="header"> <h1 class="headerTitle"> -<a href="/">Deprecated</a> <span class="headerSubtitle">Just coding for fun</span> +<a href="/">Deprecated</a> <span class="headerSubtitle">Coding for fun</span> </h1> </div> @@ -100,6 +105,7 @@ sub generate_link { # Exclude links given($file) { when(@exlude_files) { + say "excluding $file"; return ""; } default { @@ -202,9 +208,10 @@ sub run_on { my %opts = ( 'v' => 0, 'h' => 0, - 'o' => "site.static/" + 'o' => "site.static/", + 's' => 1, ); -getopts('vho:', \%opts); +getopts('svho:', \%opts); $indir = shift @ARGV; if($opts{h}) { @@ -220,6 +227,10 @@ if(-d $opts{o}) { remove_tree($opts{o}); } +if($opts{s}) { + $with_sidebar = $opts{s}; +} + mkdir $opts{o}; $outdir = $opts{o}; |