summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/tag.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-27 21:38:02 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-27 21:38:02 +0000
commit5017ffd8a512c09d3c34764709791812acfc5515 (patch)
tree845afc1ef1a8de038c10c154f99b4099cf389ce3 /IkiWiki/Plugin/tag.pm
parent06dc80b6625f2874ca8ad177306395dd01ef9c6a (diff)
* 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.
Diffstat (limited to 'IkiWiki/Plugin/tag.pm')
-rw-r--r--IkiWiki/Plugin/tag.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm
new file mode 100644
index 000000000..841d508bf
--- /dev/null
+++ b/IkiWiki/Plugin/tag.pm
@@ -0,0 +1,31 @@
+#!/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