]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/autoindex/discussion.mdwn
2d6b6f1f0ad3b4e0944e4f81884442011765055f
[ikiwiki.git] / doc / plugins / autoindex / discussion.mdwn
1 Would it be possible to add an option to only generate the index files
2 for the html output and not place the markdown files in the wiki source?
3
4 The reason being that I have a lot of directories which need to be autoindexed,
5 but I would prefer if the index files didn't clutter up my git repository.
6
7 even without that feature the plugin is a great help, thanks
8
9
10 ------
11
12 If you just don't want to clutter your git repo, below it's a patch does the following:
13
14 * If you set autoindex_commit to 0 in your ikiwiki.setup file, we *do* place auto-generated markdown files in the **wiki source** but *not* in the **repo**
15
16 * If you set autoindex_commit to 1 (this is the default), auto-generated index files will be put in the repo provided you enabled rcs backend.
17
18 <pre>
19 --- autoindex.pm.orig   2009-10-01 17:13:51.000000000 +0800
20 +++ autoindex.pm        2009-10-01 17:21:09.000000000 +0800
21 @@ -17,6 +17,13 @@
22                         safe => 1,
23                         rebuild => 0,
24                 },
25 +        autoindex_commit => {
26 +            type => 'boolean',
27 +            default => 1,
28 +            description => 'commit generated autoindex pages into RCS',
29 +            safe => 0,
30 +            rebuild => 0,
31 +        },
32  }
33  
34  sub genindex ($) {
35 @@ -25,7 +32,7 @@
36         my $template=template("autoindex.tmpl");
37         $template->param(page => $page);
38         writefile($file, $config{srcdir}, $template->output);
39 -       if ($config{rcs}) {
40 +       if ($config{rcs} and $config{autoindex_commit}) {
41                 IkiWiki::rcs_add($file);
42         }
43  }
44 @@ -94,13 +101,13 @@
45         }
46         
47         if (@needed) {
48 -               if ($config{rcs}) {
49 +               if ($config{rcs} and $config{autoindex_commit}) {
50                         IkiWiki::disable_commit_hook();
51                 }
52                 foreach my $page (@needed) {
53                         genindex($page);
54                 }
55 -               if ($config{rcs}) {
56 +               if ($config{rcs} and $config{autoindex_commit}) {
57                         IkiWiki::rcs_commit_staged(
58                                 gettext("automatic index generation"),
59                                 undef, undef);
60 </pre>
61
62  
63 Warning:  I guess this patch may work, but I *haven't tested it yet*.  -- [[weakish]]