Ikiwiki: a good, but not general enought way to remove accents from page titles
The reason that I say a good way, because I already made autocreatetagpage which is obviously an ugly hack. But this one is implemented right, but not as a plugin so it makes Ikiwiki to depend on one another Perl module. So I am not sure if this is ok for inclusion in Ikiwiki. But whatever, I put it here.
--- IkiWiki.pm 2008-01-30 14:37:30.000000000 +0100
+++ IkiWiki.pm 2008-01-31 22:09:47.000000000 +0100
@@ -6,6 +6,7 @@
use Encode;
use HTML::Entities;
use URI::Escape q{uri_escape_utf8};
+use Text::Unaccent;
use POSIX;
use open qw{:utf8 :std};
@@ -556,14 +555,6 @@
$link=~s/\/$//;
- my $bestlink;
- if (! $opts{forcesubpage}) {
- $bestlink=bestlink($lpage, $link);
- }
- else {
- $bestlink="$lpage/".lc($link);
- }
-
my $linktext;
if (defined $opts{linktext}) {
$linktext=$opts{linktext};
@@ -571,6 +562,17 @@
else {
$linktext=pagetitle(basename($link));
}
+
+ # cstamas UTF8 removal
+ $link = unac_string("UTF-8", $link);
+
+ my $bestlink;
+ if (! $opts{forcesubpage}) {
+ $bestlink=bestlink($lpage, $link);
+ }
+ else {
+ $bestlink="$lpage/".lc($link);
+ }
return "<span class=\"selflink\">$linktext</span>"
if length $bestlink && $page eq $bestlink &&
In fact this is a one liner change (twice), but I have to reorder the code a bit to work right.
Add a comment