<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
package IkiWiki::Plugin::format;

use warnings;
use strict;
use IkiWiki 2.00;

sub import { #{{{
	hook(type =&gt; "preprocess", id =&gt; "format", call =&gt; \&amp;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,
		IkiWiki::preprocess($params{page}, $params{destpage}, $text));
} #}}}

1
</pre></body></html>