* Allow preprocessor directives to contain python-like triple-quoted
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 23 Aug 2006 05:41:07 +0000 (05:41 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 23 Aug 2006 05:41:07 +0000 (05:41 +0000)
  text blocks, for easy nesting of quotes inside.
* Add a template plugin.
* Use the template plugin to add infoboxes to each plugin page listing basic
  info about the plugin.

37 files changed:
IkiWiki/Plugin/template.pm [new file with mode: 0644]
IkiWiki/Render.pm
Makefile.PL
basewiki/preprocessordirective.mdwn
basewiki/style.css
debian/changelog
doc/download.mdwn
doc/index.mdwn
doc/plugins/aggregate.mdwn
doc/plugins/brokenlinks.mdwn
doc/plugins/camelcase.mdwn
doc/plugins/contrib/linguas.mdwn
doc/plugins/fortune.mdwn
doc/plugins/haiku.mdwn
doc/plugins/html.mdwn
doc/plugins/htmlscrubber.mdwn
doc/plugins/htmltidy.mdwn
doc/plugins/inline.mdwn
doc/plugins/map.mdwn
doc/plugins/mdwn.mdwn
doc/plugins/meta.mdwn
doc/plugins/orphans.mdwn
doc/plugins/otl.mdwn
doc/plugins/pagecount.mdwn
doc/plugins/pagestats.mdwn
doc/plugins/polygen.mdwn
doc/plugins/rst.mdwn
doc/plugins/search.mdwn
doc/plugins/sidebar.mdwn
doc/plugins/smiley.mdwn
doc/plugins/tag.mdwn
doc/plugins/template.mdwn [new file with mode: 0644]
doc/plugins/wikitext.mdwn
doc/security.mdwn
doc/templates/note.mdwn [new file with mode: 0644]
doc/templates/plugin.mdwn [new file with mode: 0644]
doc/todo/infoboxes.mdwn [deleted file]

diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm
new file mode 100644 (file)
index 0000000..5b4eeb3
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# Structured template plugin.
+package IkiWiki::Plugin::template;
+
+use warnings;
+use strict;
+use IkiWiki;
+use HTML::Template;
+use Encode;
+
+sub import { #{{{
+       IkiWiki::hook(type => "preprocess", id => "template", 
+               call => \&preprocess);
+} # }}}
+
+sub preprocess (@) { #{{{
+       my %params=@_;
+
+       if (! exists $params{id}) {
+               return "[[template missing id parameter]]"
+       }
+
+       my $template_page="templates/$params{id}";
+       IkiWiki::add_depends($params{page}, $template_page);
+
+       my $template_file=$IkiWiki::pagesources{$template_page};
+       return "[[template ".
+              IkiWiki::htmllink($params{page}, $params{destpage}, $template_page).
+              " not found]]"
+               unless defined $template_file;
+
+       my $template=HTML::Template->new(
+               filter => sub {
+                        my $text_ref = shift;
+                        $$text_ref=&Encode::decode_utf8($$text_ref);
+                },
+                filename => IkiWiki::srcfile($template_file),
+                die_on_bad_params => 0,
+               no_includes => 1,
+               blind_cache => 1,
+       );
+
+       foreach my $param (keys %params) {
+               $template->param($param => $params{$param});
+       }
+
+
+       return IkiWiki::preprocess($params{page}, $params{destpage},
+               $template->output);
+} # }}}
+
+1
index 8657dc3807a5784a6be50c38b613a4d0f4999ad5..38bfcdfcb0e8085d714c7a191c0369e934d56577 100644 (file)
@@ -104,12 +104,12 @@ sub preprocess ($$$;$) { #{{{
                        # Note: preserve order of params, some plugins may
                        # consider it significant.
                        my @params;
-                       while ($params =~ /(?:(\w+)=)?(?:"([^"]+)"|(\S+))(?:\s+|$)/g) {
+                       while ($params =~ /(?:(\w+)=)?(?:"""(.+)"""|"([^"]+)"|(\S+))(?:\s+|$)/g) {
                                if (defined $1) {
-                                       push @params, $1, (defined $2 ? $2 : $3);
+                                       push @params, $1, (defined $2 ? $2 : (defined $3 ? $3 : $4));
                                }
                                else {
-                                       push @params, (defined $2 ? $2 : $3), '';
+                                       push @params, (defined $2 ? $2 : (defined $3 ? $3 : $4)), '';
                                }
                        }
                        return $hooks{preprocess}{$command}{call}->(
@@ -123,7 +123,7 @@ sub preprocess ($$$;$) { #{{{
                }
        };
        
-       $content =~ s{(\\?)\[\[(\w+)\s+((?:(?:\w+=)?(?:"[^"]+"|[^\s\]]+)\s*)*)\]\]}{$handle->($1, $2, $3)}eg;
+       $content =~ s{(\\?)\[\[(\w+)\s+((?:(?:\w+=)?(?:""".+"""|"[^"]+"|[^\s\]]+)\s*)*)\]\]}{$handle->($1, $2, $3)}eg;
        return $content;
 } #}}}
 
index 2ef99fa80a93ccfd18ea7fe17ce59ea2694fbad5..f2f5ba4a19659f950775cd62c320e42787fa78e1 100755 (executable)
@@ -23,7 +23,8 @@ extra_build:
                --plugin=brokenlinks --plugin=pagecount \
                --plugin=orphans --plugin=haiku --plugin=meta \
                --plugin=tag --plugin=polygen --plugin=pagestats \
-               --plugin=fortune --plugin=aggregate --plugin=map
+               --plugin=fortune --plugin=aggregate --plugin=map \
+               --plugin=template
        ./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
        ./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
                
index 31731af66b5aec50781e2cd19323c02304e8b859..1e2332c091b48386c2f164b2de2c2bfc5f5106cc 100644 (file)
@@ -16,15 +16,18 @@ be put after its name, to avoid confusion with a [[WikiLink]]. For example:
 
        \[[pagecount ]]
 
-A preprocessor directive does not need to all be on one line. Also,
-multiple lines of *quoted* text can be used for a value. Examples:
-
+A preprocessor directive does not need to all be on one line, it can be
+wrapped to multiple lines if you like:
+       
        \[[directive foo="baldersnatch"
        bar="supercalifragalisticexpealadocious" baz=11]]
 
-       \[[directive text="
-       1. foo
-       2. bar
-       3. baz
-       more lines
-       "]]
+Also, multiple lines of *quoted* text can be used for a value.
+To allow quote marks inside the quoted text, delimit the block
+of text with triple-quotes:
+
+       \[[directive text="""
+       1. "foo"
+       2. "bar"
+       3. "baz"
+       """]]
index 7bb9bb9f5c0c49a9a050cb1f509fe8a2bdd5ba18..abedf58055e7258393aed3a87bf4f1e2120eb7d5 100644 (file)
@@ -139,6 +139,15 @@ td.changelog {
        padding: 2ex 2ex;
 }
 
+.infobox {
+       float: right;
+       margin-left: 2ex;
+       margin-top: 1ex;
+       margin-bottom: 1ex;
+       padding: 2ex 2ex;
+       border: 1px solid #aaa;
+}
+
 /* outlines  */
 li.L1 {
        list-style: upper-roman;
index ba8b6d4f4c8d819d380c42a821803dc46aa36c81..73a1dc18e6ce72eafb6b8771a159f5031b15cb96 100644 (file)
@@ -8,6 +8,11 @@ ikiwiki (1.22) UNRELEASED; urgency=low
   * Allow preprocessor directives to span multiple lines, both to make
     long ones with lots of values easier to write, and to allow for ones with
     multi-line quoted values.
+  * Allow preprocessor directives to contain python-like triple-quoted
+    text blocks, for easy nesting of quotes inside.
+  * Add a template plugin.
+  * Use the template plugin to add infoboxes to each plugin page listing basic
+    info about the plugin.
 
  -- Joey Hess <joeyh@debian.org>  Tue, 22 Aug 2006 23:09:46 -0400
 
index 55c280984b18975e610db64970923ebc6487e14d..27152d056cfcd13173d2060388634e79eb4a0bd8 100644 (file)
@@ -1,4 +1,5 @@
-Here's how to get ikiwiki. See [[setup]] for how to use it, and be sure to add your wiki to [[IkiwikiUsers]] if you use ikiwiki.
+Here's how to get ikiwiki. See [[setup]] for how to use it, and be sure to
+add your wiki to [[IkiwikiUsers]] if you use ikiwiki.
 
 # tarball
 
index ae11842d0e30858353ae8c22fc3bb47b07bf4049..c79aa8f8a62e579e7059fd13226c27a213b83dd7 100644 (file)
@@ -11,9 +11,12 @@ Instead it can use [[Subversion]] (or [[Git]]).
   and [[bugs]] might also be of interest. Feel free to post your questions
   and thoughts about ikiwiki to [[Discussion]].
 
+[[template type=note text="""
+If you use ikiwiki, please list your wiki in [[IkiWikiUsers]]. Thanks!
+"""]]
+
 * [[Setup]] has a tutorial for setting up ikiwiki, and [[Usage]] documents
-  the parameters and usage of the ikiwiki program. If you use ikiwiki,
-  please add your wiki to [[IkiWikiUsers]].
+  the parameters and usage of the ikiwiki program.
 
 * [[Security]] lists potential security problems. ikiwiki is still being
   developed, and is being written with security as a priority, so don't
index a21d291d3c87edca55027246ae00e4ce342d9b29..dc943dd10e2253534562333dc663d9efb7b2f57e 100644 (file)
@@ -1,7 +1,12 @@
+[[template id=plugin name=aggregate included=1 author="""[[Joey]]"""]]
+[[tag type/useful]]
+
 This plugin allows content from other blogs to be aggregated into the wiki.
 Aggregate a blog as follows:
 
-       \[[aggregate name="example blog" feedurl="http://example.com/index.rss" url="http://example.com/" updateinterval="15"]]
+       \[[aggregate name="example blog"
+       feedurl="http://example.com/index.rss"
+       url="http://example.com/" updateinterval="15"]]
 
 That example aggregates posts from the expecified RSS feed, updating no
 more frequently than once every 15 minutes, and puts a page per post under
@@ -50,7 +55,3 @@ directive:
 Note that even if you are using subversion or another revision control
 system, pages created by aggregation will *not* be checked into revision
 control.
-
-This plugin is not enabled by default.
-
-[[tag type/useful]]
index e3f6357b789444442b233de478fceea042914d9d..2c6d9b4c7cfaf5c39b4e9733d81838a11d51d3f3 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=brokenlinks included=1 author="""[[Joey]]"""]]
+[[tag type/link type/meta]]
+
 This plugin generates a list of broken links on pages in the wiki. This is
 a useful way to find pages that still need to be written, or links that
 are written wrong.
@@ -5,9 +8,6 @@ are written wrong.
 The optional parameter "pages" can be a [[PageSpec]] specifying the pages
 to search for broken links, default is search them all.
 
-This plugin is included in ikiwiki, but is not enabled by default.
-If it is turned on, here's a list of broken links on this wiki:
+If this plugin is turned on, here's a list of broken links on this wiki:
 
 [[brokenlinks ]]
-
-[[tag type/link type/meta]]
index a5006f9bf2fa2cb7bdfb5a50aadbdf55a1240d10..f8d8b39ab9310232b56a79996edde8aca6948107 100644 (file)
@@ -1,9 +1,9 @@
+[[template id=plugin name=camelcase included=1 author="""[[Joey]]"""]]
+
 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.
 
-This plugin is included in ikiwiki, but is not enabled by default.
-
 If this plugin is enabled, here is a link: SandBox
 
 [[tag type/link]]
index 3c194d59b2e0f722316d2f6076ff9a5527b25116..90ccb14d5afa76583c9b0beaf6f89d55a5a5b751 100644 (file)
@@ -1,3 +1,5 @@
+[[template id=plugin name=linguas author="""Jorda Polo"""]]
+
 Linguas
 =======
 
index f4c45a921de8731c8f6b5857101d7e42437f4e53..65aa355cdbea0611e4d3b37642786cbbfd838338 100644 (file)
@@ -1,14 +1,13 @@
+[[template id=plugin name=fortune included=1 author="""[[Joey]]"""]]
+[[tag type/fun]]
+
 This just uses the `fortune` program to insert a fortune into the page.
 Usage:
 
        \[[fortune ]]
 
-This plugin is included in ikiwiki, but not enabled by default.
-
 If this plugin is enabled, here's a fortune for you:
 
 ----
 
 [[fortune ]]
-
-[[tag type/fun]]
index d78e609da9132e5cfbd20d8b9d04035efbe21754..1ea5eb4d912ad485c1d7f7a39554f45e79e77e15 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=haiku included=1 author="""[[Joey]]"""]]
+[[tag type/fun]]
+
 This plugin allows inserting a randomly generated haiku into a wiki page.
 Just type:
 
@@ -10,11 +13,8 @@ what to write the haiku about. If no hint is given, it might base it on the
 page name. Since the vocabulary it knows is very small, many hints won't
 affect the result at all.
 
-This plugin is included in ikiwiki, but is not enabled by default. As a
-special bonus, enabling this plugin makes any error messages ikiwiki should
-display be written in haiku.
+As a special bonus, enabling this plugin makes any error messages ikiwiki
+should display be written in haiku.
 
 You need to have the Coy module installed for this plugin to do anything
 interesting. That does all the heavy lifting.
-
-[[tag type/fun]]
index 400adb9eedab31958acfb56598bf286ab739128e..5d300e5ff85f69219d908f506bac44008d5d2012 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=html included=1 author="""[[Joey]]"""]]
+[[tag type/html type/format]]
+
 This plugin lets raw 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
@@ -6,5 +9,3 @@ sanitised like any other page. You can also use standard [[WikiLink]]s etc
 in the html pages.
 
 This plugin is included in ikiwiki, but is not enabled by default.
-
-[[tag type/html type/format]]
index 770031650b3900e6ed481c1805366c8074dd9d7f..252fcd5d24d74ff2c4ed6fc1fa2f018a5f906082 100644 (file)
@@ -1,3 +1,7 @@
+[[template id=plugin name=htmlscrubber core=1 included=1
+author="""[[Joey]]"""]]
+[[tag type/html type/core]]
+
 This plugin is enabled by default. It sanitizes the html on pages it renders
 to avoid XSS attacks and the like.
 
@@ -28,5 +32,3 @@ plugin is active:
 * <span style="background: url(javascript:window.location='http://example.org/')">test</span>
 * <span style="&#x61;&#x6e;&#x79;&#x3a;&#x20;&#x65;&#x78;&#x70;&#x72;&#x65;&#x73;&#x73;&#x69;&#x6f;&#x6e;&#x28;&#x77;&#x69;&#x6e;&#x64;&#x6f;&#x77;&#x2e;&#x6c;&#x6f;&#x63;&#x61;&#x74;&#x69;&#x6f;&#x6e;&#x3d;&#x27;&#x68;&#x74;&#x74;&#x70;&#x3a;&#x2f;&#x2f;&#x65;&#x78;&#x61;&#x6d;&#x70;&#x6c;&#x65;&#x2e;&#x6f;&#x72;&#x67;&#x2f;&#x27;&#x29;">test</span>
 * <span style="&#97;&#110;&#121;&#58;&#32;&#101;&#120;&#112;&#114;&#101;&#115;&#115;&#105;&#111;&#110;&#40;&#119;&#105;&#110;&#100;&#111;&#119;&#46;&#108;&#111;&#99;&#97;&#116;&#105;&#111;&#110;&#61;&#39;&#104;&#116;&#116;&#112;&#58;&#47;&#47;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#111;&#114;&#103;&#47;&#39;&#41;">test</span>
-
-[[tag type/html type/core]]
index 9da9c4d98aeb1142ab9b21808062b25247795210..c16c7bc71099abfb38129612f5b3ee0a3952f557 100644 (file)
@@ -1,8 +1,9 @@
+[[template id=plugin name=htmltidy included=1 author="""Faidon Liambotis"""]]
+[[tag type/html]]
+
 This plugin uses [tidy](http://tidy.sourceforge.net/) to tidy up the html
 emitted by ikiwiki. Besides being nicely formatted, this helps ensure that
 even if users enter suboptimal html, your wiki generates valid html.
 
-This plugin is included in ikiwiki, but is not enabled by default.
-It was contributed by Faidon Liambotis.
-
-[[tag type/html]]
+Note that since tidy is an external program, that is run each time a page
+is built, this plugin will slow ikiwiki down somewhat.
index a142df1548d9272fe51b26b3fc14c1b69f0e5387..fa8e0c334b2be06ac55587d9191969d697f5e2b4 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=inline core=1 included=1 author="""[[Joey]]"""]]
+[[tag type/core]]
+
 This is a [[PreProcessorDirective]] that allows including one wiki page
 inside another. For example:
 
@@ -24,7 +27,3 @@ directive:
   if raw is set to "yes", the page will be included raw, without additional
   markup around it, as if it were a literal part of the source of the 
   inlining page.
-
-This plugin is enabled by default.
-
-[[tag type/core]]
index cd2ef1bc5b762ae7ce693c5d3e561505bba02e14..7780c3306015549baadab42f75ce93a261d0c4c9 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=map included=1 author="""Alessandro Dotti Contra"""]]
+[[tag type/meta]]
+
 This plugin generates a hierarchical page map for the wiki. Example usage:
 
        \[[map pages="* and !blog/* and !*/Discussion"]]
@@ -15,5 +18,3 @@ If this plugin is enabled, here is a page map for the plugins section
 of this wiki:
 
 [[map pages="(plugins or plugins/*) and !*/*/*"]]
-
-[[tag type/meta]]
index 25e46cd0151b15acefd8c847a6b53535d8db6191..34c688ce1e8b1d5209e60c4571b5bc38e0e29fcf 100644 (file)
@@ -1,5 +1,8 @@
-This plugin, which is enabled by default, lets ikwiki convert files with
-names ending in ".mdwn" to html. It uses the [[markdown]] minimal markup
-language.
-
+[[template id=plugin name=mdwn core=1 included=1 author="""[[Joey]]"""]]
 [[tag type/format type/core]]
+
+This plugin lets ikwiki convert files with names ending in ".mdwn" to html.
+It uses the [[markdown]] minimal markup language.
+
+This is the standard markup language used by ikiwiki, although some others
+are also available in other plugins.
index 19262f86bae4e80926f1b71b40e9158717b3542c..84d48d8ef8d346d91e855616531b06b72c065f51 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=meta included=1 author="""[[Joey]]"""]]
+[[tag type/meta]]
+
 This plugin allows inserting arbitrary metadata into the source of a page.
 Enter the metadata as follows:
 
@@ -52,8 +55,5 @@ 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.
 
-This plugin is included in ikiwiki, but it is not enabled by default. If
-it is enabled, the title of this page will say it is.
+If this plugin is enabled, the title of this page will say that it is.
 [[meta title="meta plugin (enabled)"]]
-
-[[tag type/meta]]
index 4591ebf59f939c742a911b49b5b3f8ff9f8bd51e..1eab368f9221ff232a526e4a17a2e3cbea078ef0 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=orphans included=1 author="""[[Joey]]"""]]
+[[tag type/meta]]
+
 This plugin generates a list of possibly orphaned pages -- pages that no
 other page links to.
 
