Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[ikiwiki] / IkiWiki / Plugin / creole.pm
1 #!/usr/bin/perl
2 # WikiCreole markup
3 # based on the WikiText plugin.
4 package IkiWiki::Plugin::creole;
5
6 use warnings;
7 use strict;
8 use IkiWiki 2.00;
9
10 sub import { #{{{
11         hook(type => "htmlize", id => "creole", call => \&htmlize);
12 } # }}}
13
14 sub htmlize (@) { #{{{
15         my %params=@_;
16         my $content = $params{content};
17
18         eval q{use Text::WikiCreole};
19         return $content if $@;
20
21         # don't parse WikiLinks, ikiwiki already does
22         creole_link(sub { return shift });
23         creole_customlinks();
24
25         return creole_parse($content);
26 } # }}}
27
28 1