summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/format.pm
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-02 20:15:21 +0100
committerintrigeri <intrigeri@boum.org>2008-11-02 20:15:21 +0100
commit7b28deb171455a207e536b8abebbca67242a4588 (patch)
tree09d6933412129bbf110abd253d056bf374f400bd /IkiWiki/Plugin/format.pm
parentb6a4da775945856b07fdc8f1330a86f67e329ac9 (diff)
parent2ebc0bb82dd907b6c0eaa39441378cb3bd8152d5 (diff)
Merge branch 'prv/po' into pub/po
Diffstat (limited to 'IkiWiki/Plugin/format.pm')
-rw-r--r--IkiWiki/Plugin/format.pm29
1 files changed, 29 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm
new file mode 100644
index 000000000..a219190e8
--- /dev/null
+++ b/IkiWiki/Plugin/format.pm
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+package IkiWiki::Plugin::format;
+
+use warnings;
+use strict;
+use IkiWiki 2.00;
+
+sub import { #{{{
+ hook(type => "preprocess", id => "format", call => \&preprocess);
+} #}}}
+
+sub preprocess (@) { #{{{
+ my $format=$_[0];
+ shift; shift;
+ my $text=$_[0];
+ shift; shift;
+ my %params=@_;
+
+ if (! defined $format || ! defined $text) {
+ error(gettext("must specify format and text"));
+ }
+ elsif (! exists $IkiWiki::hooks{htmlize}{$format}) {
+ error(sprintf(gettext("unsupported page format %s"), $format));
+ }
+
+ return IkiWiki::htmlize($params{page}, $params{destpage}, $format, $text);
+} #}}}
+
+1