Put in a workaround for #622591, by ensuring Search::Xapian gets loaded before Image...
[ikiwiki] / IkiWiki / Plugin / textile.pm
1 #!/usr/bin/perl
2 # By mazirian; GPL license
3 # Textile markup
4
5 package IkiWiki::Plugin::textile;
6
7 use warnings;
8 use strict;
9 use IkiWiki 3.00;
10 use Encode;
11
12 sub import {
13         hook(type => "getsetup", id => "textile", call => \&getsetup);
14         hook(type => "htmlize", id => "txtl", call => \&htmlize, longname => "Textile");
15 }
16
17 sub getsetup () {
18         return
19                 plugin => {
20                         safe => 1,
21                         rebuild => 1, # format plugin
22                         section => "format",
23                 },
24 }
25
26 sub htmlize (@) {
27         my %params=@_;
28         my $content = decode_utf8(encode_utf8($params{content}));
29
30         eval q{use Text::Textile};
31         return $content if $@;
32         return Text::Textile::textile($content);
33 }
34
35 1