commit 59a0ba97017568f2820ccb830b8db965a11659aa
parent b8e5e1e453d284db1e0df7ae87ff72d693a03ec6
Author: cipher <haris@2f30.org>
Date: Mon, 4 Aug 2014 15:39:33 +0300
Removed css dialog for style, support for .md files (duh)
Diffstat:
2 files changed, 17 insertions(+), 44 deletions(-)
diff --git a/bin/bliper-blog.pl b/bin/bliper-blog.pl
@@ -4,10 +4,11 @@ use strict;
use Cwd;
my $maindir = getcwd;
+my $blogdir = 'output/blog.html';
my $articledir = 'main-articles';
my $count = 0;
-unlink "pages/blog";
+unlink "pages/blog.md";
opendir(my $dh, $articledir) or die "opendir($articledir): $!";
while (my $de = readdir($dh)) {
@@ -19,9 +20,10 @@ if ($count gt 0) {
chdir($articledir) or die "Can't change dir to $articledir $!\n";
my @files = <*>;
@files = reverse @files;
- open (OUT, '>>', "../pages/blog") or die "Could not open blog file $!\n";
+ open (OUT, '>>', "../pages/blog.md") or die "Could not open blog file $!\n";
foreach my $file (@files) {
- print OUT "[$file]($file.html)<br>";
+ $file =~ s/\.[^\.]*$//;
+ print OUT "<a class=\"blogitem\" href=\"$file.html\">$file</a><br>";
}
close OUT;
chdir($maindir) or die "Can't change dir to $maindir $!\n";
diff --git a/bin/bliper-generate.pl b/bin/bliper-generate.pl
@@ -2,7 +2,6 @@
use strict;
use Cwd;
-use feature "switch";
my $main_dir = getcwd;
my $main_page = 'output/index.html';
@@ -22,36 +21,6 @@ my $cssfile = 'output/style.css';
my @lightcss = qx(cat output/style.css.light);
my @darkcss = qx(cat output/style.css.dark);
-sub cssinit() {
- if (-f $cssfile) {
- print "\n.css file found.\n\n";
- } else {
- print "What stylesheet to use:
- \t1- Light
- \t2- Dark\n";
- print "Choose .css (1|2): ";
-
- chomp (my $css = <STDIN>);
- given ($css) {
- when (1) {
- open (OUT, '>', 'output/style.css');
- print OUT @lightcss;
- close OUT;
- print "Light css applied\n";
- }
- when (2) {
- open (OUT, '>', 'output/style.css');
- print OUT @darkcss;
- close OUT;
- print "Dark css applied\n";
- }
- default {
- print "Please select a valid option.\n";
- }
- }
- }
-}
-
unlink glob "output/*.html"; # Remove old pages
unlink "output/tmp"; # File which stores menu
open (OUT, '>', "$outdir/index.html") or die $!; # Create the index.html page
@@ -68,11 +37,12 @@ my @pages = <*>; # Create individual pages
foreach my $page (@pages) {
print "Generating page: ";
printf("%-30s", $page);
- print "\t==> output page:\t" . "../$outdir/$page.html\n";
my @array = qx(cat $page);
+ my $html = qx(Markdown.pl $page);
+ $page =~ s/\.[^\.]*$//;
+ print "\t==> output page:\t" . "../$outdir/$page.html\n";
open (OUT, '>', "../$outdir/$page.html") or die $!;
print OUT @paget;
- my $html = qx(Markdown.pl $page);
print OUT $html;
print OUT @pageb;
close OUT;
@@ -86,9 +56,9 @@ print OUT "<br>";
close OUT or die $!;
chdir($main_dir) or die "Can't change path to $main_dir $!\n";
-open (OUT, '>>', "$outdir/index.html") or die $!; # Create the index.html page
-print OUT "<p class=\"latart\">Latest articles:</p>";
-close OUT or die $!;
+# open (OUT, '>>', "$outdir/index.html") or die $!; # Create the index.html page
+# print OUT "<p class=\"latart\">Latest articles:</p>";
+# close OUT or die $!;
print "\nIndividual page generation completed. ";
chdir($indir) or die "Can't change path to $indir $!\n";
print "\nEntering " . getcwd . "\n\n";
@@ -99,12 +69,13 @@ my $i = 0;
foreach my $file (@files) { # Read each file(post) from indir, cat to $outdir/$file.html
print "Processing file: ";
printf ("%-30s", $file);
- print "\t==> output file:\t" . "../$outdir/$file.html\n";
my $array = qx(cat $file);
+ my $html = qx(Markdown.pl $file);
+ $file =~ s/\.[^\.]*$//;
+ print "\t==> output file:\t" . "../$outdir/$file.html\n";
open (OUT, '>', "../$outdir/$file.html") or die $!;
print OUT @articlet;
- my $html = qx(Markdown.pl $file);
print OUT $html; # Append content
print OUT @articleb;
close OUT;
@@ -135,11 +106,12 @@ my @ind_pages = <*>;
foreach my $file (@ind_pages) { # Read each page that we do not want to add in our menu
print "Processing pages:";
printf ("%-30s", $file);
- print "\t==> output file:\t" . "../$outdir/$file.html\n";
my @array = qx(cat $file);
+ my $html = qx(Markdown.pl $file); # Markdown to html
+ $file =~ s/\.[^\.]*$//;
+ print "\t==> output file:\t" . "../$outdir/$file.html\n";
open (OUT, '>', "../$outdir/$file.html") or die $!;
print OUT @articlet;
- my $html = qx(Markdown.pl $file); # Markdown to html
print OUT $html; # Append content
print OUT @articleb;
close OUT;
@@ -153,5 +125,4 @@ close OUT;
print "\nPages in pages_b/ generation completed. ";
print "\nLeaving " . getcwd . "\n";
chdir($main_dir) or die "Can't change path to $main_dir $!\n";
-cssinit();
print "Site generation completed. Files are in output/ dir.\n";