X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=IkiWiki.pm;h=43ffb1fd8362802dc19f06074437e1f0a4c87f27;hb=68b6926420172f69a05bccbdbe7776755cd92a27;hp=a0a61ac642424e477d26aca7977036ce1355a692;hpb=5418385336e7eeab79166e7ddccefa6bdea8c759;p=ikiwiki.git diff --git a/IkiWiki.pm b/IkiWiki.pm index a0a61ac64..43ffb1fd8 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -220,6 +220,13 @@ sub getsetup () { safe => 1, rebuild => 1, }, + discussionpage => { + type => "string", + default => gettext("Discussion"), + description => "name of Discussion pages", + safe => 1, + rebuild => 1, + }, sslcookie => { type => "boolean", default => 0, @@ -1063,6 +1070,41 @@ sub htmllink ($$$;@) { return "$linktext"; } +sub openiduser ($) { + my $user=shift; + + if ($user =~ m!^https?://! && + eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) { + my $display; + + if (Net::OpenID::VerifiedIdentity->can("DisplayOfURL")) { + # this works in at least 2.x + $display = Net::OpenID::VerifiedIdentity::DisplayOfURL($user); + } + else { + # this only works in 1.x + my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user); + $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; +} + sub userlink ($) { my $user=shift; @@ -1213,9 +1255,10 @@ sub preprocess ($$$;$$) { ); }; if ($@) { - chomp $@; + my $error=$@; + chomp $error; $ret="[[!$command ". - gettext("Error").": $@"."]]"; + gettext("Error").": $error"."]]"; } } else { @@ -1346,7 +1389,7 @@ sub check_content (@) { foreach my $line (split("\n", $params{content})) { push @diff, $line if ! exists $old{$_}; } - $params{content}=join("\n", @diff); + $params{diff}=join("\n", @diff); } my $ok; @@ -2013,7 +2056,7 @@ sub match_created_before ($$;@) { } } else { - return IkiWiki::FailReason->new("$testpage has no ctime"); + return IkiWiki::ErrorReason->new("$testpage does not exist"); } } @@ -2033,7 +2076,7 @@ sub match_created_after ($$;@) { } } else { - return IkiWiki::FailReason->new("$testpage has no ctime"); + return IkiWiki::ErrorReason->new("$testpage does not exist"); } }