autoindex: Ignore internal pages, and take underlay directories into account. Also, avoid making index pages for directories that contain no files.
parent
11a4ad8a4d
commit
9cb415f4a4
|
@ -35,31 +35,34 @@ sub refresh () { #{{{
|
||||||
error($@) if $@;
|
error($@) if $@;
|
||||||
|
|
||||||
my (%pages, %dirs);
|
my (%pages, %dirs);
|
||||||
|
foreach my $dir ($config{srcdir}, @{$config{underlaydirs}}, $config{underlaydir}) {
|
||||||
find({
|
find({
|
||||||
no_chdir => 1,
|
no_chdir => 1,
|
||||||
wanted => sub {
|
wanted => sub {
|
||||||
$_=decode_utf8($_);
|
$_=decode_utf8($_);
|
||||||
if (IkiWiki::file_pruned($_, $config{srcdir})) {
|
if (IkiWiki::file_pruned($_, $dir)) {
|
||||||
$File::Find::prune=1;
|
$File::Find::prune=1;
|
||||||
}
|
}
|
||||||
elsif (! -l $_) {
|
elsif (! -l $_) {
|
||||||
my ($f)=/$config{wiki_file_regexp}/; # untaint
|
my ($f)=/$config{wiki_file_regexp}/; # untaint
|
||||||
return unless defined $f;
|
return unless defined $f;
|
||||||
$f=~s/^\Q$config{srcdir}\E\/?//;
|
$f=~s/^\Q$dir\E\/?//;
|
||||||
return unless length $f;
|
return unless length $f;
|
||||||
|
return if $f =~ /\._([^.]+)$/; # skip internal page
|
||||||
if (! -d _) {
|
if (! -d _) {
|
||||||
$pages{pagename($f)}=1;
|
$pages{pagename($f)}=1;
|
||||||
}
|
}
|
||||||
else {
|
elsif ($dir eq $config{srcdir}) {
|
||||||
$dirs{$f}=1;
|
$dirs{$f}=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, $config{srcdir});
|
}, $dir);
|
||||||
|
}
|
||||||
|
|
||||||
my @needed;
|
my @needed;
|
||||||
foreach my $dir (keys %dirs) {
|
foreach my $dir (keys %dirs) {
|
||||||
if (! exists $pages{$dir}) {
|
if (! exists $pages{$dir} && grep /^$dir\/.*/, keys %pages) {
|
||||||
push @needed, $dir;
|
push @needed, $dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,9 @@ ikiwiki (2.60) UNRELEASED; urgency=low
|
||||||
* Clarify some wording in the setup documentation that could maybe lead
|
* Clarify some wording in the setup documentation that could maybe lead
|
||||||
users to putting paths with "~/" in the setup file, which doesn't work.
|
users to putting paths with "~/" in the setup file, which doesn't work.
|
||||||
Closes: #493835
|
Closes: #493835
|
||||||
|
* autoindex: Ignore internal pages, and take underlay directories into
|
||||||
|
account. Also, avoid making index pages for directories that contain
|
||||||
|
no files.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2008 11:35:46 -0400
|
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2008 11:35:46 -0400
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue