@@ -525,11 +525,12 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 |
|
528 | fullrow.gsub!(/([^|])\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 = [] | |
532 | row.split( /(\|)(?![^\[\|]*\]\])/ )[1..-2].each do |cell| |
|
532 | row.split( /(\|)(?![^\[\|]*\]\])/ )[1..-2].each do |cell| | |
|
533 | Rails.logger.debug "cell: #{cell}" | |||
533 | next if cell == '|' |
|
534 | next if cell == '|' | |
534 | ctyp = 'd' |
|
535 | ctyp = 'd' | |
535 | ctyp = 'h' if cell =~ /^_/ |
|
536 | ctyp = 'h' if cell =~ /^_/ |
@@ -268,6 +268,42 EXPECTED | |||||
268 | assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') |
|
268 | assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') | |
269 | end |
|
269 | end | |
270 |
|
270 | |||
|
271 | def test_tables_with_lists | |||
|
272 | raw = <<-RAW | |||
|
273 | This is a table with lists: | |||
|
274 | ||||
|
275 | |cell11|cell12| | |||
|
276 | |cell21|ordered list | |||
|
277 | # item | |||
|
278 | # item 2| | |||
|
279 | |cell31|unordered list | |||
|
280 | * item | |||
|
281 | * item 2| | |||
|
282 | ||||
|
283 | RAW | |||
|
284 | ||||
|
285 | expected = <<-EXPECTED | |||
|
286 | <p>This is a table with lists:</p> | |||
|
287 | ||||
|
288 | <table> | |||
|
289 | <tr> | |||
|
290 | <td>cell11</td> | |||
|
291 | <td>cell12</td> | |||
|
292 | </tr> | |||
|
293 | <tr> | |||
|
294 | <td>cell21</td> | |||
|
295 | <td>ordered list<br /># item<br /># item 2</td> | |||
|
296 | </tr> | |||
|
297 | <tr> | |||
|
298 | <td>cell31</td> | |||
|
299 | <td>unordered list<br />* item<br />* item 2</td> | |||
|
300 | </tr> | |||
|
301 | </table> | |||
|
302 | EXPECTED | |||
|
303 | ||||
|
304 | assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') | |||
|
305 | end | |||
|
306 | ||||
271 | def test_textile_should_not_mangle_brackets |
|
307 | def test_textile_should_not_mangle_brackets | |
272 | assert_equal '<p>[msg1][msg2]</p>', to_html('[msg1][msg2]') |
|
308 | assert_equal '<p>[msg1][msg2]</p>', to_html('[msg1][msg2]') | |
273 | end |
|
309 | end |
General Comments 0
You need to be logged in to leave comments.
Login now