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