diff options
author | pieterprovoost <pieterprovoost@gmail.com> | 2015-04-05 01:18:51 +0200 |
---|---|---|
committer | pieterprovoost <pieterprovoost@gmail.com> | 2015-04-05 03:04:15 +0200 |
commit | 47737e4a515e63e21bbfd2d2b35404fe44432890 (patch) | |
tree | 1ad84667f31562b0e1ed04c13440329b1cf65fd3 | |
parent | cf7234dea91637de77179bf6e00c66e15c06f070 (diff) | |
download | markdown-47737e4a515e63e21bbfd2d2b35404fe44432890.tar.gz markdown-47737e4a515e63e21bbfd2d2b35404fe44432890.tar.bz2 markdown-47737e4a515e63e21bbfd2d2b35404fe44432890.zip |
added support for zero row tables
-rw-r--r-- | markdown/extensions/tables.py | 4 | ||||
-rw-r--r-- | tests/extensions/extra/tables.txt | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py index cbf711a..368321d 100644 --- a/markdown/extensions/tables.py +++ b/markdown/extensions/tables.py @@ -27,7 +27,7 @@ class TableProcessor(BlockProcessor): def test(self, parent, block): rows = block.split('\n') - return (len(rows) > 2 and '|' in rows[0] and + return (len(rows) > 1 and '|' in rows[0] and '|' in rows[1] and '-' in rows[1] and rows[1].strip()[0] in ['|', ':', '-']) @@ -36,7 +36,7 @@ class TableProcessor(BlockProcessor): block = blocks.pop(0).split('\n') header = block[0].strip() seperator = block[1].strip() - rows = block[2:] + rows = [] if len(block) < 3 else block[2:] # Get format type (bordered by pipes or not) border = False if header.startswith('|'): diff --git a/tests/extensions/extra/tables.txt b/tests/extensions/extra/tables.txt index cf97cb5..3b95511 100644 --- a/tests/extensions/extra/tables.txt +++ b/tests/extensions/extra/tables.txt @@ -50,3 +50,6 @@ Four spaces is a code block: ------------ | ------------- Content Cell | Content Cell Content Cell | Content Cell + +| First Header | Second Header | +| ------------ | ------------- | |