##// END OF EJS Templates
Fixed: Wiki headings containing backslash followed by a digit are not displayed correctly (#7846)....
Jean-Philippe Lang -
r4980:7db930f1b44b
parent child
Show More
@@ -707,11 +707,13 class RedCloth3 < String
707 707 atts = pba( atts )
708 708
709 709 # pass to prefix handler
710 replacement = nil
710 711 if respond_to? "textile_#{ tag }", true
711 text.gsub!( $&, method( "textile_#{ tag }" ).call( tag, atts, cite, content ) )
712 replacement = method( "textile_#{ tag }" ).call( tag, atts, cite, content )
712 713 elsif respond_to? "textile_#{ tagpre }_", true
713 text.gsub!( $&, method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content ) )
714 replacement = method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content )
714 715 end
716 text.gsub!( $& ) { replacement } if replacement
715 717 end
716 718 end
717 719
@@ -64,12 +64,18 class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
64 64 '@<Location /redmine>@' => '<code>&lt;Location /redmine&gt;</code>'
65 65 )
66 66 end
67
67
68 68 def test_escaping
69 69 assert_html_output(
70 70 'this is a <script>' => 'this is a &lt;script&gt;'
71 71 )
72 72 end
73
74 def test_use_of_backslashes_followed_by_numbers_in_headers
75 assert_html_output({
76 'h1. 2009\02\09' => '<h1>2009\02\09</h1>'
77 }, false)
78 end
73 79
74 80 def test_double_dashes_should_not_strikethrough
75 81 assert_html_output(
@@ -88,9 +94,9 class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
88 94
89 95 private
90 96
91 def assert_html_output(to_test)
97 def assert_html_output(to_test, expect_paragraph = true)
92 98 to_test.each do |text, expected|
93 assert_equal "<p>#{expected}</p>", @formatter.new(text).to_html, "Formatting the following text failed:\n===\n#{text}\n===\n"
99 assert_equal(( expect_paragraph ? "<p>#{expected}</p>" : expected ), @formatter.new(text).to_html, "Formatting the following text failed:\n===\n#{text}\n===\n")
94 100 end
95 101 end
96 102 end
General Comments 0
You need to be logged in to leave comments. Login now