From 67bed52cb3762c2966f5a611d52564a91659723e Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 5 Oct 2022 10:37:17 +0200 Subject: [PATCH 1/2] add failing test for indentation with javascript tag --- spec/behavior_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/behavior_spec.rb b/spec/behavior_spec.rb index 7d260a9..e13809a 100644 --- a/spec/behavior_spec.rb +++ b/spec/behavior_spec.rb @@ -65,6 +65,26 @@ expect(described_class.beautify(source)).to eq(expected) end + it "indents within " expected = "" From 05b1ad50ffadb786357d657026c66b2f05db8039 Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 5 Oct 2022 10:43:27 +0200 Subject: [PATCH 2/2] fix the test --- lib/htmlbeautifier/html_parser.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/htmlbeautifier/html_parser.rb b/lib/htmlbeautifier/html_parser.rb index e2bef09..88b91cd 100644 --- a/lib/htmlbeautifier/html_parser.rb +++ b/lib/htmlbeautifier/html_parser.rb @@ -18,6 +18,8 @@ class HtmlParser < Parser )}mix MAPPINGS = [ + [%r{(<%-?=\s*javascript_tag.+-?%>)(.*?)(<%-?=?\s*end\s*-?%>)}om, + :foreign_block], [%r{(<%-?=?)(.*?)(-?%>)}om, :embed], [%r{