aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-12 02:44:47 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-12 02:44:47 +0000
commit479c7a1ea62d8fce3ef54f9deae89230d0b52a5d (patch)
treef8932f522aa856e9cf35d7db3420d491dd05518e /doc
parentfe62c0ff209bbf01a3e5eb4a7b9f3b3d99acebca (diff)
downloadikiwiki-479c7a1ea62d8fce3ef54f9deae89230d0b52a5d.tar
ikiwiki-479c7a1ea62d8fce3ef54f9deae89230d0b52a5d.tar.gz
* Allow plugins to add new types of tests that can be used in PageSpecs.
* Add a "conditional" plugin, which allows displaying text if a condition is true. It is enabled by default so conditional can be used in the basewiki. * Use conditionals in the template for plugins, so that plugin pages say if they're currently enabled or not, and in various other places in the wiki.
Diffstat (limited to 'doc')
-rw-r--r--doc/plugins.mdwn4
-rw-r--r--doc/plugins/camelcase.mdwn2
-rw-r--r--doc/plugins/conditional.mdwn41
-rw-r--r--doc/plugins/contrib/googlemaps.mdwn1
-rw-r--r--doc/plugins/contrib/img.mdwn1
-rw-r--r--doc/plugins/contrib/linguas.mdwn1
-rw-r--r--doc/plugins/contrib/navbar.mdwn4
-rw-r--r--doc/plugins/contrib/syntax.mdwn2
-rw-r--r--doc/plugins/contrib/table.mdwn3
-rw-r--r--doc/plugins/fortune.mdwn4
-rw-r--r--doc/plugins/html.mdwn2
-rw-r--r--doc/plugins/linkmap.mdwn7
-rw-r--r--doc/plugins/map.mdwn7
-rw-r--r--doc/plugins/meta.mdwn3
-rw-r--r--doc/plugins/orphans.mdwn4
-rw-r--r--doc/plugins/polygen.mdwn6
-rw-r--r--doc/plugins/write.mdwn9
-rw-r--r--doc/templates/plugin.mdwn4
-rw-r--r--doc/todo/conditional_text_based_on_ikiwiki_features.mdwn4
19 files changed, 80 insertions, 29 deletions
diff --git a/doc/plugins.mdwn b/doc/plugins.mdwn
index 1006a9e1c..73fb6205c 100644
--- a/doc/plugins.mdwn
+++ b/doc/plugins.mdwn
@@ -8,8 +8,8 @@ There's documentation if you want to [[write]] your own plugins, or you can
install and use plugins [[contributed|contrib]] by others.
The [[mdwn]], [[inline]], [[htmlscrubber]], [[passwordauth]],
-[[signinedit]], and [[lockedit]] plugins are enabled by default.
-To enable other plugins, use the `--plugin` switch described in
+[[signinedit]], [[lockedit]], and [[conditional]] plugins are enabled
+by default. To enable other plugins, use the `--plugin` switch described in
[[usage]], or the equivalent `add_plugins` line in [[ikiwiki.setup]].
# Plugin directory
diff --git a/doc/plugins/camelcase.mdwn b/doc/plugins/camelcase.mdwn
index fd05ac7a9..ea0d80f26 100644
--- a/doc/plugins/camelcase.mdwn
+++ b/doc/plugins/camelcase.mdwn
@@ -4,6 +4,6 @@ This plugin makes words in CamelCase be treated as a [[WikiLink]]. That is
to say, any two or more words capitalised and mashed together are assumed
to be the name of some other page on the wiki, and so become a link.
-If this plugin is enabled, here is a link: SandBox
+If this plugin is enabled, this will be a link: SandBox
[[tag type/link]]
diff --git a/doc/plugins/conditional.mdwn b/doc/plugins/conditional.mdwn
new file mode 100644
index 000000000..f3398af57
--- /dev/null
+++ b/doc/plugins/conditional.mdwn
@@ -0,0 +1,41 @@
+[[template id=plugin name=conditional core=1 included=1 author="[[Joey]]"]]
+[[tag type/format]]
+
+With this plugin, you can make text be conditionally displayed on a page.
+For example:
+
+ \[[if test="enabled(smiley)"
+ then="The smiley plugin is enabled :-)"
+ else="No smiley plugin here.."]]
+
+If the specified `test` succeeds, the `then` text will be displayed,
+otherwise the `else` text will be displayed. The `else` part is optional.
+
+The `then` and `else` values can include any markup that would be allowed
+in the wiki page outside the template. Triple-quoting the values even allows
+quotes to be included.
+
+The `test` is a [[PageSpec]]; if it matches any page in the wiki then it
+succeeds. So you can do things like testing for the existence of a page or
+pages, testing to see if any pages were created in a given month, and so
+on. The regular [[PageSpec]] syntax is expanded with the following
+additional tests:
+
+* enabled(plugin)
+
+ Tests whether the specified plugin is enabled.
+
+* sourcepage(glob)
+
+ Tests whether the glob matches the name of the page that contains the
+ conditional.
+
+* destpage(glob)
+
+ Tests whether the glob matches the name of the page that is being built.
+ That might be different than the name of the page that contains the
+ conditional, if it's being inlined into another page.
+
+* included()
+
+ Tests whether the page is being included onto another page.
diff --git a/doc/plugins/contrib/googlemaps.mdwn b/doc/plugins/contrib/googlemaps.mdwn
index 30f630a2c..9174ebe75 100644
--- a/doc/plugins/contrib/googlemaps.mdwn
+++ b/doc/plugins/contrib/googlemaps.mdwn
@@ -1,6 +1,5 @@
[[template id=plugin name=googlemaps author="Christian Mock"]]
[[tag type/special-purpose]]
-[[meta title="googlemaps (third-party plugin)"]]
`googlemaps` is a plugin that allows using the [Google Maps API][2]
from ikiwiki.
diff --git a/doc/plugins/contrib/img.mdwn b/doc/plugins/contrib/img.mdwn
index 43c502525..c55338bf5 100644
--- a/doc/plugins/contrib/img.mdwn
+++ b/doc/plugins/contrib/img.mdwn
@@ -1,6 +1,5 @@
[[template id=plugin name=img author="Christian Mock"]]
[[tag type/chrome]]
-[[meta title="img (third-party plugin)"]]
`img` is an enhanced image handling plugin.
diff --git a/doc/plugins/contrib/linguas.mdwn b/doc/plugins/contrib/linguas.mdwn
index 7778bf461..cf7a458c7 100644
--- a/doc/plugins/contrib/linguas.mdwn
+++ b/doc/plugins/contrib/linguas.mdwn
@@ -1,5 +1,4 @@
[[template id=plugin name=linguas author="Jordà Polo"]]
-[[meta title="linguas (third-party plugin)"]]
Linguas
=======
diff --git a/doc/plugins/contrib/navbar.mdwn b/doc/plugins/contrib/navbar.mdwn
index 8c473d631..8f15e83f7 100644
--- a/doc/plugins/contrib/navbar.mdwn
+++ b/doc/plugins/contrib/navbar.mdwn
@@ -1,6 +1,4 @@
[[template id=plugin name=navbar author="[[TobiOetiker]]"]]
-[[meta title="navbar (third-party plugin)"]]
-
The Navbar Plugin renders a Navigation Bar into your page. It is based on code
from the sidebar plug in see <http://ikiwiki.kitenet.net/plugins/sidebar.html>
@@ -35,4 +33,4 @@ ikiwiki look good anyway, I won't go into details here ...
Tobi Oetiker 2006.12.30
-If you are interested in this, drop me a line tobi at oetiker dot ch \ No newline at end of file
+If you are interested in this, drop me a line tobi at oetiker dot ch
diff --git a/doc/plugins/contrib/syntax.mdwn b/doc/plugins/contrib/syntax.mdwn
index 3aed3d425..57c614a9d 100644
--- a/doc/plugins/contrib/syntax.mdwn
+++ b/doc/plugins/contrib/syntax.mdwn
@@ -1,7 +1,5 @@
[[template id=plugin name=syntax author="[[VictorMoral]]"]]
[[tag type/chrome type/slow]]
-[[meta title="syntax (third-party plugin)"]]
-
`syntax` is a plugin that add support to ikiwiki for syntax highlighting through the *vim* editor and its perl interface [[cpan Text::VimColor]], so it depends on a vim functional installation.
diff --git a/doc/plugins/contrib/table.mdwn b/doc/plugins/contrib/table.mdwn
index def5041ce..46f7b09a7 100644
--- a/doc/plugins/contrib/table.mdwn
+++ b/doc/plugins/contrib/table.mdwn
@@ -1,4 +1,5 @@
-[[meta title="table (third-party plugin)"]]
+[[template id=plugin name=table author="[[VictorMoral]]"]]
+[[tag type/format]]
This plugin supplies a `table` [[PreprocessorDirective]] to build html tables from data in CSV (comma-separated values) or DSV (delimiter-separated values) format.
diff --git a/doc/plugins/fortune.mdwn b/doc/plugins/fortune.mdwn
index 93bc4bd05..caa002aed 100644
--- a/doc/plugins/fortune.mdwn
+++ b/doc/plugins/fortune.mdwn
@@ -6,8 +6,10 @@ Usage:
\[[fortune ]]
-If this plugin is enabled, here's a fortune for you:
+[[if test="enabled(fortune)" then="""
+Here's a fortune for you:
----
[[fortune ]]
+"""]]
diff --git a/doc/plugins/html.mdwn b/doc/plugins/html.mdwn
index d19c99af8..1a2c5365b 100644
--- a/doc/plugins/html.mdwn
+++ b/doc/plugins/html.mdwn
@@ -4,7 +4,7 @@
This plugin lets html pages be used as source pages for the wiki. The
html pages will still be wrapped in the same html template as any other
page, so for best results you should include only the page body in the html
-file. Also, if the htmlscrubber plugin is enabled, the html pages will be
+file. Also, if the [[htmlscrubber]] plugin is enabled, the html pages will be
sanitised like any other page. You can also use standard [[WikiLink]]s etc
in the html pages.
diff --git a/doc/plugins/linkmap.mdwn b/doc/plugins/linkmap.mdwn
index e0eda9289..50d197f2f 100644
--- a/doc/plugins/linkmap.mdwn
+++ b/doc/plugins/linkmap.mdwn
@@ -22,9 +22,8 @@ directive:
in inches. Both must be specified for the limiting to take effect, otherwise
the map's size is not limited.
-This plugin is included in ikiwiki, but is not enabled by default.
-
-If this plugin is enabled, here is a link map of the index page and all
-pages it links to:
+[[if test="enabled(linkmap)" then="""
+Here is an example link map, of the index page and all pages it links to:
[[linkmap pages="index or (backlink(index) and !*.png)"]]
+"""]
diff --git a/doc/plugins/map.mdwn b/doc/plugins/map.mdwn
index 592a20706..3d44164ae 100644
--- a/doc/plugins/map.mdwn
+++ b/doc/plugins/map.mdwn
@@ -11,9 +11,8 @@ the wiki are mapped.
Hint: To limit the map to displaying pages less than a certian level deep,
use a [[PageSpec]] like this: `pages="* and !*/*/*"`
-This plugin is included in ikiwiki, but is not enabled by default.
-
-If this plugin is enabled, here is a page map for the plugins section
-of this wiki:
+[[if test="enabled(map)" then="""
+Here's an example map, for the plugins section of this wiki:
[[map pages="(plugins or plugins/*) and !*/*/*"]]
+"""]]
diff --git a/doc/plugins/meta.mdwn b/doc/plugins/meta.mdwn
index d87bc0588..41563e965 100644
--- a/doc/plugins/meta.mdwn
+++ b/doc/plugins/meta.mdwn
@@ -54,6 +54,3 @@ header.
The field value is treated as HTML entity-escaped text, so you can include
a quote in the text by writing `&quot;` and so on.
-
-If this plugin is enabled, the title of this page will say that it is.
-[[meta title="meta plugin (enabled)"]]
diff --git a/doc/plugins/orphans.mdwn b/doc/plugins/orphans.mdwn
index b83879d25..772c19343 100644
--- a/doc/plugins/orphans.mdwn
+++ b/doc/plugins/orphans.mdwn
@@ -11,6 +11,8 @@ Note that it takes [[BackLinks]] into account, but does not count inlining a
page as linking to it, so will generally count many blog-type pages as
orphans.
-If it is enabled, here's a list of orphaned pages on this wiki:
+[[if test="enabled(orphans)" then="""
+Here's a list of orphaned pages on this wiki:
[[orphans ]]
+"""]]
diff --git a/doc/plugins/polygen.mdwn b/doc/plugins/polygen.mdwn
index 240edc961..5cd2f41d2 100644
--- a/doc/plugins/polygen.mdwn
+++ b/doc/plugins/polygen.mdwn
@@ -9,10 +9,10 @@ For example:
It's also possible to specify a starting nonterminal for the grammar by
including `symbol="text"` in the directive.
+[[if test="enabled(polygen)" then="""
----
-If this plugin is enabled, and polygen is installed, here are a few notes
-about ikiwiki.
+Here are a few notes about ikiwiki, courtesy of polygen:
Ikiwiki is internally based on a [[polygen grammar="designpatterns"]]
coupled to a [[polygen grammar="designpatterns"]], as described in
@@ -25,3 +25,5 @@ Ikiwiki reviews:
<li>[[polygen grammar="reviews"]]</li>
<li>[[polygen grammar="reviews"]]</li>
</ul>
+
+"""]]
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 1aaaf1d1e..8630b56ff 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -413,3 +413,12 @@ See IkiWiki::RCS::Stub for the full list of functions. It's ok if
rcs\_getctime does nothing except for throwing an error.
See [[about_RCS_backends]] for some more info.
+
+## PageSpec plugins
+
+It's also possible to write plugins that add new functions to
+[[PageSpecs|PageSpec]]. Such a plugin should add a function to the
+IkiWiki::PageSpec package, that is named `match_foo`, where "foo()" is
+how it will be accessed in a [[PageSpec]]. The function will be passed two
+parameters: The name of the page being matched, and the thing to match
+against. It should return true if the page matches.
diff --git a/doc/templates/plugin.mdwn b/doc/templates/plugin.mdwn
index ca69efd23..1db37e5c2 100644
--- a/doc/templates/plugin.mdwn
+++ b/doc/templates/plugin.mdwn
@@ -1,6 +1,8 @@
<span class="infobox">
Plugin: <TMPL_VAR name><br />
Author: <TMPL_VAR author><br />
-Enabled by default: <TMPL_IF core>yes<TMPL_ELSE>no</TMPL_IF><br />
Included in ikiwiki: <TMPL_IF included>yes<TMPL_ELSE>no</TMPL_IF><br />
+Enabled by default: <TMPL_IF core>yes<TMPL_ELSE>no</TMPL_IF><br />
+Currently enabled: [[if test="enabled(<TMPL_VAR name>)" then="yes" else="no"]]<br />
</span>
+[[if test="sourcepage(plugins/contrib/*)" then="""[[meta title="<TMPL_VAR name> (third party plugin)"]]"""]]
diff --git a/doc/todo/conditional_text_based_on_ikiwiki_features.mdwn b/doc/todo/conditional_text_based_on_ikiwiki_features.mdwn
index 05c655b89..bb3482e71 100644
--- a/doc/todo/conditional_text_based_on_ikiwiki_features.mdwn
+++ b/doc/todo/conditional_text_based_on_ikiwiki_features.mdwn
@@ -100,3 +100,7 @@ for the condition itself.
>> typing in the if.
>>
>> --[[JoshTriplett]]
+
+This is now completely [[todo/done]]! See [[plugins/conditional]].
+
+--[[Joey]]