diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-02 00:37:22 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-02 00:37:22 +0000 |
commit | 3660b1c7a1757341024ceb267126ca63cd3c582a (patch) | |
tree | 02830c3a930fe61281898ef91650498753219548 | |
parent | 790fb348ae854a7e8a6e2ccd93df547dc15cd059 (diff) |
* Allow for underscores to appear in page titles, if encoded appropriately
(__95__) in filenames. Previously, all underscores were replaced with
spaces. Thanks, Enrico Zini for noticing that bug.
-rw-r--r-- | IkiWiki.pm | 8 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rwxr-xr-x | t/pagetitle.t | 3 | ||||
-rwxr-xr-x | t/titlepage.t | 3 |
4 files changed, 15 insertions, 7 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index dcb68bca6..62b54373b 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -365,20 +365,18 @@ sub pagetitle ($;$) { #{{{ my $unescaped=shift; if ($unescaped) { - $page=~s/__(\d+)__/chr($1)/eg; + $page=~s/(__(\d+)__|_)/$1 eq '_' ? ' ' : chr($2)/eg; } else { - $page=~s/__(\d+)__/&#$1;/g; + $page=~s/(__(\d+)__|_)/$1 eq '_' ? ' ' : "&#$2;"/eg; } - $page=~y/_/ /; return $page; } #}}} sub titlepage ($) { #{{{ my $title=shift; - $title=~y/ /_/; - $title=~s/([^-[:alnum:]_:+\/.])/"__".ord($1)."__"/eg; + $title=~s/([^-[:alnum:]:+\/.])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg; return $title; } #}}} diff --git a/debian/changelog b/debian/changelog index aa3f167fc..77333b0ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ikiwiki (1.45) UNRELEASED; urgency=low + + * Allow for underscores to appear in page titles, if encoded appropriately + (__95__) in filenames. Previously, all underscores were replaced with + spaces. Thanks, Enrico Zini for noticing that bug. + + -- Joey Hess <joeyh@debian.org> Thu, 1 Mar 2007 19:30:36 -0500 + ikiwiki (1.44) unstable; urgency=low * Patch by Ben to fix validaton of atom feeds by fixing the category tags. diff --git a/t/pagetitle.t b/t/pagetitle.t index 1bb4421e4..37adba144 100755 --- a/t/pagetitle.t +++ b/t/pagetitle.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 6; +use Test::More tests => 7; BEGIN { use_ok("IkiWiki"); } @@ -10,3 +10,4 @@ is(IkiWiki::pagetitle("foo_bar_baz"), "foo bar baz"); is(IkiWiki::pagetitle("foo_bar__33__baz"), "foo bar!baz"); is(IkiWiki::pagetitle("foo_bar__1234__baz"), "foo barӒbaz"); is(IkiWiki::pagetitle("foo_bar___33___baz"), "foo bar ! baz"); +is(IkiWiki::pagetitle("foo_bar___95___baz"), "foo bar _ baz"); diff --git a/t/titlepage.t b/t/titlepage.t index 6e1856a15..cc56db70c 100755 --- a/t/titlepage.t +++ b/t/titlepage.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 6; +use Test::More tests => 7; BEGIN { use_ok("IkiWiki"); } @@ -10,3 +10,4 @@ is(IkiWiki::titlepage("foo bar baz"), "foo_bar_baz"); is(IkiWiki::titlepage("foo bar/baz"), "foo_bar/baz"); is(IkiWiki::titlepage("foo bar&baz"), "foo_bar__38__baz"); is(IkiWiki::titlepage("foo bar & baz"), "foo_bar___38___baz"); +is(IkiWiki::titlepage("foo bar_baz"), "foo_bar__95__baz"); |