* map: Fix handling of common prefix to handle the case where it's

in a subdirectory. Patch by Larry Clapp.
master
Joey Hess 2007-12-28 17:22:17 -05:00
parent 191287b72f
commit 3e784ea8a1
3 changed files with 7 additions and 0 deletions

View File

@ -37,6 +37,9 @@ sub preprocess (@) { #{{{
my @b=split(/\//, $common_prefix); my @b=split(/\//, $common_prefix);
$common_prefix=""; $common_prefix="";
while (@a && @b && $a[0] eq $b[0]) { while (@a && @b && $a[0] eq $b[0]) {
if (length $common_prefix) {
$common_prefix.="/";
}
$common_prefix.=shift(@a); $common_prefix.=shift(@a);
shift @b; shift @b;
} }

2
debian/changelog vendored
View File

@ -7,6 +7,8 @@ ikiwiki (2.17) UNRELEASED; urgency=low
* conditional: Improve regexp testing for simple uses of pagespecs * conditional: Improve regexp testing for simple uses of pagespecs
that match only the page using the directive, adding 'included()' that match only the page using the directive, adding 'included()'
and supporting negated pagespecs and added whitespace. and supporting negated pagespecs and added whitespace.
* map: Fix handling of common prefix to handle the case where it's
in a subdirectory. Patch by Larry Clapp.
-- Joey Hess <joeyh@debian.org> Wed, 19 Dec 2007 16:39:07 -0500 -- Joey Hess <joeyh@debian.org> Wed, 19 Dec 2007 16:39:07 -0500

View File

@ -66,3 +66,5 @@ Note that you you don't get "blog" or "tags", and "life" and "tech" are links no
Map tries to calculate a "common prefix" between the pagespec and the page being rendered, and then later does some substitutions using the prefix. But the path has /'s in it and the common prefix doesn't, so it never matches correctly. So, add the /'s. Map tries to calculate a "common prefix" between the pagespec and the page being rendered, and then later does some substitutions using the prefix. But the path has /'s in it and the common prefix doesn't, so it never matches correctly. So, add the /'s.
-- [[users/Larry_Clapp]] -- [[users/Larry_Clapp]]
> Excellent problem description and analysis. Patch [[applied|done]] --[[Joey]]