+sub getopt () { #{{{
+ eval q{use Getopt::Long};
+ error($@) if $@;
+ Getopt::Long::Configure('pass_through');
+ GetOptions(
+ "rss!" => \$config{rss},
+ "atom!" => \$config{atom},
+ "allowrss!" => \$config{allowrss},
+ "allowatom!" => \$config{allowatom},
+ );
+}
+
+sub checkconfig () { #{{{
+ if (($config{rss} || $config{atom}) && ! length $config{url}) {
+ error(gettext("Must specify url to wiki with --url when using --rss or --atom"));
+ }
+ if ($config{rss}) {
+ push @{$config{wiki_file_prune_regexps}}, qr/\.rss$/;
+ }
+ if ($config{atom}) {
+ push @{$config{wiki_file_prune_regexps}}, qr/\.atom$/;
+ }
+} #}}}
+
+sub sessioncgi () { #{{{
+ my $q=shift;
+ my $session=shift;
+
+ if ($q->param('do') eq 'blog') {
+ my $page=decode_utf8($q->param('title'));
+ $page=~s/\///g; # no slashes in blog posts
+ # if the page already exists, munge it to be unique
+ my $from=$q->param('from');
+ my $add="";
+ while (exists $IkiWiki::pagecase{lc($from."/".IkiWiki::titlepage($page).$add)}) {
+ $add=1 unless length $add;
+ $add++;
+ }
+ $q->param('page', $page.$add);
+ # now go create the page
+ $q->param('do', 'create');
+ IkiWiki::cgi_editpage($q, $session);
+ exit;
+ }
+}
+