aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-12-19 09:17:54 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2021-12-19 09:44:56 +0100
commita0af1b5926e45c830f734883b909e733fd3c01cb (patch)
treec11d8c77ae6da0b1472cd978fc6cb3a081e1e930
parent4b220d592c163efb0bf5a0e1db2ed7d6be9c69e7 (diff)
downloadpandoc-a0af1b5926e45c830f734883b909e733fd3c01cb.tar.gz
Lua: change representation of TableHead, TableFoot, and Row values.
The objects now also follow the principle that element attributes are accessible through the `.attr` field. Rows in `TableHead` and `TableFoot` are available via the `.rows` field. Row objects have a `.cells` field, containing the list of table cells. Closes: #7718
-rw-r--r--cabal.project2
-rw-r--r--doc/lua-filters.md93
-rw-r--r--stack.yaml2
3 files changed, 80 insertions, 17 deletions
diff --git a/cabal.project b/cabal.project
index 091031930..bc617093c 100644
--- a/cabal.project
+++ b/cabal.project
@@ -6,7 +6,7 @@ constraints: aeson >= 2.0.1.0
source-repository-package
type: git
location: https://github.com/pandoc/pandoc-lua-marshal
- tag: 98e3de5087bb533fadbb89720f83f7f7cc3be5bf
+ tag: 45e53d9dce37d20f8e30e0d297a43c5b4c4a6831
source-repository-package
type: git
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 93595a814..616c13cea 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -1876,8 +1876,6 @@ List attributes
Values of this type can be created with the
[`pandoc.ListAttributes`](#pandoc.listattributes) constructor.
-Object equality is determined via [`pandoc.utils.equals`].
-
Fields:
`start`
@@ -1896,10 +1894,13 @@ Fields:
A table row.
-Tuple fields:
+Fields:
-1. row attributes
-2. row cells (list of [Cells])
+`attr`
+: element attributes ([Attr][])
+
+`cells`
+: list of table cells ([List][] of [Cell][]s)
### TableBody {#type-tablebody}
@@ -1909,35 +1910,59 @@ number of row header columns.
Fields:
`attr`
-: table body attributes ([Attr])
+: table body attributes ([Attr][])
`body`
-: table body rows (list of [Rows])
+: table body rows ([List][] of [Row][]s)
`head`
-: intermediate head (list of [Rows])
+: intermediate head ([List][] of [Row][]s)
`row_head_columns`
: number of columns taken up by the row head of each row of a
- [TableBody]. The row body takes up the remaining columns.
+ [TableBody][]. The row body takes up the remaining columns.
### TableFoot {#type-tablefoot}
The foot of a table.
-This is a pair with the following components:
+Fields:
-1. attributes
-2. foot rows ([Rows])
+`attr`
+: element attributes ([Attr][])
+
+`rows`
+: list of rows ([List][] of [Row][]s)
+
+`identifier`
+: alias for `attr.identifier` (string)
+
+`classes`
+: alias for `attr.classes` ([List][] of strings)
+
+`attributes`
+: alias for `attr.attributes` ([Attributes][])
### TableHead {#type-tablehead}
The head of a table.
-This is a pair with the following components:
+Fields:
+
+`attr`
+: element attributes ([Attr][])
+
+`rows`
+: list of rows ([List][] of [Row][]s)
+
+`identifier`
+: alias for `attr.identifier` (string)
+
+`classes`
+: alias for `attr.classes` ([List][] of strings)
-1. attributes
-2. head rows ([Rows])
+`attributes`
+: alias for `attr.attributes` ([Attributes][])
## ReaderOptions {#type-readeroptions}
@@ -2120,6 +2145,7 @@ Usage:
[Block]: #type-block
[Blocks]: #type-block
[Caption]: #type-caption
+[Cell]: #type-cell
[Cells]: #type-cell
[Citation]: #type-citation
[Citations]: #type-citation
@@ -2138,6 +2164,7 @@ Usage:
[Pandoc]: #type-pandoc
[Para]: #type-para
[Plain]: #type-plain
+[Row]: #type-row
[Rows]: #type-row
[SimpleTable]: #type-simpletable
[Table]: #type-table
@@ -2901,6 +2928,42 @@ format, and functions to filter and modify a subtree.
Returns: [ListAttributes](#type-listattributes) object
+[`Row ([cells[, attr]])`]{#pandoc.row}
+
+: Creates a table row.
+
+ Parameters:
+
+ `cells`:
+ : list of table cells in this row
+
+ `attr`:
+ : row attributes
+
+[`TableFoot ([rows[, attr]])`]{#pandoc.tablefoot}
+
+: Creates a table foot.
+
+ Parameters:
+
+ `rows`:
+ : list of table rows
+
+ `attr`:
+ : table foot attributes
+
+[`TableHead ([rows[, attr]])`]{#pandoc.tablehead}
+
+: Creates a table head.
+
+ Parameters:
+
+ `rows`:
+ : list of table rows
+
+ `attr`:
+ : table head attributes
+
## Legacy types
[`SimpleTable (caption, aligns, widths, headers, rows)`]{#pandoc.simpletable}
diff --git a/stack.yaml b/stack.yaml
index 14e81063c..a76508782 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -38,7 +38,7 @@ extra-deps:
- git: https://github.com/jgm/ipynb.git
commit: 00246af10885c2ad4413ace4f69a7e6c88297a08
- git: https://github.com/pandoc/pandoc-lua-marshal
- commit: 98e3de5087bb533fadbb89720f83f7f7cc3be5bf
+ commit: 45e53d9dce37d20f8e30e0d297a43c5b4c4a6831
ghc-options:
"$locals": -fhide-source-paths -Wno-missing-home-modules
resolver: lts-18.10