Problems with HTML tag attributes and Glossary / Dictionary Page / FAQ Module
Posted: Wed Aug 30, 2006 12:38 pm
Hi all,
I wish to use the "Activate all Terms on site?" option of the Glossary / Dictionary Page / FAQ Module. As I have a rather small site with only cacheable pages, the bad performance of the option is not an issue.
Unfortunately the current implementation of this option will try to add links in too many places of a page, most notably it will not ignore attribute values of HTML tags.
Consider if TERM is a defined term in the model and the page in question contains the following:
It is also possible to use TERM as an replacement (read more)...
In this case both instances of "TERM" will get linkified resulting in:
It is also possible to use TERM as an replacement (TERM?">read more)...
which is clearly not valid HTML.
I have tried with different regular expressions (involving negative prefixes and like), but none have worked properly until now.
I believe I can see a way out using preg_replace_callback, but before I go into this I want to hear if anybody else have seen this problem and (hopefully) solved it. Alternative modules could be an option too.
/tonny
I wish to use the "Activate all Terms on site?" option of the Glossary / Dictionary Page / FAQ Module. As I have a rather small site with only cacheable pages, the bad performance of the option is not an issue.
Unfortunately the current implementation of this option will try to add links in too many places of a page, most notably it will not ignore attribute values of HTML tags.
Consider if TERM is a defined term in the model and the page in question contains the following:
It is also possible to use TERM as an replacement (read more)...
In this case both instances of "TERM" will get linkified resulting in:
It is also possible to use TERM as an replacement (TERM?">read more)...
which is clearly not valid HTML.
I have tried with different regular expressions (involving negative prefixes and like), but none have worked properly until now.
I believe I can see a way out using preg_replace_callback, but before I go into this I want to hear if anybody else have seen this problem and (hopefully) solved it. Alternative modules could be an option too.
/tonny