diff options
author | http://www.cse.unsw.edu.au/~willu/ <http://www.cse.unsw.edu.au/~willu/@web> | 2008-09-21 04:30:28 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2008-09-21 04:30:28 -0400 |
commit | 57682e72d91a9954929b0f767c276d3e58847722 (patch) | |
tree | 94387a5c38d7fe5e7c8a8392f94c9eb8637d6af2 | |
parent | a32f0a64fe4d7fb43972ff830f584c1c6a3e73a8 (diff) |
Add patch
-rw-r--r-- | doc/bugs/multiple_pages_with_same_name.mdwn | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/bugs/multiple_pages_with_same_name.mdwn b/doc/bugs/multiple_pages_with_same_name.mdwn index 191de8be5..58a004da8 100644 --- a/doc/bugs/multiple_pages_with_same_name.mdwn +++ b/doc/bugs/multiple_pages_with_same_name.mdwn @@ -9,3 +9,32 @@ Anyway, I'm thinking about possible solutions. The best option I've come up wit Suggestions welcome. -- [[Will]] + +> Ok, this turned out not to be a hard change. [[patch]] is below. With this patch you can tell IkiWiki not to drop the suffix when you register a hook: `hook(type => "htmlize", id => $lang, call => \&htmlize, leavesuffix => 1);` + + diff --git a/IkiWiki.pm b/IkiWiki.pm + index 4e4da11..853f905 100644 + --- a/IkiWiki.pm + +++ b/IkiWiki.pm + @@ -618,7 +618,7 @@ sub pagename ($) { #{{{ + + my $type=pagetype($file); + my $page=$file; + - $page=~s/\Q.$type\E*$// if defined $type; + + $page=~s/\Q.$type\E*$// if defined $type && !$hooks{htmlize}{$type}{leavesuffix}; + return $page; + } #}}} + + diff --git a/t/pagename.t b/t/pagename.t + index 96e6a87..58811b9 100755 + --- a/t/pagename.t + +++ b/t/pagename.t + @@ -6,7 +6,7 @@ use Test::More tests => 5; + BEGIN { use_ok("IkiWiki"); } + + # Used internally. + -$IkiWiki::hooks{htmlize}{mdwn}=1; + +$IkiWiki::hooks{htmlize}{mdwn}{call}=1; + + is(pagename("foo.mdwn"), "foo"); + is(pagename("foo/bar.mdwn"), "foo/bar"); |