diff options
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/aggregate.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/attachment.pm | 1 | ||||
-rw-r--r-- | IkiWiki/Plugin/ddate.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/prettydate.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/recentchanges.pm | 1 | ||||
-rw-r--r-- | IkiWiki/Plugin/relativedate.pm | 16 |
7 files changed, 19 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 8ef5ca541..2e4c86f24 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -461,9 +461,7 @@ sub aggregate (@) { #{{{ $feed->{lastupdate}=time; $feed->{newposts}=0; $feed->{message}=sprintf(gettext("last checked %s"), - '<span class="date" title="'. - localtime($feed->{lastupdate}).'">'. - displaytime($feed->{lastupdate}).'</span>'); + displaytime($feed->{lastupdate})); $feed->{error}=0; debug(sprintf(gettext("checking feed %s ..."), $feed->{name})); diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index 6c1df488a..44781165c 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -280,7 +280,6 @@ sub attachment_list ($) { #{{{ link => htmllink($page, $page, $f, noimageinline => 1), size => IkiWiki::Plugin::filecheck::humansize((stat(_))[7]), mtime => displaytime($IkiWiki::pagemtime{$f}), - mtime_raw => $IkiWiki::pagemtime{$f}, }; } } diff --git a/IkiWiki/Plugin/ddate.pm b/IkiWiki/Plugin/ddate.pm index 6c36de0a6..c73317b2f 100644 --- a/IkiWiki/Plugin/ddate.pm +++ b/IkiWiki/Plugin/ddate.pm @@ -17,7 +17,7 @@ sub getsetup { #{{{ }, } #}}} -sub IkiWiki::displaytime ($;$) { #{{{ +sub IkiWiki::formattime ($;$) { #{{{ my $time=shift; my $format=shift; if (! defined $format) { diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 536d7cd02..6d88c2f15 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -316,9 +316,7 @@ sub preprocess_inline (@) { #{{{ $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); $template->param(title => pagetitle(basename($page))); $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat})); - $template->param(ctime_raw => scalar localtime($pagectime{$page})); $template->param(mtime => displaytime($pagemtime{$page}, $params{timeformat})); - $template->param(mtime_raw => scalar localtime($pagemtime{$page})); $template->param(first => 1) if $page eq $list[0]; $template->param(last => 1) if $page eq $list[$#list]; diff --git a/IkiWiki/Plugin/prettydate.pm b/IkiWiki/Plugin/prettydate.pm index e997be3ce..0f02142b0 100644 --- a/IkiWiki/Plugin/prettydate.pm +++ b/IkiWiki/Plugin/prettydate.pm @@ -84,7 +84,7 @@ sub checkconfig () { #{{{ } } #}}} -sub IkiWiki::displaytime ($;$) { #{{{ +sub IkiWiki::formattime ($;$) { #{{{ my $time=shift; my $format=shift; if (! defined $format) { diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 781e29723..a73ff37b9 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -173,7 +173,6 @@ sub store ($$$) { #{{{ $template->param( %$change, commitdate => displaytime($change->{when}, "%X %x"), - commitdate_raw => scalar localtime($change->{when}), wikiname => $config{wikiname}, ); diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm index 2895f6d57..a918889d2 100644 --- a/IkiWiki/Plugin/relativedate.pm +++ b/IkiWiki/Plugin/relativedate.pm @@ -2,8 +2,11 @@ package IkiWiki::Plugin::relativedate; use warnings; +no warnings 'redefine'; use strict; use IkiWiki 2.00; +use POSIX; +use Encode; sub import { #{{{ add_underlay("javascript"); @@ -39,4 +42,17 @@ sub include_javascript ($;$) { #{{{ '" type="text/javascript" charset="utf-8"></script>'; } #}}} +sub IkiWiki::displaytime ($;$) { #{{{ + my $time=shift; + my $format=shift; + + # This needs to be in a form that can be parsed by javascript. + # Being fairly human readable is also nice, as it will be exposed as the title + # if javascript is not available. + my $gmtime=decode_utf8(POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", gmtime($time))); + + return '<span class="date" title="'.$gmtime.'">'. + IkiWiki::formattime($time, $format).'</span>'; +} #}}} + 1 |