diff options
author | Isaac Muse <faceless.shop@gmail.com> | 2018-02-22 06:46:35 -0700 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2018-02-22 08:46:35 -0500 |
commit | cab4b69e946ce82fcd5e97db962e1a706da05ff5 (patch) | |
tree | 3e6fc7234f568bcd3abed9cb10ddd11c0ca91f2c /markdown | |
parent | b0e993a23ab96562d9e0e86fcba715c9d8b9ffcf (diff) | |
download | markdown-cab4b69e946ce82fcd5e97db962e1a706da05ff5.tar.gz markdown-cab4b69e946ce82fcd5e97db962e1a706da05ff5.tar.bz2 markdown-cab4b69e946ce82fcd5e97db962e1a706da05ff5.zip |
Only strip spaces in tables (#644)
Strip only the space character and not things like nbsp in tables. Fixes #635.
Diffstat (limited to 'markdown')
-rw-r--r-- | markdown/extensions/tables.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py index a48660b..b8218b0 100644 --- a/markdown/extensions/tables.py +++ b/markdown/extensions/tables.py @@ -44,7 +44,7 @@ class TableProcessor(BlockProcessor): Keep border check and separator row do avoid repeating the work. """ is_table = False - rows = [row.strip() for row in block.split('\n')] + rows = [row.strip(' ') for row in block.split('\n')] if len(rows) > 1: header0 = rows[0] self.border = PIPE_NONE @@ -76,13 +76,13 @@ class TableProcessor(BlockProcessor): def run(self, parent, blocks): """ Parse a table block and build table. """ block = blocks.pop(0).split('\n') - header = block[0].strip() + header = block[0].strip(' ') rows = [] if len(block) < 3 else block[2:] # Get alignment of columns align = [] for c in self.separator: - c = c.strip() + c = c.strip(' ') if c.startswith(':') and c.endswith(':'): align.append('center') elif c.startswith(':'): @@ -102,7 +102,7 @@ class TableProcessor(BlockProcessor): self._build_empty_row(tbody, align) else: for row in rows: - self._build_row(row.strip(), tbody, align) + self._build_row(row.strip(' '), tbody, align) def _build_empty_row(self, parent, align): """Build an empty row.""" @@ -124,7 +124,7 @@ class TableProcessor(BlockProcessor): for i, a in enumerate(align): c = etree.SubElement(tr, tag) try: - c.text = cells[i].strip() + c.text = cells[i].strip(' ') except IndexError: # pragma: no cover c.text = "" if a: |