X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/47298b01c1921deff7e056406245a90f8371bd59..2e15a490067991448c3b65323ad9ecdc774dbfe4:/IkiWiki/Plugin/format.pm?ds=sidebyside

diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm
index 1513cbed7..b596bc0a1 100644
--- a/IkiWiki/Plugin/format.pm
+++ b/IkiWiki/Plugin/format.pm
@@ -7,6 +7,16 @@ use IkiWiki 3.00;
 
 sub import {
 	hook(type => "preprocess", id => "format", call => \&preprocess);
+	hook(type => "getsetup",   id => "format", call => \&getsetup);
+}
+
+sub getsetup () {
+	return
+		plugin => {
+			safe => 1,
+			rebuild => undef,
+			section => "widget",
+		},
 }
 
 sub preprocess (@) {
@@ -19,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));
 	}
 }