summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/aggregate.pm2
-rw-r--r--IkiWiki/Plugin/attachment.pm1
-rw-r--r--IkiWiki/Plugin/ddate.pm2
-rw-r--r--IkiWiki/Plugin/inline.pm2
-rw-r--r--IkiWiki/Plugin/prettydate.pm2
-rw-r--r--IkiWiki/Plugin/recentchanges.pm1
-rw-r--r--IkiWiki/Plugin/relativedate.pm18
7 files changed, 21 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index c18784e8b..2e4c86f24 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -460,7 +460,7 @@ sub aggregate (@) { #{{{
foreach my $feed (@_) {
$feed->{lastupdate}=time;
$feed->{newposts}=0;
- $feed->{message}=sprintf(gettext("processed ok at %s"),
+ $feed->{message}=sprintf(gettext("last checked %s"),
displaytime($feed->{lastupdate}));
$feed->{error}=0;
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..d9d8f7776 100644
--- a/IkiWiki/Plugin/relativedate.pm
+++ b/IkiWiki/Plugin/relativedate.pm
@@ -2,13 +2,17 @@
package IkiWiki::Plugin::relativedate;
use warnings;
+no warnings 'redefine';
use strict;
use IkiWiki 2.00;
+use POSIX;
+use Encode;
sub import { #{{{
add_underlay("javascript");
hook(type => "getsetup", id => "relativedate", call => \&getsetup);
hook(type => "format", id => "relativedate", call => \&format);
+ hook(type => "displaytime", id => "relativedate", call => \&display);
} # }}}
sub getsetup () { #{{{
@@ -39,4 +43,18 @@ sub include_javascript ($;$) { #{{{
'" type="text/javascript" charset="utf-8"></script>';
} #}}}
+sub display ($;$) { #{{{
+ 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",
+ localtime($time)));
+
+ return '<span class="date" title="'.$gmtime.'">'.
+ IkiWiki::formattime($time, $format).'</span>';
+} #}}}
+
1