]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/camelcase.pm
* Apply a patch from Carl Worth allowing a class attribute to be passed
[git.ikiwiki.info.git] / IkiWiki / Plugin / camelcase.pm
1 #!/usr/bin/perl
2 # CamelCase links
3 package IkiWiki::Plugin::camelcase;
5 use warnings;
6 use strict;
7 use IkiWiki 2.00;
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