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