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]]
10 I independently implemented a similar, but smaller patch.
11 (It's smaller because I only care about rendering; not CGI, for example.)
12 The key to this patch is that "A/B/C" is treated as equivalent
14 Here it is: --Per Bothner
16 --- IkiWiki/Render.pm~ 2007-01-11 15:01:51.000000000 -0800
17 +++ IkiWiki/Render.pm 2007-02-02 22:24:12.000000000 -0800
19 foreach my $dir (reverse split("/", $page)) {
22 - unshift @ret, { url => $path.htmlpage($dir), page => pagetitle($dir) };
23 + unshift @ret, { url => abs2rel(htmlpage(bestlink($page, $dir)), dirname($page)), page => pagetitle($dir) };
26 + elsif ($dir ne "index") {
31 --- IkiWiki.pm~ 2007-01-12 12:47:09.000000000 -0800
32 +++ IkiWiki.pm 2007-02-02 18:02:16.000000000 -0800
34 elsif (exists $pagecase{lc $l}) {
35 return $pagecase{lc $l};
38 + my $lindex = $l . "/index";
39 + if (exists $links{$lindex}) {
43 } while $cwd=~s!/?[^/]+$!!;
45 if (length $config{userdir} && exists $links{"$config{userdir}/".lc($link)}) {
47 Note I handle setting the url; slightly differently.
48 Also note that an initial "index" is ignored. I.e. a
49 page "A/B/index.html" is treated as "A/B".
51 > Actually, your patch is shorter because it's more elegant and better :)
52 > I'm withdrawing my old patch, because yours is much more in line with
53 > ikiwiki's design and architecture.
54 > I would like to make one suggestion to your patch, which is:
56 diff -urX ignorepats clean-ikidev/IkiWiki/Plugin/inline.pm ikidev/IkiWiki/Plugin/inline.pm
57 --- clean-ikidev/IkiWiki/Plugin/inline.pm 2007-02-25 12:26:54.099113000 -0800
58 +++ ikidev/IkiWiki/Plugin/inline.pm 2007-02-25 14:55:21.163340000 -0800
60 $link=htmlpage($link) if defined $type;
61 $link=abs2rel($link, dirname($params{destpage}));
62 $template->param(pageurl => $link);
63 - $template->param(title => pagetitle(basename($page)));
64 + $template->param(title => titlename($page));
65 $template->param(ctime => displaytime($pagectime{$page}));
69 my $pcontent = absolute_urls(get_inline_content($p, $page), $url);
72 - title => pagetitle(basename($p), 1),
73 + title => titlename($p, 1),
76 date_822 => date_822($pagectime{$p}),
77 diff -urX ignorepats clean-ikidev/IkiWiki/Render.pm ikidev/IkiWiki/Render.pm
78 --- clean-ikidev/IkiWiki/Render.pm 2007-02-25 12:26:54.745833000 -0800
79 +++ ikidev/IkiWiki/Render.pm 2007-02-25 14:54:01.564715000 -0800
82 title => $page eq 'index'
84 - : pagetitle(basename($page)),
86 wikiname => $config{wikiname},
87 parentlinks => [parentlinks($page)],
89 diff -urX ignorepats clean-ikidev/IkiWiki.pm ikidev/IkiWiki.pm
90 --- clean-ikidev/IkiWiki.pm 2007-02-25 12:26:58.812850000 -0800
91 +++ ikidev/IkiWiki.pm 2007-02-25 15:05:22.328852000 -0800
96 +sub titlename($;@) { #{{{
98 + $page =~ s!/index$!!;
99 + return pagetitle(basename($page), @_);
102 sub basename ($) { #{{{
106 > This way foo/index gets "foo" as its title, not "index". --Ethan
108 I took another swing at this and subverted the dominant paradigm. Here goes:
111 diff -ru ikiwiki-2.4/IkiWiki.pm ikiwiki/IkiWiki.pm
112 --- ikiwiki-2.4/IkiWiki.pm 2007-06-26 15:01:57.000000000 -0700
113 +++ ikiwiki/IkiWiki.pm 2007-07-25 15:58:00.990749000 -0700
115 my $type=pagetype($file);
117 $page=~s/\Q.$type\E*$// if defined $type;
118 + $page=~s/\/index$// if $page =~ /\/index$/;
124 This just makes it so that all files named foo/index become pages called foo, which is the desired effect. I haven't tested everything so far, so be careful! But you can see it working at http://ikidev.betacantrips.com/one/ again, as before. --Ethan