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.
Ikiwiki: a dirty way to auto create tag pages.
I needed the feature described here: http://ikiwiki.info/plugins/tag/discussion/
This is a dirty way. You should not use it, I want to replace it with a better one.
--- tag.pm 2007-12-15 23:47:25.000000000 +0100
+++ tag.pm.new 2007-12-27 22:58:16.000000000 +0100
@@ -24,12 +24,28 @@
sub tagpage ($) { #{{{
my $tag=shift;
+
+ my $origtag=$tag;
if (exists $config{tagbase} &&
defined $config{tagbase}) {
$tag=$config{tagbase}."/".$tag;
}
+ my $tagpagetocreate=$config{srcdir}."/".$tag.'.mdwn';
+ if (! -f $tagpagetocreate ) {
+ open(MYF, ">$tagpagetocreate");
+ print MYF <<END;
+[[inline pages="link($config{tagbase}/$origtag)" template="titlepage"]]
+END
+ close(MYF);
+ }
+
return $tag;
} #}}}
The main goal is to replace this hack with a clean solution, maybe when I have more time...