]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Plugin/creole.pm
table: Fix misparsed links in external files
[ikiwiki.git] / 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 3.00;
9
10 sub import {
11         hook(type => "getsetup", id => "creole", call => \&getsetup);
12         hook(type => "htmlize", id => "creole", call => \&htmlize);
13 }
14
15 sub getsetup {
16         return
17                 plugin => {
18                         safe => 1,
19                         rebuild => 1, # format plugin
20                 },
21 }
22
23 sub htmlize (@) {
24         my %params=@_;
25         my $content = $params{content};
26
27         eval q{use Text::WikiCreole};
28         return $content if $@;
29
30         # don't parse WikiLinks, ikiwiki already does
31         creole_customlinks();
32         creole_custombarelinks();
33
34         return creole_parse($content);
35 }
36
37 1