git.iko.soy/typeable/pandoc
on master help sign in
Lua filters: make attr argument optional in Table constructor
44c4660Albert Krewinkel
data/pandoc.lua+3−3
@@ -556,18 +556,18 @@ M.RawBlock = M.Block:create_constructor(
556
556
557--- Creates a table element.
557--- Creates a table element.
558-- @function Table
558-- @function Table
559−-- @tparam Attr attr attributes
560-- @tparam Caption caption table caption
559-- @tparam Caption caption table caption
561-- @tparam {ColSpec,...} colspecs column alignments and widths
560-- @tparam {ColSpec,...} colspecs column alignments and widths
562-- @tparam TableHead head table head
561-- @tparam TableHead head table head
563-- @tparam {TableBody,..} bodies table bodies
562-- @tparam {TableBody,..} bodies table bodies
564-- @treturn TableFoot foot table foot
563-- @treturn TableFoot foot table foot
564+-- @tparam[opt] Attr attr attributes
565M.Table = M.Block:create_constructor(
565M.Table = M.Block:create_constructor(
566 "Table",
566 "Table",
567− function(attr, caption, colspecs, head, bodies, foot)
567+ function(caption, colspecs, head, bodies, foot, attr)
568 return {
568 return {
569 c = {
569 c = {
570− attr,
570+ ensureAttr(attr),
571 caption,
571 caption,
572 List:new(colspecs),
572 List:new(colspecs),
573 head,
573 head,
doc/lua-filters.md+15−6
@@ -1104,6 +1104,9 @@ Values of this type can be created with the
1104
1104
1105Fields:
1105Fields:
1106
1106
1107+`attr`
1108+: table attributes ([Attr])
1109+
1107`caption`
1110`caption`
1108: table caption ([Caption])
1111: table caption ([Caption])
1109
1112
@@ -1120,8 +1123,14 @@ Fields:
1120`foot`
1123`foot`
1121: table foot ([TableFoot])
1124: table foot ([TableFoot])
1122
1125
1123−`attr`
1126+`identifier`
1124−: element attributes ([Attr])
1127+: alias for `attr.identifier` (string)
1128+
1129+`classes`
1130+: alias for `attr.classes` ([List] of strings)
1131+
1132+`attributes`
1133+: alias for `attr.attributes` ([Attributes])
1125
1134
1126`tag`, `t`
1135`tag`, `t`
1127: the literal `Table` (string)
1136: the literal `Table` (string)
@@ -2144,15 +2153,12 @@ format, and functions to filter and modify a subtree.
2144
2153
2145 Returns: [RawBlock](#type-rawblock) object
2154 Returns: [RawBlock](#type-rawblock) object
2146
2155
2147−[`Table (attr, caption, colspecs, head, bodies, foot)`]{#pandoc.table}
2156+[`Table (caption, colspecs, head, bodies, foot[, attr])`]{#pandoc.table}
2148
2157
2149: Creates a table element.
2158: Creates a table element.
2150
2159
2151 Parameters:
2160 Parameters:
2152
2161
2153− `attr`:
2154− : element attributes
2155−
2156 `caption`:
2162 `caption`:
2157 : table [caption](#type-caption)
2163 : table [caption](#type-caption)
2158
2164
@@ -2168,6 +2174,9 @@ format, and functions to filter and modify a subtree.
2168 `foot`:
2174 `foot`:
2169 : [table foot](#type-tablefoot)
2175 : [table foot](#type-tablefoot)
2170
2176
2177+ `attr`:
2178+ : element attributes
2179+
2171 Returns: [Table](#type-table) object
2180 Returns: [Table](#type-table) object
2172
2181
2173## Inline
2182## Inline
src/Text/Pandoc/Lua/Marshaling/AST.hs+1−1
@@ -170,7 +170,7 @@ pushBlock = \case
170 Plain blcks -> pushViaConstructor "Plain" blcks
170 Plain blcks -> pushViaConstructor "Plain" blcks
171 RawBlock f cs -> pushViaConstructor "RawBlock" f cs
171 RawBlock f cs -> pushViaConstructor "RawBlock" f cs
172 Table attr blkCapt specs thead tbody tfoot ->
172 Table attr blkCapt specs thead tbody tfoot ->
173− pushViaConstructor "Table" attr blkCapt specs thead tbody tfoot
173+ pushViaConstructor "Table" blkCapt specs thead tbody tfoot attr
174
174
175-- | Return the value at the given index as block if possible.
175-- | Return the value at the given index as block if possible.
176peekBlock :: StackIndex -> Lua Block
176peekBlock :: StackIndex -> Lua Block