diff options
author | Waylan Limberg <waylan@gmail.com> | 2009-03-09 22:41:04 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2009-03-09 22:41:04 -0400 |
commit | e21d8465ce79d998bc90b6670ea3c1070175ec73 (patch) | |
tree | 53516f7dd17d2891482cf3bf6d9077e241bb730a | |
parent | f05183566eb57e1828926d7dcc89356fb8237df3 (diff) | |
download | markdown-e21d8465ce79d998bc90b6670ea3c1070175ec73.tar.gz markdown-e21d8465ce79d998bc90b6670ea3c1070175ec73.tar.bz2 markdown-e21d8465ce79d998bc90b6670ea3c1070175ec73.zip |
Fixed bug in tables extension (ticket 24). This extension could still use a major refactor, but it at least works as documented.
-rw-r--r-- | markdown/extensions/tables.py | 3 | ||||
-rw-r--r-- | tests/extensions-x-tables/tables.html | 2 | ||||
-rw-r--r-- | tests/extensions-x-tables/tables.txt | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py index 8eaa2d3..8ee1ce2 100644 --- a/markdown/extensions/tables.py +++ b/markdown/extensions/tables.py @@ -49,10 +49,9 @@ class TableTreeprocessor(markdown.treeprocessors.Treeprocessor): return result def run(self, root): - for element in self._findElement(root, "p"): for child in element: - if child.tail: + if child.tag in ['tr', 'th', 'td']: element.tag = "table" break diff --git a/tests/extensions-x-tables/tables.html b/tests/extensions-x-tables/tables.html index 55042dd..3377315 100644 --- a/tests/extensions-x-tables/tables.html +++ b/tests/extensions-x-tables/tables.html @@ -3,7 +3,7 @@ <tr><td> a </td><th> b </th></tr> <tr><td> <a href="#link">c</a> </td><td> <em>d</em> </td></tr> </table> -<p>Another</p> +<p><em>Another</em> <em>some inline markup</em></p> <table> <tr><td> a </td><td> b </td></tr> <tr><td> <em>a</em> </td><td> b </td></tr> diff --git a/tests/extensions-x-tables/tables.txt b/tests/extensions-x-tables/tables.txt index 70b4d36..60b34bd 100644 --- a/tests/extensions-x-tables/tables.txt +++ b/tests/extensions-x-tables/tables.txt @@ -3,7 +3,7 @@ Before | a |* b *| | [c](#link) | *d* | -Another +*Another* *some inline markup* | a | b | | _a_ | b | |