]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/inline.pm
add plugin safe/rebuild info (part 1 of 2)
[ikiwiki.git] / IkiWiki / Plugin / inline.pm
index 2f09019431b44fd4c5ab458f44fe90026367d996..9c336e7d7cb57c3ce98a8d9786e1b2fb96a0d71e 100644 (file)
@@ -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,54 @@ sub getopt () { #{{{
                "atom!" => \$config{atom},
                "allowrss!" => \$config{allowrss},
                "allowatom!" => \$config{allowatom},
+               "pingurl=s" => sub {
+                       push @{$config{pingurl}}, $_[1];
+               },      
        );
-}
+} #}}}
+
+sub getsetup () { #{{{
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+               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 +98,9 @@ sub checkconfig () { #{{{
        if ($config{atom}) {
                push @{$config{wiki_file_prune_regexps}}, qr/\.atom$/;
        }
+       if (! exists $config{pingurl}) {
+               $config{pingurl}=[];
+       }
 } #}}}
 
 sub format (@) { #{{{
@@ -202,7 +251,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);