]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/auto_rebuild_on_template_change.mdwn
link to submodule support question
[ikiwiki.git] / doc / todo / auto_rebuild_on_template_change.mdwn
1 If `page.tmpl` is changed, it would be nice if ikiwiki automatically
2 noticed, and rebuilt all pages. If `inlinepage.tmpl` is changed, a rebuild
3 of all pages using it in an inline would be stellar.
4
5 This would allow setting:
6
7         templatedir => "$srcdir/templates",
8
9 .. and then the [[templates]] are managed like other wiki files; and
10 like other wiki files, a change to them automatically updates dependent
11 pages.
12
13 Originally, it made good sense not to have the templatedir inside the wiki.
14 Those templates can be used to bypass the htmlscrubber, and you don't want
15 just anyone to edit them. But the same can be said of `style.css` and
16 `ikiwiki.js`, which *are* in the wiki. We rely on `allowed_attachments`
17 being set to secure those to prevent users uploading replacements. And we
18 assume that users who can directly (non-anon) commit *can* edit them, and
19 that's ok.
20
21 So, perhaps the easiest way to solve this [[wishlist]] would be to
22 make templatedir *default* to "$srcdir/templates/, and make ikiwiki
23 register dependencies on `page.tmpl`, `inlinepage.tmpl`, etc, as they're
24 used. Although, having every page declare an explicit dep on `page.tmpl`
25 is perhaps a bit much; might be better to implement a special case for that
26 one. Also, having the templates be copied to `destdir` is not desirable.
27 In a sense, these template would be like internal pages, except not wiki
28 pages, but raw files.
29
30 The risk is that a site might have `allowed_attachments` set to
31 `templates/*` or `*.tmpl` something like that. I think such a configuration
32 is the *only* risk, and it's unlikely enough that a NEWS warning should
33 suffice.
34
35 (This would also help to clear up the tricky disctinction between
36 wikitemplates and in-wiki templates.)
37
38 Note also that when using templates from "$srcdir/templates/", `no_includes`
39 needs to be set. Currently this is done by the two plugins that use
40 such templates, while includes are allowed in `templatedir`.
41
42 Have started working on this.
43 [[!template id=gitbranch branch=origin/templatemove author="[[Joey]]"]]
44
45 > But would this require that templates be parseable as wiki pages?  Because that would be a nuisance. --[[KathrynAndersen]]
46
47 >> It would be better for them not to be rendered separately at all.
48 >> --[[Joey]]  
49
50 >>> I don't follow you. --[[KathrynAndersen]]
51
52 >>>> If they don't render to output files, they clearly don't
53 >>>> need to be treated as wiki pages. (They need to be treated
54 >>>> as raw files anyway, because you don't want random users editing them 
55 >>>> in the online editor.) --[[Joey]] 
56
57 >>>>> Just to be clear, the raw files would not be copied across to the output
58 >>>>> directory? -- [[Jon]]
59
60 >>>>>> Without modifying ikiwiki, they'd be copied to the output directory as
61 >>>>>> (e.g.) http://ikiwiki.info/templates/inlinepage.tmpl; to not copy them,
62 >>>>>> it'd either be necessary to make them be internal pages
63 >>>>>> (templates/inlinepage._tmpl) or special-case them in some other way.
64 >>>>>> --[[smcv]]
65
66 >>>>>>> In my branch, I left in support for the templatedir, and also
67 >>>>>>> /usr/share/ikiwiki/templates. So, users do not have to put their
68 >>>>>>> custom templates in templates/ in the wiki. If they do, 
69 >>>>>>> the templates are copied to the destdir like other non-wiki page files
70 >>>>>>> are. The templates are not wiki pages, except those used by a few
71 >>>>>>> things like the [[plugins/template]] plugin.
72 >>>>>>> 
73 >>>>>>> That seems acceptable, since users probably don't need to modify
74 >>>>>>> many templates, so the clutter is small. (Especially when
75 >>>>>>> compared to the other clutter the basewiki always puts in destdir.)
76 >>>>>>> This could be revisted later. --[[Joey]] 
77
78 [[done]]