Old versions of Netscape will actually try and execute these
definitely-not-javascript hacks as Javascript. So let's try to
avoid that from happening by making the contents look like one
big Javascript comment.
We might need an additional workaround if any of the contents
contains a literal */. We'll cross that bridge when we get to it.
identifier :xhtml_compat
def run(content, params = {})
identifier :xhtml_compat
def run(content, params = {})
- return content.gsub(/([^[:space:]])\/>/m, '\1 />');
+ text = content.gsub(/([^[:space:]])\/>/m, '\1 />');
+ text.gsub!("<![CDATA[]]x><!--]]>", '/*\&')
+ text.gsub!("<![CDATA[-->]]>", '\&*/')
+ return text