1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-10-17 17:01:01 +00:00

Table renders wrong if a trailing space is after | symbol (#18223).

Patch by Jens Krämer.

git-svn-id: http://svn.redmine.org/redmine/trunk@14611 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2015-09-20 11:02:01 +00:00
parent 41011013be
commit 49604a3bae
2 changed files with 23 additions and 1 deletions

View File

@ -525,7 +525,7 @@ class RedCloth3 < String
tatts = pba( tatts, 'table' )
tatts = shelve( tatts ) if tatts
rows = []
fullrow.gsub!(/([^|])\n/, "\\1<br />")
fullrow.gsub!(/([^|\s])\s*\n/, "\\1<br />")
fullrow.each_line do |row|
ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
cells = []

View File

@ -249,6 +249,28 @@ EXPECTED
assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
end
def test_table_with_trailing_whitespace
raw = <<-RAW
This is a table with trailing whitespace in one row:
|cell11|cell12|
|cell21|cell22|
|cell31|cell32|
RAW
expected = <<-EXPECTED
<p>This is a table with trailing whitespace in one row:</p>
<table>
<tr><td>cell11</td><td>cell12</td></tr>
<tr><td>cell21</td><td>cell22</td></tr>
<tr><td>cell31</td><td>cell32</td></tr>
</table>
EXPECTED
assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
end
def test_table_with_line_breaks
raw = <<-RAW
This is a table with line breaks: