]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/autoindex/discussion.mdwn
(no commit message)
[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 > Or better still, add a mechanism for ikiwiki to hold transient source
5 > pages in memory and render them as if they existed, without actually
6 > writing them out, as [[JoeRayhawk]] suggests below? I think
7 > add_autofile would be the way to do this. --[[smcv]]
8
9 The reason being that I have a lot of directories which need to be autoindexed,
10 but I would prefer if the index files didn't clutter up my git repository.
11
12 even without that feature the plugin is a great help, thanks
13
14
15 ------
16
17 If you just don't want to clutter your git repo, below it's a patch does the following:
18
19 * 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**
20
21 * 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.
22
23 <pre>
24 --- autoindex.pm.orig   2009-10-01 17:13:51.000000000 +0800
25 +++ autoindex.pm        2009-10-01 17:21:09.000000000 +0800
26 @@ -17,6 +17,13 @@
27                         safe => 1,
28                         rebuild => 0,
29                 },
30 +        autoindex_commit => {
31 +            type => 'boolean',
32 +            default => 1,
33 +            description => 'commit generated autoindex pages into RCS',
34 +            safe => 0,
35 +            rebuild => 0,
36 +        },
37  }
38  
39  sub genindex ($) {
40 @@ -25,7 +32,7 @@
41         my $template=template("autoindex.tmpl");
42         $template->param(page => $page);
43         writefile($file, $config{srcdir}, $template->output);
44 -       if ($config{rcs}) {
45 +       if ($config{rcs} and $config{autoindex_commit}) {
46                 IkiWiki::rcs_add($file);
47         }
48  }
49 @@ -94,13 +101,13 @@
50         }
51         
52         if (@needed) {
53 -               if ($config{rcs}) {
54 +               if ($config{rcs} and $config{autoindex_commit}) {
55                         IkiWiki::disable_commit_hook();
56                 }
57                 foreach my $page (@needed) {
58                         genindex($page);
59                 }
60 -               if ($config{rcs}) {
61 +               if ($config{rcs} and $config{autoindex_commit}) {
62                         IkiWiki::rcs_commit_staged(
63                                 gettext("automatic index generation"),
64                                 undef, undef);
65 </pre>
66
67  
68 Warning:  I guess this patch may work, but I *haven't tested it yet*.  -- [[weakish]]
69
70 ------
71
72 `autoindex_commit => 0` would be nice, but uncommited files are definitely not.
73 <pre>
74 remote: From /srv/git/test3
75 remote:    3047077..1df636c  master     -> origin/master
76 remote: error: Untracked working tree file 'test.mdwn' would be overwritten by merge.  Aborting
77 remote: 'git pull --prune origin' failed:  at /usr/share/perl5/IkiWiki/Plugin/git.pm line 201.
78 </pre>
79
80 It'd be nice if we were able to notice directories with no associated compilable markup files and compile a simple map directive straight to HTML without any intermediate markup file being involved at all. -- JoeRayhawk