From 5aa756ee68dc2134b6acac8a66af2f1c14521721 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Tue, 16 Feb 2021 23:01:02 -0500 Subject: [PATCH] Improve script hack compatibility. 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. --- lib/xhtml-compat.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/xhtml-compat.rb b/lib/xhtml-compat.rb index f69c1ee..25fe2e2 100644 --- a/lib/xhtml-compat.rb +++ b/lib/xhtml-compat.rb @@ -20,6 +20,9 @@ class XhtmlCompatFilter < Nanoc::Filter identifier :xhtml_compat def run(content, params = {}) - return content.gsub(/([^[:space:]])\/>/m, '\1 />'); + text = content.gsub(/([^[:space:]])\/>/m, '\1 />'); + text.gsub!("]]>", '\&*/') + return text end end -- 2.43.2