web commit by JoshTriplett
[ikiwiki] / doc / todo / conditional_text_based_on_ikiwiki_features.mdwn
1 I'd like to see some way to conditionally include wiki text based on whether the wiki enables or disables certain features.  For example, [[helponformatting]], could use `\[[if (enabled smiley) """Also, because this wiki has the smiley plugin enabled, you can insert \[[smileys]] and some other useful symbols."""]]`, and a standard template for [[plugins]] pages could check for the given plugin name to print "enabled" or "disabled".
2
3 Some potentially useful conditionals:
4
5 * `enabled pluginname`
6 * `disabled pluginname`
7 * `any pagespec`: true if any of the pages in the [[PageSpec]] exist
8 * `all pagespec`: true if all of the pages in the [[PageSpec]] exist
9 * `no pagespec` or `none pagespec`: true if none of the pages in the [[PageSpec]] exist
10 * `thispage pagespec`: true if pagespec includes the page getting rendered (possibly one including the page with this content on it).
11 * `sourcepage pagespec`: true if pagespec includes the page corresponding to the file actually containing this content, rather than a page including it.
12 * `included`: true if included on another page, via [[plugins/inline]], [[plugins/sidebar]], [[plugins/contrib/navbar]], etc.
13
14 You may or may not want to include boolean operations (`and`, `or`, and `not`); if you do, you could replace `disabled` with `not enabled`, and `no pagespec` or `none pagespec` with `not any pagespec` (but you may want to keep the aliases for simplicity anyway).  You also may or may not want to include an `else` clause; if so, you could label the text used if true as `then`.
15
16 Syntax could vary greatly here, both for the [[PreprocessorDirective]] and for the condition itself.