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{