Package: ikiwiki
Version: 2.12
Severity: normal
Tags: patch

  I've noticed that even if I set usedirs=0, links to the top level of
the wiki (and probably other index.* files, although I haven't checked)
go to the top level *directory* of the wiki.  This will work as expected
when you're viewing the wiki via http, but since the main advantage of
usedirs=0 is that the wiki works locally, it seems kind of unfortunate
to me that links to the root of the wiki break when accessed through
file:/// URLs.  This might be intentional -- if it is, it would be nice
to have a configuration option that disables this behavior.

  I've attached a patch that attempts to make links to index.* work
whenever usedirs=0, but obviously it could be conditioned on any
configuration variable of your choice.  This is the first Perl I've
written in ages (probably 10+ years) and I don't know ikiwiki at all, so
I apologize in advance for any idiocy in my change.  All I know is it
worked for me. :-)

    Thanks,
  Daniel

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages ikiwiki depends on:
ii  gcc [c-compiler]           4:4.2.1-6     The GNU C compiler
ii  gcc-4.1 [c-compiler]       4.1.2-17      The GNU C compiler
ii  gcc-4.2 [c-compiler]       4.2.2-3       The GNU C compiler
ii  libc6-dev [libc-dev]       2.6.1-6       GNU C Library: Development Librari
ii  libcgi-formbuilder-perl    3.05.01-1     Easily generate and process statef
ii  libcgi-session-perl        4.20-2        Persistent session data in CGI app
ii  libhtml-parser-perl        3.56-1        A collection of modules that parse
ii  libhtml-scrubber-perl      0.08-4        Perl extension for scrubbing/sanit
ii  libhtml-template-perl      2.9-1         HTML::Template : A module for usin
ii  libmail-sendmail-perl      0.79-4        Send email from a perl script
ii  libtime-duration-perl      1.02-1        Time::Duration -- rounded or exact
ii  libtimedate-perl           1.1600-9      Time and date functions for Perl
ii  liburi-perl                1.35.dfsg.1-1 Manipulates and accesses URI strin
ii  libxml-simple-perl         2.18-1        Perl module for reading and writin
ii  markdown                   1.0.1-6       Text-to-HTML conversion tool
ii  perl                       5.8.8-12      Larry Wall's Practical Extraction 

Versions of packages ikiwiki recommends:
ii  git-core                    1:1.5.3.5-1  fast, scalable, distributed revisi
pn  hyperestraier               <none>       (no description available)
ii  libnet-openid-consumer-perl 0.13-1       library for consumers of OpenID id
ii  mercurial                   0.9.5-2      Scalable distributed version contr
ii  subversion                  1.4.4dfsg1-1 Advanced version control system

-- no debconf information
--- IkiWiki.pm.old	2007-11-17 14:59:09.000000000 -0800
+++ IkiWiki.pm	2007-11-17 15:41:23.000000000 -0800
@@ -510,7 +510,10 @@
 sub beautify_url ($) { #{{{
 	my $url=shift;
 
-	$url =~ s!/index.$config{htmlext}$!/!;
+	if( $config{usedirs} ) {
+	    $url =~ s!/index.$config{htmlext}$!/!;
+	}
+
 	$url =~ s!^$!./!; # Browsers don't like empty links...
 
 	return $url;

Reply via email to