2006-12-29 06:18:39 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# By mazirian; GPL license
|
|
|
|
# Textile markup
|
|
|
|
|
|
|
|
package IkiWiki::Plugin::textile;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2008-12-23 22:34:19 +01:00
|
|
|
use IkiWiki 3.00;
|
2008-06-16 21:43:37 +02:00
|
|
|
use Encode;
|
2006-12-29 06:18:39 +01:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub import {
|
2008-08-04 01:35:35 +02:00
|
|
|
hook(type => "getsetup", id => "textile", call => \&getsetup);
|
2009-05-16 14:59:36 +02:00
|
|
|
hook(type => "htmlize", id => "txtl", call => \&htmlize, longname => "Textile");
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2006-12-29 06:18:39 +01:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub getsetup () {
|
2008-08-04 01:35:35 +02:00
|
|
|
return
|
|
|
|
plugin => {
|
|
|
|
safe => 1,
|
|
|
|
rebuild => 1, # format plugin
|
2010-02-12 07:10:36 +01:00
|
|
|
section => "format",
|
2008-08-04 01:35:35 +02:00
|
|
|
},
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2008-08-04 01:35:35 +02:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub htmlize (@) {
|
2006-12-29 06:18:39 +01:00
|
|
|
my %params=@_;
|
2008-06-16 21:43:37 +02:00
|
|
|
my $content = decode_utf8(encode_utf8($params{content}));
|
2006-12-29 06:18:39 +01:00
|
|
|
|
|
|
|
eval q{use Text::Textile};
|
|
|
|
return $content if $@;
|
|
|
|
return Text::Textile::textile($content);
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2006-12-29 06:18:39 +01:00
|
|
|
|
|
|
|
1
|