##// END OF EJS Templates
Table renders wrong if a trailing space is after | symbol (#18223)....
Jean-Philippe Lang -
r14229:49604a3bae39
parent child
Show More
@@ -525,7 +525,7 class RedCloth3 < String
525 tatts = pba( tatts, 'table' )
525 tatts = pba( tatts, 'table' )
526 tatts = shelve( tatts ) if tatts
526 tatts = shelve( tatts ) if tatts
527 rows = []
527 rows = []
528 fullrow.gsub!(/([^|])\n/, "\\1<br />")
528 fullrow.gsub!(/([^|\s])\s*\n/, "\\1<br />")
529 fullrow.each_line do |row|
529 fullrow.each_line do |row|
530 ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
530 ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
531 cells = []
531 cells = []
@@ -249,6 +249,28 EXPECTED
249 assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
249 assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
250 end
250 end
251
251
252 def test_table_with_trailing_whitespace
253 raw = <<-RAW
254 This is a table with trailing whitespace in one row:
255
256 |cell11|cell12|
257 |cell21|cell22|
258 |cell31|cell32|
259 RAW
260
261 expected = <<-EXPECTED
262 <p>This is a table with trailing whitespace in one row:</p>
263
264 <table>
265 <tr><td>cell11</td><td>cell12</td></tr>
266 <tr><td>cell21</td><td>cell22</td></tr>
267 <tr><td>cell31</td><td>cell32</td></tr>
268 </table>
269 EXPECTED
270
271 assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
272 end
273
252 def test_table_with_line_breaks
274 def test_table_with_line_breaks
253 raw = <<-RAW
275 raw = <<-RAW
254 This is a table with line breaks:
276 This is a table with line breaks:
General Comments 0
You need to be logged in to leave comments. Login now