summaryrefslogtreecommitdiff
path: root/makesite.pl
diff options
context:
space:
mode:
Diffstat (limited to 'makesite.pl')
-rwxr-xr-xmakesite.pl22
1 files changed, 7 insertions, 15 deletions
diff --git a/makesite.pl b/makesite.pl
index fa55cf8..f85f1c5 100755
--- a/makesite.pl
+++ b/makesite.pl
@@ -65,17 +65,6 @@ while(<*.md>) {
open my $articleHandle, "<", $articleFile;
my $headLine = <$articleHandle>;
$headLine = substr $headLine, 2, -1;
-
- # Extract description : first paragraph of the article
- my $description = "";
- while(my $line = <$articleHandle>) {
- if($. == 5) {
- $description = $line;
- last;
- }
- }
- $description =~ s/\R//; # remove any new line
- $description .= ".."; # to have "..." at the end of description
close $articleHandle;
# Extract output file name: MD file name without the date
@@ -91,7 +80,7 @@ while(<*.md>) {
my $year = substr $articleFile, 0, 4;
my $month = substr $articleFile, 4, 2;
my $day = substr $articleFile, 6, 2;
- my $articleData = { date => "$month-$day-$year", title => $headLine, address => $pageFile, description => $description };
+ my $articleData = { date => "$month-$day-$year", title => $headLine, address => $pageFile, description => $articleContent };
push @articleList, $articleData;
}
@@ -110,8 +99,8 @@ open my $outHandle, ">", "output/rss.xml";
# Write channel info and insert publication and build dates
open my $inHandle, "<", "template/rss.xml";
my $pubDate = Time::Piece->strptime($articleList[$#articleList]{date}, "%m-%d-%Y"); # Last article date
-$pubDate = $pubDate->strftime();
-my $buildDate = gmtime->strftime(); # Current date
+$pubDate = $pubDate->strftime("%a, %d %b %Y %H:%M:%S %z");
+my $buildDate = gmtime->strftime("%a, %d %b %Y %H:%M:%S %z"); # Current date
while(<$inHandle>) {
$_ =~ s/\$link/$BASE_URL/;
$_ =~ s/\$pubDate/$pubDate/;
@@ -123,7 +112,10 @@ for(my $i = $#articleList; $i >= 0; $i--) {
open my $inHandle, "<", "template/rss-item.xml";
my $url = $BASE_URL . $articleList[$i]{address};
my $pubDate = Time::Piece->strptime($articleList[$i]{date}, "%m-%d-%Y");
- $pubDate = $pubDate->strftime();
+ $pubDate = $pubDate->strftime("%a, %d %b %Y %H:%M:%S %z");
+ # No relative link in RSS feed
+ $articleList[$i]{description} =~ s/href="\//href="$BASE_URL/g;
+ $articleList[$i]{description} =~ s/src="\//src="$BASE_URL/g;
while(<$inHandle>) {
$_ =~ s/\$title/$articleList[$i]{title}/;
$_ =~ s/\$link/$url/;