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