From: joey Date: Sat, 3 Feb 2007 07:39:50 +0000 (+0000) Subject: web commit by http://per.bothner.com/: Alternate simple patch to view "A/B/C/index... X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/4560013bf90e59450da77f019ff03a9e72a06c3e?hp=97aea861624d1a1c6127857adb19dce16eab510e web commit by http://per.bothner.com/: Alternate simple patch to view "A/B/C/index" as the same as "A/B/C". --- diff --git a/doc/patchqueue/index.html_allowed.mdwn b/doc/patchqueue/index.html_allowed.mdwn index 6af5287a4..d41d17a50 100644 --- a/doc/patchqueue/index.html_allowed.mdwn +++ b/doc/patchqueue/index.html_allowed.mdwn @@ -118,4 +118,46 @@ In case whitespace gets garbled, I'm also leaving a copy of the patch on [my sit + $page=~s!/$!!; return $page; - } #}}} \ No newline at end of file + } #}}} + +I independently implemented a similar, but smaller patch. +(It's smaller because I only care about rendering; not CGI, for example.) +The key to this patch is that "A/B/C" is treated as equivalent +to "A/B/C/index". +Here it is: --Per Bothner + + --- IkiWiki/Render.pm~ 2007-01-11 15:01:51.000000000 -0800 + +++ IkiWiki/Render.pm 2007-02-02 22:24:12.000000000 -0800 + @@ -60,9 +60,9 @@ + foreach my $dir (reverse split("/", $page)) { + if (! $skip) { + $path.="../"; + - unshift @ret, { url => $path.htmlpage($dir), page => pagetitle($dir) }; + + unshift @ret, { url => abs2rel(htmlpage(bestlink($page, $dir)), dirname($page)), page => pagetitle($dir) }; + } + - else { + + elsif ($dir ne "index") { + $skip=0; + } + } + + --- IkiWiki.pm~ 2007-01-12 12:47:09.000000000 -0800 + +++ IkiWiki.pm 2007-02-02 18:02:16.000000000 -0800 + @@ -315,6 +315,12 @@ + elsif (exists $pagecase{lc $l}) { + return $pagecase{lc $l}; + } + + else { + + my $lindex = $l . "/index"; + + if (exists $links{$lindex}) { + + return $lindex; + + } + + } + } while $cwd=~s!/?[^/]+$!!; + + if (length $config{userdir} && exists $links{"$config{userdir}/".lc($link)}) { + +Note I handle setting the url; slightly differently. +Also note that an initial "index" is ignored. I.e. a +page "A/B/index.html" is treated as "A/B". +