summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/camelcase.pm
blob: 68d399d77698bb5be52ba48cd3ddaab21bb5b964 (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