]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/camelcase.pm
* Add support for links of the form [[../foo]], this links to the page
[git.ikiwiki.info.git] / IkiWiki / Plugin / camelcase.pm
1 #!/usr/bin/perl
2 # CamelCase links
3 package IkiWiki::Plugin::camelcase;
5 use IkiWiki;
6 use warnings;
7 use strict;
9 sub import { #{{{
10         hook(type => "filter", id => "camelcase", call => \&filter);
11 } # }}}
13 sub filter (@) { #{{{
14         my %params=@_;
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;
20         return $params{content};
21 } #}}}
23 1