aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTuong Nguyen Manh <[email protected]>2025-09-06 18:20:32 +0200
committerJohn MacFarlane <[email protected]>2025-09-09 10:27:18 +0200
commit47e1cc46c67e937f7202d98de1d9bdd857f7b454 (patch)
tree0cec278c9f9339d94766576157da635e96f84035 /test
parentff12c20f20067c55f8f55bb66e710b1d8910ad3a (diff)
RST Reader: Add col spans for simple tables
[API change] Text.Pandoc.Parsing: New functions `tableWithSpans`, `tableWithSpans'`, `toTableComponentsWithSpans` and `toTableComponentsWithSpans'` take a list of lists of (Blocks, RowSpan, ColSpan) to parse a Table with different RowSpan and ColSpan values accordingly. New helper functions `singleRowSpans` and `singleColumnSpans` help set all RowSpans or ColSpans to be 1 in case the table format only allows setting one or the other.
Diffstat (limited to 'test')
-rw-r--r--test/command/10127.md372
1 files changed, 372 insertions, 0 deletions
diff --git a/test/command/10127.md b/test/command/10127.md
new file mode 100644
index 000000000..486ef6120
--- /dev/null
+++ b/test/command/10127.md
@@ -0,0 +1,372 @@
+```
+% pandoc -f rst -t native
+===== ===== ======
+ Inputs Output
+------------ ------
+ A B A or B
+===== ===== ======
+False False False
+True False True
+False True True
+True True True
+===== ===== ======
+
+Table with trailing whitespaces to ensure they don't interfere with col span parsing.
+
+=============== ============ =====================
+Full column header
+----------------------------------------------------
+Header One Header Two Header 3
+=============== ============ =====================
+Row With col span 2 on the right
+--------------- -----------------------------------
+Full column row
+----------------------------------------------------
+Row with Col spans For visual separation
+--------------- ------------ ---------------------
+Row with col span 1 On the left
+----------------------------- ---------------------
+Final row
+=============== ============ =====================
+^D
+[ Table
+ ( "" , [] , [] )
+ (Caption Nothing [])
+ [ ( AlignDefault , ColWidthDefault )
+ , ( AlignDefault , ColWidthDefault )
+ , ( AlignDefault , ColWidthDefault )
+ ]
+ (TableHead
+ ( "" , [] , [] )
+ [ Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 2)
+ [ Plain [ Str "Inputs" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "Output" ] ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "A" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "B" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "A" , Space , Str "or" , Space , Str "B" ]
+ ]
+ ]
+ ])
+ [ TableBody
+ ( "" , [] , [] )
+ (RowHeadColumns 0)
+ []
+ [ Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "False" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "False" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "False" ] ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "True" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "False" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "True" ] ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "False" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "True" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "True" ] ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "True" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "True" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "True" ] ]
+ ]
+ ]
+ ]
+ (TableFoot ( "" , [] , [] ) [])
+, Para
+ [ Str "Table"
+ , Space
+ , Str "with"
+ , Space
+ , Str "trailing"
+ , Space
+ , Str "whitespaces"
+ , Space
+ , Str "to"
+ , Space
+ , Str "ensure"
+ , Space
+ , Str "they"
+ , Space
+ , Str "don't"
+ , Space
+ , Str "interfere"
+ , Space
+ , Str "with"
+ , Space
+ , Str "col"
+ , Space
+ , Str "span"
+ , Space
+ , Str "parsing."
+ ]
+, Table
+ ( "" , [] , [] )
+ (Caption Nothing [])
+ [ ( AlignDefault , ColWidthDefault )
+ , ( AlignDefault , ColWidthDefault )
+ , ( AlignDefault , ColWidthDefault )
+ ]
+ (TableHead
+ ( "" , [] , [] )
+ [ Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 3)
+ [ Plain
+ [ Str "Full"
+ , Space
+ , Str "column"
+ , Space
+ , Str "header"
+ ]
+ ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "Header" , Space , Str "One" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "Header" , Space , Str "Two" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "Header" , Space , Str "3" ] ]
+ ]
+ ])
+ [ TableBody
+ ( "" , [] , [] )
+ (RowHeadColumns 0)
+ []
+ [ Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "Row" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 2)
+ [ Plain
+ [ Str "With"
+ , Space
+ , Str "col"
+ , Space
+ , Str "span"
+ , Space
+ , Str "2"
+ , Space
+ , Str "on"
+ , Space
+ , Str "the"
+ , Space
+ , Str "right"
+ ]
+ ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 3)
+ [ Plain
+ [ Str "Full"
+ , Space
+ , Str "column"
+ , Space
+ , Str "row"
+ ]
+ ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "Row" , Space , Str "with" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "Col" , Space , Str "spans" ] ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain
+ [ Str "For"
+ , Space
+ , Str "visual"
+ , Space
+ , Str "separation"
+ ]
+ ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 2)
+ [ Plain
+ [ Str "Row"
+ , Space
+ , Str "with"
+ , Space
+ , Str "col"
+ , Space
+ , Str "span"
+ , Space
+ , Str "1"
+ ]
+ ]
+ , Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain
+ [ Str "On"
+ , Space
+ , Str "the"
+ , Space
+ , Str "left"
+ ]
+ ]
+ ]
+ , Row
+ ( "" , [] , [] )
+ [ Cell
+ ( "" , [] , [] )
+ AlignDefault
+ (RowSpan 1)
+ (ColSpan 1)
+ [ Plain [ Str "Final" , Space , Str "row" ] ]
+ , Cell
+ ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+ , Cell
+ ( "" , [] , [] ) AlignDefault (RowSpan 1) (ColSpan 1) []
+ ]
+ ]
+ ]
+ (TableFoot ( "" , [] , [] ) [])
+]
+```