diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-10-31 16:42:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-10-31 16:42:20 -0400 |
commit | bb841f94f47d865e4c78bd4f27c5f9cc04dc1557 (patch) | |
tree | d42775d3546e6213074bbd31f0fb3ebc322f654f /IkiWiki/Plugin | |
parent | 6ad8b8f7608d58a366b2813a397851f0c1c94411 (diff) |
format: New plugin, allows embedding differntly formatted text inside a page (ie, otl inside a mdwn page, or syntax highlighted code inside a page).
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/format.pm | 29 |
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 |