Parse markdown tables and show them with some styling

(imported from commit fb3c599b1dbaed2447f1e710ed7202486000ca2a)
This commit is contained in:
Leo Franchi
2013-10-10 16:05:12 -04:00
parent 1db703595e
commit 1f89bf386f
3 changed files with 61 additions and 0 deletions

View File

@@ -3254,6 +3254,40 @@ But you can never leave**"""
self.assertEqual(converted, '<p>We should fix <a href="https://trac.zulip.net/ticket/224" target="_blank" title="https://trac.zulip.net/ticket/224">#224</a> and <a href="https://trac.zulip.net/ticket/115" target="_blank" title="https://trac.zulip.net/ticket/115">#115</a>, but not issue#124 or #1124z or <a href="https://trac.zulip.net/ticket/16" target="_blank" title="https://trac.zulip.net/ticket/16">trac #15</a> today.</p>')
def test_tables(self):
msg = """This is a table:
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
"""
expected = """<p>This is a table:</p>
<table>
<thead>
<tr>
<th>First Header</th>
<th>Second Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content Cell</td>
<td>Content Cell</td>
</tr>
<tr>
<td>Content Cell</td>
<td>Content Cell</td>
</tr>
</tbody>
</table>"""
converted = bugdown_convert(msg)
print converted
self.assertEqual(converted, expected)
class UserPresenceTests(AuthedTestCase):
def common_init(self, email):