1 This page used to be used for two patches, one of which is applied
2 providing the usedirs option for output. The remaining patch, discussed
3 below, concerns wanting to use foo/index.mdwn source files and get an
4 output page name of foo, rather than foo/index. --[[Joey]]
8 I independently implemented a similar, but smaller patch.
9 (It's smaller because I only care about rendering; not CGI, for example.)
10 The key to this patch is that "A/B/C" is treated as equivalent
12 Here it is: --Per Bothner
14 --- IkiWiki/Render.pm~ 2007-01-11 15:01:51.000000000 -0800
15 +++ IkiWiki/Render.pm 2007-02-02 22:24:12.000000000 -0800
17 foreach my $dir (reverse split("/", $page)) {
20 - unshift @ret, { url => $path.htmlpage($dir), page => pagetitle($dir) };
21 + unshift @ret, { url => abs2rel(htmlpage(bestlink($page, $dir)), dirname($page)), page => pagetitle($dir) };
24 + elsif ($dir ne "index") {
29 --- IkiWiki.pm~ 2007-01-12 12:47:09.000000000 -0800
30 +++ IkiWiki.pm 2007-02-02 18:02:16.000000000 -0800
32 elsif (exists $pagecase{lc $l}) {
33 return $pagecase{lc $l};
36 + my $lindex = $l . "/index";
37 + if (exists $links{$lindex}) {
41 } while $cwd=~s!/?[^/]+$!!;
43 if (length $config{userdir} && exists $links{"$config{userdir}/".lc($link)}) {
45 Note I handle setting the url; slightly differently.
46 Also note that an initial "index" is ignored. I.e. a
47 page "A/B/index.html" is treated as "A/B".
49 > Actually, your patch is shorter because it's more elegant and better :)
50 > I'm withdrawing my old patch, because yours is much more in line with
51 > ikiwiki's design and architecture.
52 > I would like to make one suggestion to your patch, which is:
54 diff -urX ignorepats clean-ikidev/IkiWiki/Plugin/inline.pm ikidev/IkiWiki/Plugin/inline.pm
55 --- clean-ikidev/IkiWiki/Plugin/inline.pm 2007-02-25 12:26:54.099113000 -0800
56 +++ ikidev/IkiWiki/Plugin/inline.pm 2007-02-25 14:55:21.163340000 -0800
58 $link=htmlpage($link) if defined $type;
59 $link=abs2rel($link, dirname($params{destpage}));
60 $template->param(pageurl => $link);
61 - $template->param(title => pagetitle(basename($page)));
62 + $template->param(title => titlename($page));
63 $template->param(ctime => displaytime($pagectime{$page}));
67 my $pcontent = absolute_urls(get_inline_content($p, $page), $url);
70 - title => pagetitle(basename($p), 1),
71 + title => titlename($p, 1),
74 date_822 => date_822($pagectime{$p}),
75 diff -urX ignorepats clean-ikidev/IkiWiki/Render.pm ikidev/IkiWiki/Render.pm
76 --- clean-ikidev/IkiWiki/Render.pm 2007-02-25 12:26:54.745833000 -0800
77 +++ ikidev/IkiWiki/Render.pm 2007-02-25 14:54:01.564715000 -0800
80 title => $page eq 'index'
82 - : pagetitle(basename($page)),
84 wikiname => $config{wikiname},
85 parentlinks => [parentlinks($page)],
87 diff -urX ignorepats clean-ikidev/IkiWiki.pm ikidev/IkiWiki.pm
88 --- clean-ikidev/IkiWiki.pm 2007-02-25 12:26:58.812850000 -0800
89 +++ ikidev/IkiWiki.pm 2007-02-25 15:05:22.328852000 -0800
94 +sub titlename($;@) { #{{{
96 + $page =~ s!/index$!!;
97 + return pagetitle(basename($page), @_);
100 sub basename ($) { #{{{
104 > This way foo/index gets "foo" as its title, not "index". --Ethan