From: Joey Hess Date: Wed, 23 Jul 2008 22:57:27 +0000 (-0400) Subject: case preservation X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/8b063a24d909bfac056668f00513bf92f6f17817?hp=4691a2ad39cce273231fddd9a589b4f8fdc1b063 case preservation --- diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm index 51afaec9e..e20109888 100644 --- a/IkiWiki/Plugin/link.pm +++ b/IkiWiki/Plugin/link.pm @@ -11,6 +11,7 @@ sub import { #{{{ hook(type => "checkconfig", id => "link", call => \&checkconfig); hook(type => "linkify", id => "link", call => \&linkify); hook(type => "scan", id => "link", call => \&scan); + hook(type => "renamepage", id => "link", call => \&renamepage); } # }}} sub checkconfig () { #{{{ @@ -87,13 +88,17 @@ sub renamepage (@) { #{{{ my $new=$params{newpage}; $params{content} =~ s{(? 11; +use Test::More tests => 14; use Encode; BEGIN { use_ok("IkiWiki"); } @@ -34,6 +34,8 @@ is(try("z", "foo" => "bar", "[[xxx]]"), "[[xxx]]"); # unrelated link is(try("z", "foo" => "bar", "[[bar]]"), "[[bar]]"); # link already to new page is(try("z", "foo" => "bar", "[[foo]]"), "[[bar]]"); # basic conversion to new page name is(try("z", "foo" => "bar", "[[/foo]]"), "[[/bar]]"); # absolute link +is(try("z", "foo" => "bar", "[[Foo]]"), "[[Bar]]"); # preserve case +is(try("z", "foo" => "bar", "[[/Foo]]"), "[[/Bar]]"); # preserve case w/absolute is(try("z", "foo" => "bar", "[[foo]] [[xxx]]"), "[[bar]] [[xxx]]"); # 2 links, 1 converted is(try("z", "foo" => "bar", "[[xxx|foo]]"), "[[xxx|bar]]"); # conversion w/text is(try("z", "foo" => "bar", "[[foo#anchor]]"), "[[bar#anchor]]"); # with anchor