@@ -8,9 +11,6 @@ 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.
 
-This plugin is included in ikiwiki, but is not enabled by default.
-If it is turned on, here's a list of orphaned pages on this wiki:
+If it is enabled, here's a list of orphaned pages on this wiki:
 
 [[orphans ]]
-
-[[tag type/meta]]
index fd3ac23eced9125a1e80c7c98d4898057b2a9653..4d45125f526ecc2b666e13b7eaddff77d1ed2e2c 100644 (file)
@@ -1,7 +1,6 @@
+[[template id=plugin name=otl included=1 author="""[[Joey]]"""]]
+[[tag type/format]]
+
 This plugin allows ikiwiki to process `.otl` outline files, as created by 
 [vimoutliner](http://www.vimoutliner.org/). To use it, you need to have 
 vimoutliner installed, since it uses the `otl2html` program.
-
-This plugin is included in ikiwiki, but is not enabled by default.
-
-[[tag type/format]]
index 8fc04ff762c6061e98f856d002ba0d775dd2cb75..9aae91a1e837372bcedb1078dd4822dc764a19e3 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=pagecount included=1 author="""[[Joey]]"""]]
+[[tag type/meta]]
+
 Provides a \\[[pagecount ]] [[PreProcessorDirective]] that is replaced with
 the total number of pages currently in the wiki.
 
