aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/format.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-10-25 22:37:34 -0400
committerJoey Hess <joey@kitenet.net>2010-10-25 22:37:34 -0400
commit2076ed597c02bfede9063c3d40f4b855d4e8f8b8 (patch)
treefdff58f7baddd1ab9d5fe946825e15dc516b16cf /IkiWiki/Plugin/format.pm
parent38f0bec34560d2258a2d690676987b12ab184490 (diff)
downloadikiwiki-2076ed597c02bfede9063c3d40f4b855d4e8f8b8.tar
ikiwiki-2076ed597c02bfede9063c3d40f4b855d4e8f8b8.tar.gz
txt: Fix display when used inside a format directive.
txt's use of a format hook can't work in that case, so it needs to use a htmlizeformat hook in this case to handle wrapping the text in pre tags.
Diffstat (limited to 'IkiWiki/Plugin/format.pm')
-rw-r--r--IkiWiki/Plugin/format.pm24
1 files changed, 13 insertions, 11 deletions
diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm
index d54e71131..b596bc0a1 100644
--- a/IkiWiki/Plugin/format.pm
+++ b/IkiWiki/Plugin/format.pm
@@ -29,22 +29,24 @@ sub preprocess (@) {
if (! defined $format || ! defined $text) {
error(gettext("must specify format and text"));
}
+
+ # Other plugins can register htmlizeformat hooks to add support
+ # for page types not suitable for htmlize, or that need special
+ # processing when included via format. Try them until one succeeds.
+ my $ret;
+ IkiWiki::run_hooks(htmlizeformat => sub {
+ $ret=shift->($format, $text)
+ unless defined $ret;
+ });
+
+ if (defined $ret) {
+ return $ret;
+ }
elsif (exists $IkiWiki::hooks{htmlize}{$format}) {
return IkiWiki::htmlize($params{page}, $params{destpage},
$format, $text);
}
else {
- # Other plugins can register htmlizefallback
- # hooks to add support for page types
- # not suitable for htmlize. Try them until
- # one succeeds.
- my $ret;
- IkiWiki::run_hooks(htmlizefallback => sub {
- $ret=shift->($format, $text)
- unless defined $ret;
- });
- return $ret if defined $ret;
-
error(sprintf(gettext("unsupported page format %s"), $format));
}
}