aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2009-03-11 20:09:34 -0400
committerWaylan Limberg <waylan@gmail.com>2009-03-11 20:09:34 -0400
commit047d4d4aa84af470de41bb164c94ec90e7c725bb (patch)
treecbbc4194750c5eb0f0a9eb8155f0c79132997341
parent4cb8560d695efe81fa27d31c39e1d8ad5b904b6b (diff)
downloadmarkdown-047d4d4aa84af470de41bb164c94ec90e7c725bb.tar.gz
markdown-047d4d4aa84af470de41bb164c94ec90e7c725bb.tar.bz2
markdown-047d4d4aa84af470de41bb164c94ec90e7c725bb.zip
Added table elements to block elements so tables get prettified and updated tables extension test.
-rw-r--r--markdown/__init__.py3
-rw-r--r--tests/extensions-x-tables/tables.html124
2 files changed, 120 insertions, 7 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 4c5f993..31ab29c 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -69,7 +69,8 @@ DEFAULT_OUTPUT_FORMAT = 'xhtml1' # xhtml or html4 output
HTML_REMOVED_TEXT = "[HTML_REMOVED]" # text used instead of HTML in safe mode
BLOCK_LEVEL_ELEMENTS = re.compile("p|div|h[1-6]|blockquote|pre|table|dl|ol|ul"
"|script|noscript|form|fieldset|iframe|math"
- "|ins|del|hr|hr/|style|li|dt|dd|tr")
+ "|ins|del|hr|hr/|style|li|dt|dd|thead|tbody"
+ "|tr|th|td")
DOC_TAG = "div" # Element used to wrap document - later removed
# Placeholders
diff --git a/tests/extensions-x-tables/tables.html b/tests/extensions-x-tables/tables.html
index 0549bdf..c931e6a 100644
--- a/tests/extensions-x-tables/tables.html
+++ b/tests/extensions-x-tables/tables.html
@@ -1,7 +1,119 @@
<h2>Table Tests</h2>
-<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>
-<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>
-<table><thead><tr><th>Item</th><th align="right">Value</th></tr></thead><tbody><tr><td>Computer</td><td align="right">$1600</td></tr><tr><td>Phone</td><td align="right">$12</td></tr><tr><td>Pipe</td><td align="right">$1</td></tr></tbody></table>
-<table><thead><tr><th>Function name</th><th>Description</th></tr></thead><tbody><tr><td><code>help()</code></td><td>Display the help window.</td></tr><tr><td><code>destroy()</code></td><td><strong>Destroy your computer!</strong></td></tr></tbody></table>
-<table><thead><tr><th align="left">foo</th><th align="center">bar</th><th align="right">baz</th></tr></thead><tbody><tr><td align="left" /><td align="center">Q</td><td align="right" /></tr><tr><td align="left">W</td><td align="center" /><td align="right">W</td></tr></tbody></table>
-<table><thead><tr><th>foo</th><th>bar</th><th>baz</th></tr></thead><tbody><tr><td /><td>Q</td><td /></tr><tr><td>W</td><td /><td>W</td></tr></tbody></table> \ No newline at end of file
+<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>
+<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>
+<table>
+<thead>
+<tr>
+<th>Item</th>
+<th align="right">Value</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>Computer</td>
+<td align="right">$1600</td>
+</tr>
+<tr>
+<td>Phone</td>
+<td align="right">$12</td>
+</tr>
+<tr>
+<td>Pipe</td>
+<td align="right">$1</td>
+</tr>
+</tbody>
+</table>
+<table>
+<thead>
+<tr>
+<th>Function name</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>help()</code></td>
+<td>Display the help window.</td>
+</tr>
+<tr>
+<td><code>destroy()</code></td>
+<td><strong>Destroy your computer!</strong></td>
+</tr>
+</tbody>
+</table>
+<table>
+<thead>
+<tr>
+<th align="left">foo</th>
+<th align="center">bar</th>
+<th align="right">baz</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td align="left" />
+<td align="center">Q</td>
+<td align="right" />
+</tr>
+<tr>
+<td align="left">W</td>
+<td align="center" />
+<td align="right">W</td>
+</tr>
+</tbody>
+</table>
+<table>
+<thead>
+<tr>
+<th>foo</th>
+<th>bar</th>
+<th>baz</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td />
+<td>Q</td>
+<td />
+</tr>
+<tr>
+<td>W</td>
+<td />
+<td>W</td>
+</tr>
+</tbody>
+</table> \ No newline at end of file