On Tue, Jan 25, 2011 at 01:55:10PM -0400, Joey Hess wrote: > Tuomas Jormola wrote: > > Is creation of index pages by the autoindex plugin limited only to files > > under > > srcdir by some justified reason? Currently autoindex doesn't create index > > pages > > for empty directories of underlays. > > autoindex does not create index pages for empty directories *anywhere*. > The directory has to contain some files for an index page to be created > for it. Sorry, I didn't try to refer to empty directories but directories with subdirectories or non-index pages or other files, i.e. a directory needing an automatically generated index page. Bad wording.
> It seems wrong for a missing file in an underlay to result in > every wiki using that underlay having an index page added. Ikiwiki's own > basewiki has a wikiicons subdirectory without an index page. And > ikiwiki cannot modify the underlay to have autoindex add the file to it. Consider the following example. It models my setup where I encountered this "issue". The file $srcdir/software/foo/index.mdwn is the index/home page for a piece of software called Foo stored in the wiki. This page says something about Foo but is not part of the Foo distribution. The Foo software is located in another Git repo that is totally independent of the wiki repo. If you clone it, you'll get the following kind of structure. 1) README for Foo in MarkDown format $foorepodir/README.mdwn 2) Sources for Foo. It's not really relevant what you have here. $foorepodir/src/* 3) API docs autogenerated from the sources in MarkDown format $foorepodir/api/ikiwiki/*/*.mdwn (e.g. $foorepodir/api/ikiwiki/someclass/index.mdwn) Now I want to have Foo docs in MarkDown as part of the wiki, but I don't want to check them in the wiki repo and maintain these autogenerated files manually for the wiki. Instead, I want to use an underlay to get always up-to-date versions directly from the Foo Git repo. So the Git repo $wikirepodir for the wiki is structured like this (for the relevant parts) 1) $srcdir is $wikirepodir/site, i.e. I have $wikirepodir/site/software/foo/index.mdwn 2) In ikiwiki.setup, the dirs $wikirepodir/underlays/* are added to the list $config{add_underlays} 3) The Foo Git repo is added as a submodule to the wiki Git repo. The submodule dir is $wikirepodir/underlays/foo/software/foo, ѕo you would have the file $wikirepodir/underlays/foo/software/foo/README.mdwn etc. as described above. Now when the wiki is built, I get exactly what I want. $destdir/software/foo/index.html $destdir/software/foo/README/index.html $destdir/software/foo/src/* $destdir/software/foo/api/ikiwiki/**/index.html Except that since autoindex doesn't work for underlays, I don't get e.g. $destdir/software/foo/api/index.html or destdir/software/foo/src/index.html. And the parentlinks section on the pages generated from the underlay MarkDown pages (e.g. $destdir/software/foo/api/ikiwiki/someclass/index.html) would be broken since the wiki doesn't contain a parent wiki page software/foo/api since there's no such page in the Foo Git repo which is used as an underlay nor in the wiki Git repo, since autoindex doesn't currently create this page. But if IkiWiki was modified with the patch attached to this bug report, these index pages would get created by the autoindex plugin and they would get committed to the wiki Git repo, i.e. $wikirepodir/software/foo/src/index.mdwn and $wikirepodir/software/foo/api/index.mdwn. So the directory structure from the underlay would get copied to the wiki Git repo and the autogenerated index pages would get committed there. As you said, it's impossible to alter the underlay directories from within IkiWiki, of course. I hope this clarified this "issue", which might well be a non-issue if you think it that way. But maybe this kind of index generation for underlays could be a configurable option for the autoindex plugin? Surely it should be disabled by default not to introduce possibly unwanted side effects when upgrading. > > If index pages aren't supposed to be > > created for empty directories under underlay dirs, why iterate over the > > underlay dirs in the first place (the for loop at the line 41 of > > autoindex.pm). > > Because it needs to know if a given index page is provided by an > underlay, so as to avoid replacing such a page with one it creates. Ah, I see. Of course. Br, Tuomas > > -- > see shy jo
signature.asc
Description: Digital signature