summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/camelcase.pm
blob: 0bb35b6e26249294fb7d3aa57c38b17a59663e69 (plain)
  1. #!/usr/bin/perl
  2. # CamelCase links
  3. package IkiWiki::Plugin::camelcase;
  4. use IkiWiki;
  5. use warnings;
  6. use strict;
  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