From 3e784ea8a1aeb41aa181c29b499cf76ab83dc6d0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 28 Dec 2007 17:22:17 -0500 Subject: [PATCH] * map: Fix handling of common prefix to handle the case where it's in a subdirectory. Patch by Larry Clapp. --- IkiWiki/Plugin/map.pm | 3 +++ debian/changelog | 2 ++ ...__t_calculate___34__common__95__prefix__34___correctly.mdwn | 2 ++ 3 files changed, 7 insertions(+) diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index 5b6af1f36..581ae5011 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -37,6 +37,9 @@ sub preprocess (@) { #{{{ my @b=split(/\//, $common_prefix); $common_prefix=""; while (@a && @b && $a[0] eq $b[0]) { + if (length $common_prefix) { + $common_prefix.="/"; + } $common_prefix.=shift(@a); shift @b; } diff --git a/debian/changelog b/debian/changelog index c48d538e9..71119b3f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ ikiwiki (2.17) UNRELEASED; urgency=low * conditional: Improve regexp testing for simple uses of pagespecs that match only the page using the directive, adding 'included()' 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 Wed, 19 Dec 2007 16:39:07 -0500 diff --git a/doc/bugs/map_doesn__39__t_calculate___34__common__95__prefix__34___correctly.mdwn b/doc/bugs/map_doesn__39__t_calculate___34__common__95__prefix__34___correctly.mdwn index 9436cbd0c..d6923605d 100644 --- a/doc/bugs/map_doesn__39__t_calculate___34__common__95__prefix__34___correctly.mdwn +++ b/doc/bugs/map_doesn__39__t_calculate___34__common__95__prefix__34___correctly.mdwn @@ -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. -- [[users/Larry_Clapp]] + +> Excellent problem description and analysis. Patch [[applied|done]] --[[Joey]] -- 2.44.0