]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/textile.pm
CGI: if the page is missing, give the "missing page" a 404 status
[git.ikiwiki.info.git] / IkiWiki / Plugin / textile.pm
1 #!/usr/bin/perl
2 # By mazirian; GPL license
3 # Textile markup
5 package IkiWiki::Plugin::textile;
7 use warnings;
8 use strict;
9 use IkiWiki 3.00;
10 use Encode;
12 sub import {
13         hook(type => "getsetup", id => "textile", call => \&getsetup);
14         hook(type => "htmlize", id => "txtl", call => \&htmlize);
15 }
17 sub getsetup () {
18         return
19                 plugin => {
20                         safe => 1,
21                         rebuild => 1, # format plugin
22                 },
23 }
25 sub htmlize (@) {
26         my %params=@_;
27         my $content = decode_utf8(encode_utf8($params{content}));
29         eval q{use Text::Textile};
30         return $content if $@;
31         return Text::Textile::textile($content);
32 }
34 1