aboutsummaryrefslogtreecommitdiff
path: root/ssg
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2017-04-01 13:20:01 -0300
committerMatias Linares <matiaslina@openmailbox.org>2017-04-01 13:20:01 -0300
commit8c0e57d054cf0facd034f16c01032199b787415c (patch)
treeb585e736d3eed4644e842a963cd834b52b8c1953 /ssg
parentd6450b7165d9e87c07f1e16497decc1a698ca995 (diff)
downloadssg-8c0e57d054cf0facd034f16c01032199b787415c.tar.gz
Add sidebar option
Diffstat (limited to 'ssg')
-rwxr-xr-xssg21
1 files changed, 16 insertions, 5 deletions
diff --git a/ssg b/ssg
index d2faa90..4f39a06 100755
--- a/ssg
+++ b/ssg
@@ -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};