X-Git-Url: http://git.tremily.us/?p=ikiwiki.git;a=blobdiff_plain;f=IkiWiki%2FPlugin%2Finline.pm;h=ed7a584083aeb1cc1b55c321851a094664acb608;hp=5517e3c9434e9d483f343e8c676db6da42efcda7;hb=73af360e994306c1d0b14a69a4aa04750e61f0ef;hpb=a65d312467c5ab179ecf4aa715790f371a46634a diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 5517e3c94..ed7a58408 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -15,6 +15,7 @@ my $nested=0; sub import { #{{{ hook(type => "getopt", id => "inline", call => \&getopt); + hook(type => "getsetup", id => "inline", call => \&getsetup); hook(type => "checkconfig", id => "inline", call => \&checkconfig); hook(type => "sessioncgi", id => "inline", call => \&sessioncgi); hook(type => "preprocess", id => "inline", @@ -27,7 +28,6 @@ sub import { #{{{ # pings interrupting page builds. hook(type => "change", id => "inline", call => \&IkiWiki::pingurl); - } # }}} sub getopt () { #{{{ @@ -39,8 +39,50 @@ sub getopt () { #{{{ "atom!" => \$config{atom}, "allowrss!" => \$config{allowrss}, "allowatom!" => \$config{allowatom}, + "pingurl=s" => sub { + push @{$config{pingurl}}, $_[1]; + }, ); -} +} #}}} + +sub getsetup () { #{{{ + return + rss => { + type => "boolean", + example => 0, + description => "enable rss feeds by default?", + safe => 1, + rebuild => 1, + }, + atom => { + type => "boolean", + example => 0, + description => "enable atom feeds by default?", + safe => 1, + rebuild => 1, + }, + allowrss => { + type => "boolean", + example => 0, + description => "allow rss feeds to be used?", + safe => 1, + rebuild => 1, + }, + allowatom => { + type => "boolean", + example => 0, + description => "allow atom feeds to be used?", + safe => 1, + rebuild => 1, + }, + pingurl => { + type => "string", + example => "http://rpc.technorati.com/rpc/ping", + description => "urls to ping (using XML-RPC) on feed update", + safe => 1, + rebuild => 0, + }, +} #}}} sub checkconfig () { #{{{ if (($config{rss} || $config{atom}) && ! length $config{url}) { @@ -52,6 +94,9 @@ sub checkconfig () { #{{{ if ($config{atom}) { push @{$config{wiki_file_prune_regexps}}, qr/\.atom$/; } + if (! exists $config{pingurl}) { + $config{pingurl}=[]; + } } #}}} sub format (@) { #{{{ @@ -202,7 +247,7 @@ sub preprocess_inline (@) { #{{{ my $atomurl=basename(atompage($params{destpage}).$feednum) if $feeds && $atom; my $ret=""; - if ($config{cgiurl} && ! $params{preview} && (exists $params{rootpage} || + if (length $config{cgiurl} && ! $params{preview} && (exists $params{rootpage} || (exists $params{postform} && yesno($params{postform})))) { # Add a blog post form, with feed buttons. my $formtemplate=template("blogpost.tmpl", blind_cache => 1); @@ -419,13 +464,13 @@ sub genfeed ($$$$$@) { #{{{ my $page=shift; my @pages=@_; - my $url=URI->new(encode_utf8($config{url}."/".urlto($page,""))); + my $url=URI->new(encode_utf8(urlto($page,"",1))); my $itemtemplate=template($feedtype."item.tmpl", blind_cache => 1); my $content=""; my $lasttime = 0; foreach my $p (@pages) { - my $u=URI->new(encode_utf8($config{url}."/".urlto($p, ""))); + my $u=URI->new(encode_utf8(urlto($p, "", 1))); my $pcontent = absolute_urls(get_inline_content($p, $page), $url); $itemtemplate->param( @@ -521,7 +566,7 @@ sub pingurl (@) { #{{{ foreach my $page (keys %toping) { my $title=pagetitle(basename($page), 0); - my $url="$config{url}/".urlto($page, ""); + my $url=urlto($page, "", 1); foreach my $pingurl (@{$config{pingurl}}) { debug("Pinging $pingurl for $page"); eval {