more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
One way of doing it would be defining a hash whose keys are the keywords (the ones you want to provide links for) -- this will work with phrases too, BTW -- and whose values are URIs or URLs. Then just use s///g to do it (that's the quick n' dirty way).
But that's *oh so quick* and *oh so dirty*, it probably raises a lot of problems and only works on very simple kinds of words (e.g. if you have phrases in your keywords hash, you could really mess things up). UPDATE Implementing something like this site's linking mechanism wouldn't be so hard. just put delimiters around the words / phrases you want to link, and something like the above should work fairly well. E.g. [bob] would say 'put a link around "bob"' (what link, you could determine in a number of ways, but the hash idea seems to work well enough.) Just alter the above substitution line to:
Bonus: that takes care of phrases, too. (credit for this idea goes to whathisname Seems like there must be a module that does something like this (I'll go to CPAN and give you an update) Philosophy can be made out of anything. Or less -- Jerry A. Fodor In reply to Re: Auto linking to words in a text file
by arturo
|
|