Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

prettify_date takes a language now

  • Loading branch information...
commit 007cbf9cfbb353c5547310930537362e7c6b54aa 1 parent ebe3a63
@sartak authored
Showing with 9 additions and 5 deletions.
  1. +7 −3 generate.pl
  2. +2 −2 lib/Sartak/Blog/Talks.pm
View
10 generate.pl
@@ -22,7 +22,11 @@
sub prettify_date {
my $date = shift;
+ my $lang = shift;
+
my ($y, $m, $d) = split '-', $date;
+
+ return "$y$m$d" if $lang eq 'ja';
return "$months[$m] $d, $y";
}
@@ -65,7 +69,7 @@ sub new_article {
$headers{date} = "$year-$mon-$day";
}
- my $date = prettify_date($headers{date});
+ my $date = prettify_date($headers{date}, 'en');
$content = qq[
<header>
@@ -176,7 +180,7 @@ sub generate_index {
my $posts;
each_article {
my $article = shift;
- my $date = prettify_date($article->{date});
+ my $date = prettify_date($article->{date}, 'en');
$posts .= qq[<li>
<span class="date">$date</span>
<span class="title"><a href="$article->{url}">$article->{title}</a></span>
@@ -197,7 +201,7 @@ sub generate_drafts {
for my $article (grep { $_->{draft} } @articles) {
generate_article($article);
- my $date = prettify_date($article->{date});
+ my $date = prettify_date($article->{date}, 'en');
$posts .= qq[<li>
<span class="date">$date</span>
<span class="title"><a href="$article->{url}">$article->{title}</a></span>
View
4 lib/Sartak/Blog/Talks.pm
@@ -347,7 +347,7 @@ sub generate_talks_html {
my $output = '';
for my $talk (@talks) {
- my $date = main::prettify_date($talk->{date});
+ my $date = main::prettify_date($talk->{date}, 'en');
my $conference = $talk->{conference};
$output .= qq[<li>
@@ -438,7 +438,7 @@ sub talk_pages {
. '</ul>';
}
- my $date = main::prettify_date($talk->{date});
+ my $date = main::prettify_date($talk->{date}, 'en');
my $presented = $talk->{future} ? "To be presented" : "Presented";
my $html = << " END";
Please sign in to comment.
Something went wrong with that request. Please try again.