@@ -9,5 +12,3 @@ This plugin is included in ikiwiki, but is not enabled by default.
 If it is turned on it can tell us that this wiki includes
 [[pagecount ]] pages, of which [[pagecount pages="*/Discussion"]] are
 discussion pages.
-
-[[tag type/meta]]
index 93e9f569487f8c735132b42698d53a4fab9a7e9b..4e194f84a33ebc9cbc93f2072b908ebf4be13d8d 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=pagestate included=1 author="""Enrico Zini"""]]
+[[tag type/meta type/tags]]
+
 This plugin can generate stats about how pages link to each other. It can
 produce either a del.icio.us style cloud, or a table counting the number of
 links to each page.
@@ -9,8 +12,3 @@ Here's how to use it to create a [[tag]] cloud:
 And here's how to create a table of all the pages on the wiki:
 
        \[[pagestats style="table"]]
-
-This plugin is included in ikiwiki, but is not enabled by default.
-It was contributed by Enrico Zini
-
-[[tag type/meta type/tags]]
index d04708e2a26ec1e6abcd824b7f88e0413146784e..b49eeda0ebb755e98e963d817143933b0c8bc997 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=polygen included=1 author="""Enrico Zini"""]]
+[[tag type/fun]]
+
 This plugin allows inserting text generated by polygen into a wiki page.
 For example:
 
