summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/camelcase.pm
blob: 0934b27c27826e369a8a033c09ba891cefac0df5 (plain)
  1. #!/usr/bin/perl
  2. # CamelCase links
  3. package IkiWiki::Plugin::camelcase;
  4. use warnings;
  5. use strict;
  6. sub import { #{{{
  7. IkiWiki::hook(type => "filter", id => "camelcase", call => \&filter);
  8. } # }}}
  9. sub filter (@) { #{{{
  10. my %params=@_;
  11. # Make CamelCase links work by promoting them to fullfledged
  12. # WikiLinks. This regexp is based on the one in Text::WikiFormat.
  13. $params{content}=~s#(?<![["/>=])\b((?:[A-Z][a-z0-9]\w*){2,})#[[$1]]#g;
  14. return $params{content};
  15. } #}}}
  16. 1