punkish has asked for the wisdom of the Perl Monks concerning the following question:
Not only my CamelCase words are becoming links (as they should), UPPERCASE words are also becoming links (as they should not). How can I prevent that from happening?
I want to implement some additional formatting that this module does not do... for example, I want to highlight any passed searchterm using a simple
s/\b($searchterm)\b/<span class="hilite">$1<\/span>/gi
At this time I am first Text::WikiFormat-ting and then running it through my own post formatting. Is there any way I can add my own method to the module so I don't have to do the pass through the text twice? The docs (and the source) seem to suggest I can, but I have been unable to take this into the "implemented and works" territory.
(besides the above highlight formatting, I have a few other additional things that I am doing similarly that T::W doesn't provide, but would be nice if I can add the functionality to it)
Update: making the following change in the regexp in the source of T::W does the trick for disabling UPPERCASE links, however, I am wondering if there is any way to "override" (is that the correct phrase I am seeking here?) the existing functionality without actually modifying the code?
#$text =~ s|(?<!["/>=])\b([A-Za-z]+(?:[A-Z]\w+)+)| # $tags->{link}->($1, $opts)|egx # if !defined $opts->{implicit_links} or $opts->{implicit_links}; $text =~ s|(?<!["/>=])\b([A-Z][a-z0-9]+([A-Z][a-z0-9]*)+)| $tags->{link}->($1, $opts)|egx if !defined $opts->{implicit_links} or $opts->{implicit_links};
|
|---|