]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/camelcase.pm
* table plugin: Actually specify the delimiter when parsing CSV.
[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{
19                 (?<![[|"/>=])   # try to avoid expanding non-links
20                                 # with a zero width negative lookbehind for
21                                 # characters that suggest it's not a link
22                 \b              # word boundry
23                 (
24                         (?:
25                                 [A-Z]           # Uppercase start
26                                 [a-z0-9]        # followed by lowercase
27                                 \w*             # and rest of word
28                         )
29                         {2,}                    # repeated twice
30                 )
31         }{[[$1]]}gx;
33         return $params{content};
34 } #}}}
36 1