summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm4
-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
-rw-r--r--IkiWiki/Render.pm2
-rw-r--r--IkiWiki/Setup/Standard.pm2
10 files changed, 25 insertions, 11 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index dac522eea..4399d0dcb 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -278,9 +278,9 @@ sub check_banned ($$) { #{{{
sub cgi_getsession ($) { #{{{
my $q=shift;
- eval q{use CGI::Session};
+ eval q{use CGI::Session; use HTML::Entities};
error($@) if $@;
- CGI::Session->name("ikiwiki_session_".encode_utf8($config{wikiname}));
+ CGI::Session->name("ikiwiki_session_".encode_entities($config{wikiname}));
my $oldmask=umask(077);
my $session = eval {
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
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 8385c1aff..bc997ffb0 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -109,9 +109,7 @@ sub genpage ($$) { #{{{
backlinks => $backlinks,
more_backlinks => $more_backlinks,
mtime => displaytime($pagemtime{$page}),
- mtime_raw => scalar localtime($pagemtime{$page}),
ctime => displaytime($pagectime{$page}),
- ctime_raw => scalar localtime($pagectime{$page}),
baseurl => baseurl($page),
);
diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm
index 92f887f0c..e6bff2826 100644
--- a/IkiWiki/Setup/Standard.pm
+++ b/IkiWiki/Setup/Standard.pm
@@ -26,6 +26,8 @@ sub dumpline ($$$$) { #{{{
local $Data::Dumper::Pad="\t";
local $Data::Dumper::Sortkeys=1;
local $Data::Dumper::Quotekeys=0;
+ # only the perl version preserves utf-8 in output
+ local $Data::Dumper::Useperl=1;
my $dumpedvalue;
if (($type eq 'boolean' || $type eq 'integer') && $value=~/^[0-9]+$/) {