--- /dev/null
+#!/usr/bin/perl
+# Ikiwiki tag plugin.
+package IkiWiki::Plugin::tag;
+
+use warnings;
+use strict;
+use IkiWiki;
+
+my %tag;
+
+sub import { #{{{
+ IkiWiki::hook(type => "preprocess", id => "tag", call => \&preprocess);
+} # }}}
+
+sub preprocess (@) { #{{{
+ if (! @_) {
+ return "";
+ }
+ my %params=@_;
+ my $page = $params{page};
+ delete $params{page};
+
+ foreach my $tag (keys %params) {
+ # hidden WikiLink
+ push @{$IkiWiki::links{$page}}, $tag;
+ }
+
+ return "";
+} # }}}
+
+1
# Note: preserve order of params, some plugins may
# consider it significant.
my @params;
- while ($params =~ /(\w+)=\"?([^"]+)"?(\s+|$)/g) {
- push @params, $1, $2;
+ while ($params =~ /(?:(\w+)=)?(?:"([^"]+)"|(\S+))(?:\s+|$)/g) {
+ if (defined $1) {
+ push @params, $1, (defined $2 ? $2 : $3);
+ }
+ else {
+ push @params, (defined $2 ? $2 : $3), '';
+ }
}
return $hooks{preprocess}{$command}{call}->(@params, page => $page);
}
This gets expanded before the rest of the page is processed, and can be used
to transform the page in various ways.
+The quotes around values can be omitted if the value is a simple word.
+Also, some directives may use parameters without values, for example:
+
+\\[[tag foo]]
+
Note that if a preprocessor directive has no parameters, a space still must
be put after its name, to avoid confusion with a [[WikiLink]]. For example:
+ikiwiki (1.11) UNRELEASED; urgency=low
+
+ * Patch from Enrico that
+ - allows preprocessor directives to have parameters with no specified
+ value
+ - fixes preprocessor directive parameter parsing so that
+ foo=bar baz now means "foo=bar" and a "baz" with no value
+ - Add a tag plugin that allows more easily tagging pages.
+ The meta plugin can also still be used for this.
+
+ -- Joey Hess <joeyh@debian.org> Thu, 27 Jul 2006 17:03:09 -0400
+
ikiwiki (1.10) unstable; urgency=low
* Run page through any relevant filters when generating a page preview.
#timeformat => '%c',
# To add plugins, list them here.
- #add_plugins => [qw{pagecount brokenlinks search smiley wikitext}],
+ #add_plugins => [qw{meta tag pagecount brokenlinks search smiley
+ # wikitext camelcase}],
# If you want to disable any of the default plugins, list them here.
#disable_plugins => [qw{inline htmlscrubber}],
}
This plugin allows inserting arbitrary metadata into the source of a page.
-This plugin is not enabled by default. If it is enabled, the title of this
-page will say it is. [[meta title="meta plugin (enabled)"]]
Enter the metadata as follows:
\\[[meta field="value"]]
If the field is not treated specially (as the link and title fields are),
the metadata will be written to the generated html page as a <meta>
header.
+
+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.
+[[meta title="meta plugin (enabled)"]]
--- /dev/null
+This plugin allows tagging pages. List tags as follows:
+
+ \\[[tag tech life linux]]
+
+The tags work the same as if you had put a (hidden) [[WikiLink]] on the page
+for each tag, so you can use a [[GlobList]] to link to all pages that are
+tagged with a given tag, for example.
+
+This plugin is included in ikiwiki, but is not enabled by default.
in the category to it. That is just another form of tagging.
Sometimes you may want to tag a page without putting a visible link on it.
-The [[meta_plugin|plugins/meta]] allows you to do so, like this:
+The [[tag_plugin|plugins/tag]] allows you to do so, like this:
- \\[[meta link=mytag]]
+ \\[[tag mytag othertag thirdtag]]
One way to use these tags is to create a [[blog]] of pages that have a
particular set of tags. Or just look at the [[BackLinks]] to a tag page to