@@ -6,9 +9,6 @@ For example:
 It's also possible to specify a starting nonterminal for the grammar by
 including `symbol="text"` in the directive.
 
-This plugin is included in ikiwiki, but not enabled by default.
-It was contributed by Enrico Zini.
-
 ----
 
 If this plugin is enabled, and polygen is installed, here are a few notes
@@ -25,5 +25,3 @@ Ikiwiki reviews:
 <li>[[polygen grammar="reviews"]]</li>
 <li>[[polygen grammar="reviews"]]</li>
 </ul>
-
-[[tag type/fun]]
index 0f0d6f96c6b5fef32c5768e56ad85213d411ab5c..f7cbf57bb9b9910133b4f5d59c06f49b5b119126 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=rst included=1 author="""Sergio Talens-Oliag"""]]
+[[tag type/format]]
+
 This plugin lets ikwiki convert files with names ending in ".rst" to html.
 It uses the [reStructuredText](http://docutils.sourceforge.net/rst.html)
 markup syntax. You need to have the python-docutils module installed to use
@@ -17,8 +20,3 @@ ikiwiki. Limitations include:
 So while you may find this useful for importing old files into your wiki,
 using this as your main markup language in ikiwiki isn't recommended at
 this time.
-
-This plugin is included in ikiwiki, but not enabled by default.
-It was contributed by Sergio Talens-Oliag.
-
-[[tag type/format]]
index 78088aed87e0a0d36f77af68fb6bb4b489022844..a95302fcc993516445c6027e86d1226823367b86 100644 (file)
@@ -1,8 +1,9 @@
+[[template id=plugin name=search included=1 author="""[[Joey]]"""]]
+[[tag type/useful]]
+
 This plugin is included in ikiwiki, but is not enabled by default. It adds
 full text search to ikiwiki, using the [[HyperEstraier]] engine.
 
 It's possible to configure HyperEstraier via one of ikiwiki's
 [[templates]], but for most users, no configuration should be needed aside
 from enabling the plugin.
-
-[[tag type/useful]]
index 8ab416f6f8ac5f801bb1b44156308c817ea52a3e..4be012e391a3c2a6edc25577d752feaf0c2cdeb2 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=sidebar included=1 author="""Tuomo Valkonen"""]]
+[[tag type/chrome]]
+
 If this plugin is enabled, then a sidebar is added to pages in the wiki.
 The content of the sidebar is simply the content of a page named
 "sidebar" (ie, create a "sidebar.mdwn").
