bliper

static html page generation in perl
git clone git://git.2f30.org/bliper.git
Log | Files | Refs | README | LICENSE

commit a7cbb337cdb463604f68d8d1d30a2174fae40da3
parent 6caaab4ba1ea7e6c297972a0749d1f60af75a37e
Author: cipher <haris@2f30.org>
Date:   Tue Feb 18 18:29:36 +0200

simpler way for article preview

Diffstat:
bin/bliper-generate.pl | 15+++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/bin/bliper-generate.pl b/bin/bliper-generate.pl @@ -67,24 +67,23 @@ foreach my $file (@files) { # Read each file(post) from indir, cat to $outdi print "\t==> output file:\t" . "../$outdir/$file.html\n"; my $array = qx(cat $file); - my @preview_array = split(/\n{2,}/, $array); # Pull title and first paragraph from article. - $preview_array[0] =~ s/\=+//g; # Strip the markdown format from title. You ARE starting your article with a title, right? RIGHT? - $preview_array[0] =~ s/^\#+//g; # Strip possible sub-header format. - $preview_array[1] =~ s/\=+//g; - $preview_array[1] =~ s/^\#+//g; - open (OUT, '>', "../$outdir/$file.html") or die $!; print OUT @articlet; my @html = qx(Markdown.pl $file); # markdown to html + my $preview = qx(Markdown.pl $file); print OUT @html; # append content print OUT @articleb; close OUT; + my @preview_array = split(/\n{2,}/, $preview); # Pull title and first paragraph from article. + $preview_array[0] =~ s/<h1/<h3/g; # change h1 to h3 for the index page. + open (OUT, '>>', "../$outdir/index.html") or die $!; # append links to stories in index.html # print OUT "<a href=\"$file.html\" class=\"indexlink\">$file</a>"; print OUT "<div class=\"preview\"> - <h3>$preview_array[0]</h3> - <p>$preview_array[1]<br> + $preview_array[0] + $preview_array[1]<br> + $preview_array[2]<br> <a class=\"previewlink\" href=\"$file.html\"> <em>read more...</em></a></p></div>"; print OUT "\n";