From 1d8b4ee778575ba884a440eb7efbe0aaf206b2bb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 11 Nov 2009 16:23:11 +0000 Subject: [PATCH] Fixed pre tags containing ")|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }|\Z)/mi + OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi OFFTAG_OPEN = /<#{ OFFTAGS }/ OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/ HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 05742150b..f61f219ab 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -258,6 +258,28 @@ RAW to_test.each { |text, result| assert_equal result, textilizable(text) } end + def test_pre_tags + raw = <<-RAW +Before + +
+32
+
+ +After +RAW + + expected = <<-EXPECTED +

Before

+
+<prepared-statement-cache-size>32</prepared-statement-cache-size>
+
+

After

+EXPECTED + + assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') + end + def test_syntax_highlight raw = <<-RAW

-- 
2.39.5