@@ -10,8 +13,3 @@ SubPages, if the plugin is enabled.
 Note that to disable a sidebar for a [[SubPage]] of a page that has a sidebar,
 you can create a sidebar page that is completely empty. This will turn off
 the sidebar altogether.
-
-This plugin is included in ikiwiki, but is not enabled by default.
-It was contributed by Tuomo Valkonen.
-
-[[tag type/chrome]]
index 29a038786701f4c664dfa807ed80e385473fc199..b0f65f4af897eeec9155d5ac27b2c904cf7a6721 100644 (file)
@@ -1,8 +1,9 @@
+[[template id=plugin name=smiley included=1 author="""[[Joey]]"""]]
+[[tag type/chrome]]
+
 This plugin makes it easy to insert smileys and other special symbols into
 pages in the wiki. The symbols are all listed on the [[smileys]] page,
 which serves as both configuration for the plugin and a list of available
 smileys.
 
 This plugin is included in ikiwiki, but is not enabled by default. :-)
-
-[[tag type/format]]
index f24accafab3d821ca012c03e559048e6358358c6..8df139c0bca6fa9a418d3934328afb03053c6ef7 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=tag included=1 author="""[[Joey]]"""]]
+[[tag type/tags type/link]]
+
 This plugin allows tagging pages. List tags as follows:
 
        \[[tag tech life linux]]
