aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-21 19:36:15 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-21 19:36:15 +0000
commit472dabbb6002219d324ae8480df57d02b6f0ca94 (patch)
treed35aeb732eb885d7e1bcc2337e1cc1f452c6801b /IkiWiki.pm
parentc648b2b79b2a0b19364183e700764292d0a0d521 (diff)
downloadikiwiki-472dabbb6002219d324ae8480df57d02b6f0ca94.tar
ikiwiki-472dabbb6002219d324ae8480df57d02b6f0ca94.tar.gz
* Turn $config{wiki_file_prune_regexps} into an array that is easier to
manipulate. * Only exclude rss and atom files from processing if the inline plugin is enabled and that feed type is enabled. Else it's just a copyable file type. * Move rss and atom option handling code into the inline plugin. * Applied a rather old patch from Recai to fix the "pruning is too strict" issue. Now you can have wiki source directories inside dotdirs and the like, if you want.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 4869b3ef3..f76e9fe30 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -22,12 +22,14 @@ our $VERSION = 1.01; # plugin interface version
use Memoize;
memoize("abs2rel");
memoize("pagespec_translate");
+memoize("file_pruned");
my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
sub defaultconfig () { #{{{
- wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$|\.atom$|.arch-ids/|{arch}/)},
+ wiki_file_prune_regexps => [qr/\.\./, qr/^\./, qr/\/\./, qr/\.x?html?$/,
+ qr/(^|\/).svn\//, qr/.arch-ids\//, qr/{arch}\//],
wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/,
wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/,
web_commit_regexp => qr/^web commit (by (.*?(?=: |$))|from (\d+\.\d+\.\d+\.\d+)):?(.*)/,
@@ -96,9 +98,6 @@ sub checkconfig () { #{{{
if ($config{cgi} && ! length $config{url}) {
error("Must specify url to wiki with --url when using --cgi\n");
}
- if (($config{rss} || $config{atom}) && ! length $config{url}) {
- error("Must specify url to wiki with --url when using --rss or --atom\n");
- }
$config{wikistatedir}="$config{srcdir}/.ikiwiki"
unless exists $config{wikistatedir};
@@ -780,6 +779,16 @@ sub add_depends ($$) { #{{{
}
} # }}}
+sub file_pruned ($$) { #{{{
+ require File::Spec;
+ my $file=File::Spec->canonpath(shift);
+ my $base=File::Spec->canonpath(shift);
+ $file=~s#^\Q$base\E/*##;
+
+ my $regexp='('.join('|', @{$config{wiki_file_prune_regexps}}).')';
+ $file =~ m/$regexp/;
+} #}}}
+
sub pagespec_match ($$) { #{{{
my $page=shift;
my $spec=shift;