]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Plugin/camelcase.pm
* Fix utf-8 in blog post form.
[ikiwiki.git] / IkiWiki / Plugin / camelcase.pm
1 #!/usr/bin/perl
2 # CamelCase links
3 package IkiWiki::Plugin::camelcase;
4
5 use warnings;
6 use strict;
7
8 sub import { #{{{
9         IkiWiki::hook(type => "filter", id => "camelcase", call => \&filter);
10 } # }}}
11
12 sub filter (@) { #{{{
13         my %params=@_;
14
15         # Make CamelCase links work by promoting them to fullfledged
16         # WikiLinks. This regexp is based on the one in Text::WikiFormat.
17         $params{content}=~s#(?<![[|"/>=])\b((?:[A-Z][a-z0-9]\w*){2,})#[[$1]]#g;
18
19         return $params{content};
20 } #}}}
21
22 1