diff options
-rw-r--r-- | HISTORY.txt | 4 | ||||
-rw-r--r-- | docutils/parsers/rst/directives/tables.py | 2 | ||||
-rwxr-xr-x | test/test_parsers/test_rst/test_directives/test_tables.py | 14 |
3 files changed, 15 insertions, 5 deletions
diff --git a/HISTORY.txt b/HISTORY.txt index caf27367c..82dd9112c 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -35,6 +35,10 @@ Changes Since 0.10 - Apply [ 3599485 ] node source/line information for sphinx translation. +* docutils/parsers/rst/directives/tables.py + + - Fix [ 210 ] Python 3.3 checks CVS syntax only if "strict" is True. + * docutils/parsers/rst/states.py - Fix [ 157 ] Line block parsing doesn't like system message. diff --git a/docutils/parsers/rst/directives/tables.py b/docutils/parsers/rst/directives/tables.py index 0758f82e5..f17e76e6f 100644 --- a/docutils/parsers/rst/directives/tables.py +++ b/docutils/parsers/rst/directives/tables.py @@ -164,6 +164,7 @@ class CSVTable(Table): quotechar = '"' doublequote = True skipinitialspace = True + strict = True lineterminator = '\n' quoting = csv.QUOTE_MINIMAL @@ -189,6 +190,7 @@ class CSVTable(Table): escapechar = '\\' doublequote = False skipinitialspace = True + strict = True lineterminator = '\n' quoting = csv.QUOTE_MINIMAL diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index 924cf7793..e0b378554 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -10,7 +10,7 @@ Tests for tables.py directives. from __init__ import DocutilsTestSupport -import os +import os, sys import csv from docutils.parsers.rst.directives import tables @@ -32,6 +32,10 @@ if isinstance(unichr_exception, OverflowError): else: unichr_exception_string = str(unichr_exception) +csv_eod_error_str = "unexpected end of data" +if sys.version_info < (3,3): + csv_eod_error_str = "newline inside string" + def null_bytes(): import csv csv_data = open(utf_16_csv, 'rb').read() @@ -760,12 +764,12 @@ u"""\ <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error with CSV data in "csv-table" directive: - newline inside string + %s <literal_block xml:space="preserve"> .. csv-table:: bad CSV data \n\ "bad", \"csv, data -"""], +""" % csv_eod_error_str], ["""\ .. csv-table:: bad CSV header data :header: "bad", \"csv, data @@ -777,13 +781,13 @@ u"""\ <system_message level="3" line="1" source="test data" type="ERROR"> <paragraph> Error with CSV data in "csv-table" directive: - newline inside string + %s <literal_block xml:space="preserve"> .. csv-table:: bad CSV header data :header: "bad", \"csv, data \n\ good, csv, data -"""], +""" % csv_eod_error_str], ["""\ .. csv-table:: bad encoding :file: %s |