2008-06-20 01:11:03 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# WikiCreole markup
|
|
|
|
# based on the WikiText plugin.
|
|
|
|
package IkiWiki::Plugin::creole;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
use IkiWiki 2.00;
|
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub import {
|
2008-08-03 22:40:12 +02:00
|
|
|
hook(type => "getsetup", id => "creole", call => \&getsetup);
|
2008-06-20 01:11:03 +02:00
|
|
|
hook(type => "htmlize", id => "creole", call => \&htmlize);
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2008-06-20 01:11:03 +02:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub getsetup {
|
2008-08-03 22:40:12 +02:00
|
|
|
return
|
|
|
|
plugin => {
|
|
|
|
safe => 1,
|
|
|
|
rebuild => 1, # format plugin
|
|
|
|
},
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2008-08-03 22:40:12 +02:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub htmlize (@) {
|
2008-06-20 01:11:03 +02:00
|
|
|
my %params=@_;
|
|
|
|
my $content = $params{content};
|
|
|
|
|
|
|
|
eval q{use Text::WikiCreole};
|
|
|
|
return $content if $@;
|
2008-06-20 01:54:46 +02:00
|
|
|
|
|
|
|
# don't parse WikiLinks, ikiwiki already does
|
|
|
|
creole_customlinks();
|
2008-06-21 03:35:49 +02:00
|
|
|
creole_custombarelinks();
|
2008-06-20 01:54:46 +02:00
|
|
|
|
|
|
|
return creole_parse($content);
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2008-06-20 01:11:03 +02:00
|
|
|
|
|
|
|
1
|