aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-01-21 09:50:39 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-01-21 09:52:24 -0800
commitaf849537819885694cc4487056721480ab21067d (patch)
tree0a1ed38c3413ed71c9218759e4bb89c2969acf22 /tests
parentc4b93bc3e7ea2006dbe3273ed06b66129775982e (diff)
downloadpandoc-af849537819885694cc4487056721480ab21067d.tar.gz
Markdown reader: Fixed bug with headerless grid tables.
The 1.10 code assumed that each table header cell contains exactly one block. That failed for headerless tables (0) and also for tables with multiple blocks in a header cell. The code is fixed and tests provided. Thanks to Andrew Lee for pointing out the bug.
Diffstat (limited to 'tests')
-rw-r--r--tests/markdown-reader-more.native53
-rw-r--r--tests/markdown-reader-more.txt39
2 files changed, 91 insertions, 1 deletions
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index e76b12918..382aa056c 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -67,4 +67,55 @@
,Header 2 ("foobar",["baz"],[("key","val")]) [Str "Explicit",Space,Str "header",Space,Str "attributes"]
,Header 2 ("line-blocks",[],[]) [Str "Line",Space,Str "blocks"]
,Para [Str "But",Space,Str "can",Space,Str "a",Space,Str "bee",Space,Str "be",Space,Str "said",Space,Str "to",Space,Str "be",LineBreak,Str "\160\160\160\160or",Space,Str "not",Space,Str "to",Space,Str "be",Space,Str "an",Space,Str "entire",Space,Str "bee,",LineBreak,Str "\160\160\160\160\160\160\160\160when",Space,Str "half",Space,Str "the",Space,Str "bee",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "bee,",LineBreak,Str "\160\160\160\160\160\160\160\160\160\160\160\160due",Space,Str "to",Space,Str "some",Space,Str "ancient",Space,Str "injury?"]
-,Para [Str "Continuation",Space,Str "line",LineBreak,Str "\160\160and",Space,Str "another"]]
+,Para [Str "Continuation",Space,Str "line",LineBreak,Str "\160\160and",Space,Str "another"]
+,Header 2 ("grid-tables",[],[]) [Str "Grid",Space,Str "Tables"]
+,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.2638888888888889,0.16666666666666666,0.18055555555555555]
+ [[Plain [Str "col",Space,Str "1"]]
+ ,[Plain [Str "col",Space,Str "2"]]
+ ,[Plain [Str "col",Space,Str "3"]]]
+ [[[Para [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
+ ,[Para [Str "b",Space,Str "b",Space,Str "2"]]
+ ,[Para [Str "c",Space,Str "c",Space,Str "2"]]]
+ ,[[Para [Str "r2",Space,Str "d"]]
+ ,[Para [Str "e"]]
+ ,[Para [Str "f"]]]]
+,Para [Str "Headless"]
+,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.2638888888888889,0.16666666666666666,0.18055555555555555]
+ [[]
+ ,[]
+ ,[]]
+ [[[Para [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
+ ,[Para [Str "b",Space,Str "b",Space,Str "2"]]
+ ,[Para [Str "c",Space,Str "c",Space,Str "2"]]]
+ ,[[Para [Str "r2",Space,Str "d"]]
+ ,[Para [Str "e"]]
+ ,[Para [Str "f"]]]]
+,Para [Str "Spaces",Space,Str "at",Space,Str "ends",Space,Str "of",Space,Str "lines"]
+,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.2638888888888889,0.16666666666666666,0.18055555555555555]
+ [[]
+ ,[]
+ ,[]]
+ [[[Para [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"]]
+ ,[Para [Str "b",Space,Str "b",Space,Str "2"]]
+ ,[Para [Str "c",Space,Str "c",Space,Str "2"]]]
+ ,[[Para [Str "r2",Space,Str "d"]]
+ ,[Para [Str "e"]]
+ ,[Para [Str "f"]]]]
+,Para [Str "Multiple",Space,Str "blocks",Space,Str "in",Space,Str "a",Space,Str "cell"]
+,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.2638888888888889,0.16666666666666666,0.18055555555555555]
+ [[]
+ ,[]
+ ,[]]
+ [[[Header 1 ("col-1",[],[]) [Str "col",Space,Str "1"]
+ ,Para [Str "col",Space,Str "1"]]
+ ,[Header 1 ("col-2",[],[]) [Str "col",Space,Str "2"]
+ ,Para [Str "col",Space,Str "2"]]
+ ,[Header 1 ("col-3",[],[]) [Str "col",Space,Str "3"]
+ ,Para [Str "col",Space,Str "3"]]]
+ ,[[Para [Str "r1",Space,Str "a"]
+ ,Para [Str "r1",Space,Str "bis"]]
+ ,[BulletList
+ [[Plain [Str "b"]]
+ ,[Plain [Str "b",Space,Str "2"]]
+ ,[Plain [Str "b",Space,Str "2"]]]]
+ ,[Para [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]]
diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt
index b8ff74f26..b76b6d985 100644
--- a/tests/markdown-reader-more.txt
+++ b/tests/markdown-reader-more.txt
@@ -162,3 +162,42 @@ But this is not a link to [My other header], since the reference is defined.
| and
another
+## Grid Tables
+
++------------------+-----------+------------+
+| col 1 | col 2 | col 3 |
++==================+===========+============+
+| r1 a | b | c |
+| r1 bis | b 2 | c 2 |
++------------------+-----------+------------+
+| r2 d | e | f |
++------------------+-----------+------------+
+
+Headless
+
++------------------+-----------+------------+
+| r1 a | b | c |
+| r1 bis | b 2 | c 2 |
++------------------+-----------+------------+
+| r2 d | e | f |
++------------------+-----------+------------+
+
+Spaces at ends of lines
+
++------------------+-----------+------------+
+| r1 a | b | c |
+| r1 bis | b 2 | c 2 |
++------------------+-----------+------------+
+| r2 d | e | f |
++------------------+-----------+------------+
+
+Multiple blocks in a cell
+
++------------------+-----------+------------+
+| # col 1 | # col 2 | # col 3 |
+| col 1 | col 2 | col 3 |
++------------------+-----------+------------+
+| r1 a | - b | c |
+| | - b 2 | c 2 |
+| r1 bis | - b 2 | c 2 |
++------------------+-----------+------------+