3 package IkiWiki::Plugin::camelcase;
9 # This regexp is based on the one in Text::WikiFormat.
11 (?<![^A-Za-z0-9\s]) # try to avoid expanding non-links with a
12 # zero width negative lookbehind for
13 # characters that suggest it's not a link
17 [A-Z] # Uppercase start
18 [a-z0-9] # followed by lowercase
19 \w* # and rest of word
26 hook(type => "getsetup", id => "camelcase", call => \&getsetup);
27 hook(type => "linkify", id => "camelcase", call => \&linkify);
28 hook(type => "scan", id => "camelcase", call => \&scan);
31 sub getsetup () { #{{{
39 sub linkify (@) { #{{{
41 my $page=$params{page};
42 my $destpage=$params{destpage};
44 $params{content}=~s{$link_regexp}{
45 htmllink($page, $destpage, linkpage($1))
48 return $params{content};
53 my $page=$params{page};
54 my $content=$params{content};
56 while ($content =~ /$link_regexp/g) {
57 push @{$links{$page}}, linkpage($1);