diff options
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/CGI.pm | 5 | ||||
-rw-r--r-- | IkiWiki/Plugin/html.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 25 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Setup/Standard.pm | 2 |
5 files changed, 31 insertions, 7 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 9b5ee6c19..a41349be5 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -303,8 +303,7 @@ sub cgi_editpage ($$) { #{{{ # characters. my ($page)=$form->field('page'); $page=titlepage(possibly_foolish_untaint($page)); - if (! defined $page || ! length $page || - $page=~/$config{wiki_file_prune_regexp}/ || $page=~/^\//) { + if (! defined $page || ! length $page || file_pruned($page, $config{srcdir}) || $page=~/^\//) { error("bad page name"); } @@ -394,7 +393,7 @@ sub cgi_editpage ($$) { #{{{ my $best_loc; if (! defined $from || ! length $from || $from ne $form->field('from') || - $from=~/$config{wiki_file_prune_regexp}/ || + file_pruned($from, $config{srcdir}) || $from=~/^\// || $form->submitted eq "Preview") { @page_locs=$best_loc=$page; diff --git a/IkiWiki/Plugin/html.pm b/IkiWiki/Plugin/html.pm index 4270a7eb6..fd40d5ad9 100644 --- a/IkiWiki/Plugin/html.pm +++ b/IkiWiki/Plugin/html.pm @@ -12,7 +12,7 @@ sub import { #{{{ # ikiwiki defaults to skipping .html files as a security measure; # make it process them so this plugin can take effect - $config{wiki_file_prune_regexp} =~ s/\|\\\.x\?html\?\$//; + $config{wiki_file_prune_regexps} = [ grep { !m/\\\.x\?html\?\$/ } @{$config{wiki_file_prune_regexps}} ]; } # }}} sub htmlize (@) { #{{{ diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index c623df1c5..78a8813a3 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -9,6 +9,8 @@ use IkiWiki::Render; # for displaytime use URI; sub import { #{{{ + hook(type => "getopt", id => "inline", call => \&getopt); + hook(type => "checkconfig", id => "inline", call => \&checkconfig); hook(type => "preprocess", id => "inline", call => \&IkiWiki::preprocess_inline); hook(type => "pagetemplate", id => "inline", @@ -20,6 +22,29 @@ sub import { #{{{ call => \&IkiWiki::pingurl); } # }}} +sub getopt () { #{{{ + eval q{use Getopt::Long}; + error($@) if $@; + Getopt::Long::Configure('pass_through'); + GetOptions( + "rss!" => \$config{rss}, + "atom!" => \$config{atom}, + ); +} + +sub checkconfig () { #{{{ + if (($config{rss} || $config{atom}) && ! length $config{url}) { + error("Must specify url to wiki with --url when using --rss or --atom"); + } + if ($config{rss}) { + print STDERR "!!\n"; + push @{$config{wiki_file_prune_regexps}}, qr/\.rss$/; + } + if ($config{atom}) { + push @{$config{wiki_file_prune_regexps}}, qr/\.atom$/; + } +} #}}} + # Back to ikiwiki namespace for the rest, this code is very much # internal to ikiwiki even though it's separated into a plugin. package IkiWiki; diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index d08653711..4033468b2 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -218,7 +218,7 @@ sub refresh () { #{{{ no_chdir => 1, wanted => sub { $_=decode_utf8($_); - if (/$config{wiki_file_prune_regexp}/) { + if (file_pruned($_, $config{srcdir})) { $File::Find::prune=1; } elsif (! -d $_ && ! -l $_) { @@ -238,7 +238,7 @@ sub refresh () { #{{{ no_chdir => 1, wanted => sub { $_=decode_utf8($_); - if (/$config{wiki_file_prune_regexp}/) { + if (file_pruned($_, $config{underlaydir})) { $File::Find::prune=1; } elsif (! -d $_ && ! -l $_) { diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index 7512c2587..77c164e34 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -31,7 +31,7 @@ sub setup_standard { delete $setup{disable_plugins}; } if (exists $setup{exclude}) { - $config{wiki_file_prune_regexp}=qr/$config{wiki_file_prune_regexp}|$setup{exclude}/; + push @{$config{wiki_file_prune_regexps}}, $setup{exclude}; } if (! $config{render} && (! $config{refresh} || $config{wrappers})) { |