@@ -14,8 +17,5 @@ tags/tech, tags/life, and tags/linux. This is a useful way to avoid
 having to write the full path to tags, if you want to keep them grouped
 together out of the way.
 
-This plugin is included in ikiwiki, but is not enabled by default. If it is
-enabled, you'll see a note below that this page is tagged with the "tags"
-tag.
-
-[[tag type/tags type/link]]
+If this plugin is enabled, you'll see a note below that this page is tagged
+with the "tags" tag.
diff --git a/doc/plugins/template.mdwn b/doc/plugins/template.mdwn
new file mode 100644 (file)
index 0000000..9e2ab08
--- /dev/null
@@ -0,0 +1,49 @@
+[[template id=plugin name=template included=1 author="""[[Joey]]"""]]
+[[tag type/format]]
+
+With this plugin, you can set up templates, and cause them to be filled out
+and inserted into pages in the wiki. Using a template works like this:
+
+       \[[template id=foo name="Charley" color="red" age=11]]
+
+This fills out the template `templates/foo`, filling in the `color` and `age`
+fields on it with the specified values, and inserts the result into the page.
+
+If a value is triple-quoted, it can include any markup that would be
+allowed in the wiki page outside the template. Combined with multi-line
+quoted values, this allows for large chunks of marked up text to be
+embedded into a template:
+
+       \[[template id=foo name="Sally" color="green" age=8 notes="""
+       * \[[Charley]]'s sister.
+       * Really 8 and a half.
+       * Wants to be an astronaut when she grows up.
+       """]]
+
+To create a template, make a page in the wiki named `template/foo`. Note
+that this is a different location than the directory used for the
+[[templates]] used to build the wiki itself, which is not inside the wiki.
+
+The template uses the syntax used by the HTML::Template perl module, which
+allows for some fairly complex things to be done. Consult its documentation
+for the full syntax, but all you really need to know are a few things:
+
+* To insert the value of a variable, use `<TMPL_VAR variable>`.
+* To make a block of text conditional on a variable being set use
+  `<TMPL_IF NAME="variable">text</TMPL_IF>`.
+
+Here's a sample template:
+
+       <span class="infobox">
+       Name: <TMPL_VAR name><br />
+       Age: <TMPL_VAR age><br />
+       <TMPL_IF NAME="color">
+       Favorite color: <TMPL_VAR color><br />
+       <TMPL_ELSE>
+       No favorite color.<br />
+       </TMPL_IF>
+       <TMPL_IF NAME="notes">
+       <hr />
+       <TMPL_VAR notes>
+       </TMPL_IF>
+       </span>
index 603dda4ca507b66769622936e7135e09b6abb6b7..195e8251c65d1ebda9d6d5ea75578256f6fc7f47 100644 (file)
@@ -1,3 +1,6 @@
+[[template id=plugin name=wikitext included=1 author="""[[Joey]]"""]]
+[[tag type/format]]
+
 This plugin allows ikiwiki to process pages written in the original wiki
 text format. To use it, you need to have the Text::WikiFormat perl module
 installed, enable the plugin, then files with the extention `.wiki` will be
