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 => "linkify", id => "camelcase", call => \&linkify);
27 hook(type => "scan", id => "camelcase", call => \&scan);
30 sub linkify (@) { #{{{
32 my $page=$params{page};
33 my $destpage=$params{destpage};
35 $params{content}=~s{$link_regexp}{
36 htmllink($page, $destpage, IkiWiki::linkpage($1))
39 return $params{content};
44 my $page=$params{page};
45 my $content=$params{content};
47 while ($content =~ /$link_regexp/g) {
48 push @{$links{$page}}, IkiWiki::linkpage($1);