aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ftplugin/rst_tables.vim2
-rw-r--r--src/rst_tables.py2
-rw-r--r--tests/test_rst_tables.py5
-rw-r--r--tutorial.rst1
4 files changed, 8 insertions, 2 deletions
diff --git a/ftplugin/rst_tables.vim b/ftplugin/rst_tables.vim
index d786f7c..0722816 100644
--- a/ftplugin/rst_tables.vim
+++ b/ftplugin/rst_tables.vim
@@ -52,7 +52,7 @@ def unify_table(table):
def parse_table(raw_lines):
- mkfields = lambda line: re.split('\s\s+', line)
+ mkfields = lambda line: re.split('\s\s+', line.rstrip())
output = map(mkfields, raw_lines)
output = unify_table(output)
return output
diff --git a/src/rst_tables.py b/src/rst_tables.py
index 3368a6f..e1e3842 100644
--- a/src/rst_tables.py
+++ b/src/rst_tables.py
@@ -37,7 +37,7 @@ def unify_table(table):
def parse_table(raw_lines):
- mkfields = lambda line: re.split('\s\s+', line)
+ mkfields = lambda line: re.split('\s\s+', line.rstrip())
output = map(mkfields, raw_lines)
output = unify_table(output)
return output
diff --git a/tests/test_rst_tables.py b/tests/test_rst_tables.py
index d44c234..b3df5ad 100644
--- a/tests/test_rst_tables.py
+++ b/tests/test_rst_tables.py
@@ -77,6 +77,11 @@ a line ending.
expected = [['x', 'y', ''], ['a', 'b', 'c'], ['only one', '', '']]
self.assertEquals(expected, parse_table(input))
+ def testParseDealsWithSpacesAtLineEnd(self):
+ input = ['x y ', 'a b ', 'only one']
+ expected = [['x', 'y'], ['a', 'b'], ['only one', '']]
+ self.assertEquals(expected, parse_table(input))
+
def testTableLine(self):
self.assertEquals('', table_line([], True))
self.assertEquals('++', table_line([0], True))
diff --git a/tutorial.rst b/tutorial.rst
index a7fe4a2..02516b2 100644
--- a/tutorial.rst
+++ b/tutorial.rst
@@ -6,6 +6,7 @@ Feature Description
Easy It's soo easy, man.
Predictable Amount of spaces doesn't matter.
Repeatable It can be repeated.
+Flexible Even spaces at the end of a line are fine.
Then, the paragraph should turn into: