* 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.
master
joey 2006-08-23 05:41:07 +00:00
parent 78b279c3d8
commit 9d7375c3b2
37 changed files with 243 additions and 152 deletions

View File

@ -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

View File

@ -104,12 +104,12 @@ sub preprocess ($$$;$) { #{{{
# Note: preserve order of params, some plugins may # Note: preserve order of params, some plugins may
# consider it significant. # consider it significant.
my @params; my @params;
while ($params =~ /(?:(\w+)=)?(?:"([^"]+)"|(\S+))(?:\s+|$)/g) { while ($params =~ /(?:(\w+)=)?(?:"""(.+)"""|"([^"]+)"|(\S+))(?:\s+|$)/g) {
if (defined $1) { if (defined $1) {
push @params, $1, (defined $2 ? $2 : $3); push @params, $1, (defined $2 ? $2 : (defined $3 ? $3 : $4));
} }
else { else {
push @params, (defined $2 ? $2 : $3), ''; push @params, (defined $2 ? $2 : (defined $3 ? $3 : $4)), '';
} }
} }
return $hooks{preprocess}{$command}{call}->( 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; return $content;
} #}}} } #}}}

View File

@ -23,7 +23,8 @@ extra_build:
--plugin=brokenlinks --plugin=pagecount \ --plugin=brokenlinks --plugin=pagecount \
--plugin=orphans --plugin=haiku --plugin=meta \ --plugin=orphans --plugin=haiku --plugin=meta \
--plugin=tag --plugin=polygen --plugin=pagestats \ --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 1 doc/usage.mdwn > ikiwiki.man
./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man ./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man

View File

@ -16,15 +16,18 @@ be put after its name, to avoid confusion with a [[WikiLink]]. For example:
\[[pagecount ]] \[[pagecount ]]
A preprocessor directive does not need to all be on one line. Also, A preprocessor directive does not need to all be on one line, it can be
multiple lines of *quoted* text can be used for a value. Examples: wrapped to multiple lines if you like:
\[[directive foo="baldersnatch" \[[directive foo="baldersnatch"
bar="supercalifragalisticexpealadocious" baz=11]] bar="supercalifragalisticexpealadocious" baz=11]]
\[[directive text=" Also, multiple lines of *quoted* text can be used for a value.
1. foo To allow quote marks inside the quoted text, delimit the block
2. bar of text with triple-quotes:
3. baz
more lines \[[directive text="""
"]] 1. "foo"
2. "bar"
3. "baz"
"""]]

View File

@ -139,6 +139,15 @@ td.changelog {
padding: 2ex 2ex; padding: 2ex 2ex;
} }
.infobox {
float: right;
margin-left: 2ex;
margin-top: 1ex;
margin-bottom: 1ex;
padding: 2ex 2ex;
border: 1px solid #aaa;
}
/* outlines */ /* outlines */
li.L1 { li.L1 {
list-style: upper-roman; list-style: upper-roman;

5
debian/changelog vendored
View File

@ -8,6 +8,11 @@ ikiwiki (1.22) UNRELEASED; urgency=low
* Allow preprocessor directives to span multiple lines, both to make * 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 long ones with lots of values easier to write, and to allow for ones with
multi-line quoted values. 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 -- Joey Hess <joeyh@debian.org> Tue, 22 Aug 2006 23:09:46 -0400

View 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 # tarball

View 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 [[bugs]] might also be of interest. Feel free to post your questions
and thoughts about ikiwiki to [[Discussion]]. 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 * [[Setup]] has a tutorial for setting up ikiwiki, and [[Usage]] documents
the parameters and usage of the ikiwiki program. If you use ikiwiki, the parameters and usage of the ikiwiki program.
please add your wiki to [[IkiWikiUsers]].
* [[Security]] lists potential security problems. ikiwiki is still being * [[Security]] lists potential security problems. ikiwiki is still being
developed, and is being written with security as a priority, so don't developed, and is being written with security as a priority, so don't

View 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. This plugin allows content from other blogs to be aggregated into the wiki.
Aggregate a blog as follows: 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 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 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 Note that even if you are using subversion or another revision control
system, pages created by aggregation will *not* be checked into revision system, pages created by aggregation will *not* be checked into revision
control. control.
This plugin is not enabled by default.
[[tag type/useful]]

View 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 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 a useful way to find pages that still need to be written, or links that
are written wrong. are written wrong.
@ -5,9 +8,6 @@ are written wrong.
The optional parameter "pages" can be a [[PageSpec]] specifying the pages The optional parameter "pages" can be a [[PageSpec]] specifying the pages
to search for broken links, default is search them all. to search for broken links, default is search them all.
This plugin is included in ikiwiki, but is not enabled by default. If this plugin is turned on, here's a list of broken links on this wiki:
If it is turned on, here's a list of broken links on this wiki:
[[brokenlinks ]] [[brokenlinks ]]
[[tag type/link type/meta]]

View 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 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 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. 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 If this plugin is enabled, here is a link: SandBox
[[tag type/link]] [[tag type/link]]

View File

@ -1,3 +1,5 @@
[[template id=plugin name=linguas author="""Jorda Polo"""]]
Linguas Linguas
======= =======

View 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. This just uses the `fortune` program to insert a fortune into the page.
Usage: Usage:
\[[fortune ]] \[[fortune ]]
This plugin is included in ikiwiki, but not enabled by default.
If this plugin is enabled, here's a fortune for you: If this plugin is enabled, here's a fortune for you:
---- ----
[[fortune ]] [[fortune ]]
[[tag type/fun]]

View 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. This plugin allows inserting a randomly generated haiku into a wiki page.
Just type: 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 page name. Since the vocabulary it knows is very small, many hints won't
affect the result at all. affect the result at all.
This plugin is included in ikiwiki, but is not enabled by default. As a As a special bonus, enabling this plugin makes any error messages ikiwiki
special bonus, enabling this plugin makes any error messages ikiwiki should should display be written in haiku.
display be written in haiku.
You need to have the Coy module installed for this plugin to do anything You need to have the Coy module installed for this plugin to do anything
interesting. That does all the heavy lifting. interesting. That does all the heavy lifting.
[[tag type/fun]]

View 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 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 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 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. in the html pages.
This plugin is included in ikiwiki, but is not enabled by default. This plugin is included in ikiwiki, but is not enabled by default.
[[tag type/html type/format]]

View 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 This plugin is enabled by default. It sanitizes the html on pages it renders
to avoid XSS attacks and the like. 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="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="&#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> * <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]]

View 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 This plugin uses [tidy](http://tidy.sourceforge.net/) to tidy up the html
emitted by ikiwiki. Besides being nicely formatted, this helps ensure that emitted by ikiwiki. Besides being nicely formatted, this helps ensure that
even if users enter suboptimal html, your wiki generates valid html. even if users enter suboptimal html, your wiki generates valid html.
This plugin is included in ikiwiki, but is not enabled by default. Note that since tidy is an external program, that is run each time a page
It was contributed by Faidon Liambotis. is built, this plugin will slow ikiwiki down somewhat.
[[tag type/html]]

View 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 This is a [[PreProcessorDirective]] that allows including one wiki page
inside another. For example: inside another. For example:
@ -24,7 +27,3 @@ directive:
if raw is set to "yes", the page will be included raw, without additional 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 markup around it, as if it were a literal part of the source of the
inlining page. inlining page.
This plugin is enabled by default.
[[tag type/core]]

View 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: This plugin generates a hierarchical page map for the wiki. Example usage:
\[[map pages="* and !blog/* and !*/Discussion"]] \[[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: of this wiki:
[[map pages="(plugins or plugins/*) and !*/*/*"]] [[map pages="(plugins or plugins/*) and !*/*/*"]]
[[tag type/meta]]

View File

@ -1,5 +1,8 @@
This plugin, which is enabled by default, lets ikwiki convert files with [[template id=plugin name=mdwn core=1 included=1 author="""[[Joey]]"""]]
names ending in ".mdwn" to html. It uses the [[markdown]] minimal markup
language.
[[tag type/format type/core]] [[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.

View 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. This plugin allows inserting arbitrary metadata into the source of a page.
Enter the metadata as follows: Enter the metadata as follows:
@ -52,8 +55,5 @@ header.
The field value is treated as HTML entity-escaped text, so you can include 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. 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 If this plugin is enabled, the title of this page will say that it is.
it is enabled, the title of this page will say it is.
[[meta title="meta plugin (enabled)"]] [[meta title="meta plugin (enabled)"]]
[[tag type/meta]]

View 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 This plugin generates a list of possibly orphaned pages -- pages that no
other page links to. 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 page as linking to it, so will generally count many blog-type pages as
orphans. orphans.
This plugin is included in ikiwiki, but is not enabled by default. If it is enabled, here's a list of orphaned pages on this wiki:
If it is turned on, here's a list of orphaned pages on this wiki:
[[orphans ]] [[orphans ]]
[[tag type/meta]]

View 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 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](http://www.vimoutliner.org/). To use it, you need to have
vimoutliner installed, since it uses the `otl2html` program. vimoutliner installed, since it uses the `otl2html` program.
This plugin is included in ikiwiki, but is not enabled by default.
[[tag type/format]]

View 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 Provides a \\[[pagecount ]] [[PreProcessorDirective]] that is replaced with
the total number of pages currently in the wiki. 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 If it is turned on it can tell us that this wiki includes
[[pagecount ]] pages, of which [[pagecount pages="*/Discussion"]] are [[pagecount ]] pages, of which [[pagecount pages="*/Discussion"]] are
discussion pages. discussion pages.
[[tag type/meta]]

View 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 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 produce either a del.icio.us style cloud, or a table counting the number of
links to each page. 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: And here's how to create a table of all the pages on the wiki:
\[[pagestats style="table"]] \[[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]]

View 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. This plugin allows inserting text generated by polygen into a wiki page.
For example: For example:
@ -6,9 +9,6 @@ For example:
It's also possible to specify a starting nonterminal for the grammar by It's also possible to specify a starting nonterminal for the grammar by
including `symbol="text"` in the directive. 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 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>
<li>[[polygen grammar="reviews"]]</li> <li>[[polygen grammar="reviews"]]</li>
</ul> </ul>
[[tag type/fun]]

View 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. This plugin lets ikwiki convert files with names ending in ".rst" to html.
It uses the [reStructuredText](http://docutils.sourceforge.net/rst.html) It uses the [reStructuredText](http://docutils.sourceforge.net/rst.html)
markup syntax. You need to have the python-docutils module installed to use 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, 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 using this as your main markup language in ikiwiki isn't recommended at
this time. this time.
This plugin is included in ikiwiki, but not enabled by default.
It was contributed by Sergio Talens-Oliag.
[[tag type/format]]

View 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 This plugin is included in ikiwiki, but is not enabled by default. It adds
full text search to ikiwiki, using the [[HyperEstraier]] engine. full text search to ikiwiki, using the [[HyperEstraier]] engine.
It's possible to configure HyperEstraier via one of ikiwiki's It's possible to configure HyperEstraier via one of ikiwiki's
[[templates]], but for most users, no configuration should be needed aside [[templates]], but for most users, no configuration should be needed aside
from enabling the plugin. from enabling the plugin.
[[tag type/useful]]

View 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. 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 The content of the sidebar is simply the content of a page named
"sidebar" (ie, create a "sidebar.mdwn"). "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, 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 you can create a sidebar page that is completely empty. This will turn off
the sidebar altogether. the sidebar altogether.
This plugin is included in ikiwiki, but is not enabled by default.
It was contributed by Tuomo Valkonen.
[[tag type/chrome]]

View 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 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, 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 which serves as both configuration for the plugin and a list of available
smileys. smileys.
This plugin is included in ikiwiki, but is not enabled by default. :-) This plugin is included in ikiwiki, but is not enabled by default. :-)
[[tag type/format]]

View 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: This plugin allows tagging pages. List tags as follows:
\[[tag tech life linux]] \[[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 having to write the full path to tags, if you want to keep them grouped
together out of the way. together out of the way.
This plugin is included in ikiwiki, but is not enabled by default. If it is If this plugin is enabled, you'll see a note below that this page is tagged
enabled, you'll see a note below that this page is tagged with the "tags" with the "tags" tag.
tag.
[[tag type/tags type/link]]

View File

@ -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>

View 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 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 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 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 of one or more alphanumeric characters followed by a period and an optional
space. Any indented text without either marking is code, handled literally. space. Any indented text without either marking is code, handled literally.
You can nest lists. You can nest lists.
This plugin is included in ikiwiki, but is not enabled by default.
[[tag type/format]]

View 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 It's difficult to know for sure if all such avenues have really been
closed though. 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 # Fixed holes

3
doc/templates/note.mdwn vendored 100644
View File

@ -0,0 +1,3 @@
<span class="infobox">
<TMPL_VAR content>
</span>

6
doc/templates/plugin.mdwn vendored 100644
View File

@ -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>

View File

@ -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..)