summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-07-19 12:36:01 +0200
committerJoey Hess <joey@gnu.kitenet.net>2009-07-19 12:36:01 +0200
commitec965fc92cd41f597c6e8e88584b9a688407c8c6 (patch)
tree410173c14f66ae62a6436ea00b73bb470c9d1dda /IkiWiki/Plugin
parent86edd73d169600875a10a635ef8df4a644545b0d (diff)
parentfa2c3a3dba2a4589b63cf445ec9e33ec19be627e (diff)
Merge branch 'master' into po
Conflicts: debian/changelog
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/aggregate.pm12
-rw-r--r--IkiWiki/Plugin/highlight.pm3
-rw-r--r--IkiWiki/Plugin/img.pm3
-rw-r--r--IkiWiki/Plugin/meta.pm13
-rw-r--r--IkiWiki/Plugin/openid.pm29
-rw-r--r--IkiWiki/Plugin/passwordauth.pm11
-rw-r--r--IkiWiki/Plugin/prettydate.pm2
-rw-r--r--IkiWiki/Plugin/svn.pm4
8 files changed, 35 insertions, 42 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index e1baae666..5a9eb433d 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -404,6 +404,7 @@ sub mergestate () {
}
# New guids can be created during aggregation.
+ # Guids have a few fields that may be updated during aggregation.
# It's also possible that guids were removed from the on-disk state
# while the aggregation was in process. That would only happen if
# their feed was also removed, so any removed guids added back here
@@ -412,6 +413,11 @@ sub mergestate () {
if (! exists $guids{$guid}) {
$guids{$guid}=$myguids{$guid};
}
+ else {
+ foreach my $field (qw{md5}) {
+ $guids{$guid}->{$field}=$myguids{$guid}->{$field};
+ }
+ }
}
}
@@ -644,11 +650,13 @@ sub add_page (@) {
# creation time on record for the new page.
utime $mtime, $mtime, "$config{srcdir}/".htmlfn($guid->{page});
# Store it in pagectime for expiry code to use also.
- $IkiWiki::pagectime{$guid->{page}}=$mtime;
+ $IkiWiki::pagectime{$guid->{page}}=$mtime
+ unless exists $IkiWiki::pagectime{$guid->{page}};
}
else {
# Dummy value for expiry code.
- $IkiWiki::pagectime{$guid->{page}}=time;
+ $IkiWiki::pagectime{$guid->{page}}=time
+ unless exists $IkiWiki::pagectime{$guid->{page}};
}
}
diff --git a/IkiWiki/Plugin/highlight.pm b/IkiWiki/Plugin/highlight.pm
index 20f79ef57..9bdde85ae 100644
--- a/IkiWiki/Plugin/highlight.pm
+++ b/IkiWiki/Plugin/highlight.pm
@@ -4,6 +4,7 @@ package IkiWiki::Plugin::highlight;
use warnings;
use strict;
use IkiWiki 3.00;
+use Encode;
# locations of highlight's files
my $filetypes="/etc/highlight/filetypes.conf";
@@ -69,7 +70,7 @@ sub htmlizefallback {
return;
}
- return highlight($langfile, shift);
+ return Encode::decode_utf8(highlight($langfile, shift));
}
my %ext2lang;
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index a697fea19..78e378917 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -121,8 +121,9 @@ sub preprocess (@) {
my $imgtag='<img src="'.$imgurl.
'" width="'.$im->Get("width").
'" height="'.$im->Get("height").'"'.
- (exists $params{alt} ? '" alt="'.$params{alt}.'"' : '').
+ (exists $params{alt} ? ' alt="'.$params{alt}.'"' : '').
(exists $params{title} ? ' title="'.$params{title}.'"' : '').
+ (exists $params{align} ? ' align="'.$params{align}.'"' : '').
(exists $params{class} ? ' class="'.$params{class}.'"' : '').
(exists $params{id} ? ' id="'.$params{id}.'"' : '').
' />';
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index cc5455d64..b2295923e 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -163,17 +163,22 @@ sub preprocess (@) {
"\" type=\"text/css\" />";
}
elsif ($key eq 'openid') {
+ my $delegate=0; # both by default
+ if (exists $params{delegate}) {
+ $delegate = 1 if lc $params{delegate} eq 'openid';
+ $delegate = 2 if lc $params{delegate} eq 'openid2';
+ }
if (exists $params{server} && safeurl($params{server})) {
push @{$metaheaders{$page}}, '<link href="'.encode_entities($params{server}).
- '" rel="openid.server" />';
+ '" rel="openid.server" />' if $delegate ne 2;
push @{$metaheaders{$page}}, '<link href="'.encode_entities($params{server}).
- '" rel="openid2.provider" />';
+ '" rel="openid2.provider" />' if $delegate ne 1;
}
if (safeurl($value)) {
push @{$metaheaders{$page}}, '<link href="'.encode_entities($value).
- '" rel="openid.delegate" />';
+ '" rel="openid.delegate" />' if $delegate ne 2;
push @{$metaheaders{$page}}, '<link href="'.encode_entities($value).
- '" rel="openid2.local_id" />';
+ '" rel="openid2.local_id" />' if $delegate ne 1;
}
if (exists $params{"xrds-location"} && safeurl($params{"xrds-location"})) {
push @{$metaheaders{$page}}, '<meta http-equiv="X-XRDS-Location"'.
diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm
index 5424c57e2..dc0e0f48e 100644
--- a/IkiWiki/Plugin/openid.pm
+++ b/IkiWiki/Plugin/openid.pm
@@ -180,33 +180,4 @@ sub getobj ($$) {
);
}
-package IkiWiki;
-
-# This is not used by this plugin, but this seems the best place to put it.
-# Used elsewhere to pretty-display the name of an openid user.
-sub openiduser ($) {
- my $user=shift;
-
- if ($user =~ m!^https?://! &&
- eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) {
- my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user);
- my $display=$oid->display;
- # Convert "user.somehost.com" to "user [somehost.com]"
- # (also "user.somehost.co.uk")
- if ($display !~ /\[/) {
- $display=~s/^([-a-zA-Z0-9]+?)\.([-.a-zA-Z0-9]+\.[a-z]+)$/$1 [$2]/;
- }
- # Convert "http://somehost.com/user" to "user [somehost.com]".
- # (also "https://somehost.com/user/")
- if ($display !~ /\[/) {
- $display=~s/^https?:\/\/(.+)\/([^\/]+)\/?$/$2 [$1]/;
- }
- $display=~s!^https?://!!; # make sure this is removed
- eval q{use CGI 'escapeHTML'};
- error($@) if $@;
- return escapeHTML($display);
- }
- return;
-}
-
1
diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm
index 90e2ca564..8cf5af51e 100644
--- a/IkiWiki/Plugin/passwordauth.pm
+++ b/IkiWiki/Plugin/passwordauth.pm
@@ -8,9 +8,10 @@ use IkiWiki 3.00;
sub import {
hook(type => "getsetup", id => "passwordauth", "call" => \&getsetup);
- hook(type => "formbuilder_setup", id => "passwordauth", call => \&formbuilder_setup);
- hook(type => "formbuilder", id => "passwordauth", call => \&formbuilder);
+ hook(type => "formbuilder_setup", id => "passwordauth", call => \&formbuilder_setup);
+ hook(type => "formbuilder", id => "passwordauth", call => \&formbuilder);
hook(type => "sessioncgi", id => "passwordauth", call => \&sessioncgi);
+ hook(type => "auth", id => "passwordauth", call => \&auth);
}
sub getsetup () {
@@ -337,4 +338,10 @@ sub sessioncgi ($$) {
}
}
+sub auth ($$) {
+ # While this hook is not currently used, it needs to exist
+ # so ikiwiki knows that the wiki supports logins, and will
+ # enable the Preferences page.
+}
+
1
diff --git a/IkiWiki/Plugin/prettydate.pm b/IkiWiki/Plugin/prettydate.pm
index e155dd39b..82d8a3df3 100644
--- a/IkiWiki/Plugin/prettydate.pm
+++ b/IkiWiki/Plugin/prettydate.pm
@@ -33,7 +33,7 @@ sub default_timetable {
gettext("%A evening"), # 6
"", # 7
gettext("late %A evening"), # 8
- "", # 9 # 9
+ "", # 9
gettext("%A night"), # 10
"", # 11
];
diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm
index fe55e7d08..06b987f51 100644
--- a/IkiWiki/Plugin/svn.pm
+++ b/IkiWiki/Plugin/svn.pm
@@ -243,10 +243,10 @@ sub rcs_rename ($$) {
if (-d "$config{srcdir}/.svn") {
# Add parent directory for $dest
- my $parent=dirname($dest);
+ my $parent=IkiWiki::dirname($dest);
if (! -d "$config{srcdir}/$parent/.svn") {
while (! -d "$config{srcdir}/$parent/.svn") {
- $parent=dirname($dest);
+ $parent=IkiWiki::dirname($dest);
}
if (system("svn", "add", "--quiet", "$config{srcdir}/$parent") != 0) {
warn("svn add $parent failed\n");