@@ -18,7 +21,3 @@ asterisk and space. Ordered lists consist of items marked with combination
 of one or more alphanumeric characters followed by a period and an optional
 space. Any indented text without either marking is code, handled literally.
 You can nest lists.
-
-This plugin is included in ikiwiki, but is not enabled by default.
-
-[[tag type/format]]
index f3567d1558c5c2993571b5dc5a4eb0b9d33d2a46..dc763ef40a01bbae7d0f7ec09a3b8d08130dee89 100644 (file)
@@ -145,6 +145,13 @@ with a username containing html code (anymore).
 It's difficult to know for sure if all such avenues have really been
 closed though.
 
+## HTML::Template security
+
+If the [[plugins/template]] plugin is enabled, users can modify templates
+like any other part of the wiki. This assumes that HTML::Template is secure
+when used with untrusted/malicious templates. (Note that includes are not
+allowed, so that's not a problem.)
+
 ----
 
 # Fixed holes
diff --git a/doc/templates/note.mdwn b/doc/templates/note.mdwn
new file mode 100644 (file)
index 0000000..29dca8f
--- /dev/null
@@ -0,0 +1,3 @@
+<span class="infobox">
+<TMPL_VAR content>
+</span>
diff --git a/doc/templates/plugin.mdwn b/doc/templates/plugin.mdwn
new file mode 100644 (file)
index 0000000..ca69efd
--- /dev/null
@@ -0,0 +1,6 @@
+<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 />
+</span>
diff --git a/doc/todo/infoboxes.mdwn b/doc/todo/infoboxes.mdwn
deleted file mode 100644 (file)
index 293cd66..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# thoughts on infoboxes
-
-I was thinking about adding a [[preprocessordirective]] to make it easy to
-add an info box. Something like:
-
-       \[[infobox "text here"]]
-
-But it seems it would be better if multi-line text could be put inside,
-maybe expanding the syntax a bit:
-
-       \[[infobox "
-       text here
-       and here
-       etc.
-       "]]
-
-This would just wrap the text up in a span element that was styled to float
-to the right, with a border, the way info boxes do on some wikis.
-
-However, as I thought about it some more, I realized that this would be
-just as easy to type:
-
-       <span id=infobox>
-       text here
-       </span>
-
-Why invent new syntax, after all? I see no reason to for something this
-simple.
-
-However, maybe in the more complex case, this would be useful. If the
-infobox filled in a kind of template:
-
-       \[[infobox type=person name="Joey Hess" email=joey@kitenet.net url="http://kitenet.net/~joey/" description="
-       Joey is the author of ikiwiki and some other stuff. *Yay*!
-       "]]
-
-That might be a lot more useful. Or here's one to use to describe ikiwiki's
-own plugins:
-
-       \[[infobox type=plugin name="sidebar" author="Tuomo Valkonen" core=no]]
-
-This would expand by filling out the template page, which would be
-infobox/person or infobox/plugin, or whatever, and would have some syntax
-(possibly HTML::Template, if it's secure) for testing for values and
-embedding variables. Of course it would register a dependency on its
-template so changes to the template update all the pages.
-
-(Since it's a preprocessor directive, the big multiline blocks of text can
-mix markdown (or whatever) with html, wikilinks, etc, in a natural way,
-which is nice..)