thinking about changing how templatedir works and allowing wikitemplate files into the srcdir

master
Joey Hess 2010-04-19 16:03:53 -04:00
parent 472694b8b4
commit 1b7c455f4a
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
If `page.tmpl` is changed, it would be nice if ikiwiki automatically
noticed, and rebuilt all pages. If `inlinepage.tmpl` is changed, a rebuild
of all pages using it in an inline would be stellar.
This would allow setting:
templatedir => "$srcdir/templates",
.. and then the [[wikitemplates]] are managed like other wiki files; and
like other wiki files, a change to them automatically updates dependent
pages.
Originally, it made good sense not to have the templatedir inside the wiki.
Those templates can be used to bypass the htmlscrubber, and you don't want
just anyone to edit them. But the same can be said of `style.css` and
`ikiwiki.js`, which *are* in the wiki. We rely on `allowed_attachments`
being set to secure those to prevent users uploading replacements. And we
assume that users who can directly (non-anon) commit *can* edit them, and
that's ok.
So, perhaps the easiest way to solve this [[wishlist]] would be to
make templatedir *default* to "$srcdir/templates/, and make ikiwiki
register dependencies on `page.tmpl`, `inlinepage.tmpl`, etc, as they're
used. Although, having every page declare an explicit dep on `page.tmpl`
is perhaps a bit much; might be better to implement a special case for that
one. Also, having the templates be copied to `destdir` is not desirable.
The risk is that a site might have `allowed_attachments` set to "templates/*"
or "*.tmpl" something like that. I think such a configuration is the *only*
risk, and it's unlikely enough that a NEWS warning should suffice.
(This would also help to clear up the tricky disctinction between
wikitemplates and in-wiki templates.)