2006-07-07 20:28:27 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# WikiText markup
|
|
|
|
package IkiWiki::Plugin::wikitext;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2008-12-23 22:34:19 +01:00
|
|
|
use IkiWiki 3.00;
|
2006-07-07 20:28:27 +02:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub import {
|
2008-08-04 01:35:35 +02:00
|
|
|
hook(type => "getsetup", id => "wiki", call => \&getsetup);
|
2006-09-10 00:50:27 +02:00
|
|
|
hook(type => "htmlize", id => "wiki", call => \&htmlize);
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2006-07-07 20:28:27 +02:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub getsetup () {
|
2008-08-04 01:35:35 +02:00
|
|
|
return
|
|
|
|
plugin => {
|
|
|
|
safe => 0, # format plugin
|
|
|
|
rebuild => undef,
|
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-08-28 20:17:59 +02:00
|
|
|
my %params=@_;
|
|
|
|
my $content = $params{content};
|
2006-07-07 20:28:27 +02:00
|
|
|
|
2006-11-20 11:29:39 +01:00
|
|
|
eval q{use Text::WikiFormat};
|
|
|
|
return $content if $@;
|
2006-07-07 20:28:27 +02:00
|
|
|
return Text::WikiFormat::format($content, undef, { implicit_links => 0 });
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2006-07-07 20:28:27 +02:00
|
|
|
|
|
|
|
1
|