@@ -1154,6 +1154,7 @@ protected function doTables($text) {
1154
1154
[|] .* \n # Row content.
1155
1155
)*
1156
1156
)
1157
+ ( ' .$ this ->id_class_attr_catch_re .')? # $4 = id/class attributes
1157
1158
(?=\n|\Z) # Stop at final double newline.
1158
1159
}xm ' ,
1159
1160
array ($ this , '_doTable_leadingPipe_callback ' ), $ text );
@@ -1178,6 +1179,7 @@ protected function doTables($text) {
1178
1179
.* [|] .* \n # Row content
1179
1180
)*
1180
1181
)
1182
+ ( ' .$ this ->id_class_attr_catch_re .')? # $4 = id/class attributes
1181
1183
(?=\n|\Z) # Stop at final double newline.
1182
1184
}xm ' ,
1183
1185
array ($ this , '_DoTable_callback ' ), $ text );
@@ -1194,10 +1196,11 @@ protected function _doTable_leadingPipe_callback($matches) {
1194
1196
$ head = $ matches [1 ];
1195
1197
$ underline = $ matches [2 ];
1196
1198
$ content = $ matches [3 ];
1199
+ $ id_class = $ matches [4 ] ?? null ;
1197
1200
1198
1201
$ content = preg_replace ('/^ *[|]/m ' , '' , $ content );
1199
1202
1200
- return $ this ->_doTable_callback (array ($ matches [0 ], $ head , $ underline , $ content ));
1203
+ return $ this ->_doTable_callback (array ($ matches [0 ], $ head , $ underline , $ content, $ id_class ));
1201
1204
}
1202
1205
1203
1206
/**
@@ -1223,7 +1226,8 @@ protected function _doTable_callback($matches) {
1223
1226
$ head = $ matches [1 ];
1224
1227
$ underline = $ matches [2 ];
1225
1228
$ content = $ matches [3 ];
1226
- $ attr = [];
1229
+ $ id_class = $ matches [4 ] ?? null ;
1230
+ $ attr = [];
1227
1231
1228
1232
// Remove any tailing pipes for each line.
1229
1233
$ head = preg_replace ('/[|] *$/m ' , '' , $ head );
@@ -1251,7 +1255,8 @@ protected function _doTable_callback($matches) {
1251
1255
$ attr = array_pad ($ attr , $ col_count , '' );
1252
1256
1253
1257
// Write column headers.
1254
- $ text = "<table> \n" ;
1258
+ $ table_attr_str = $ this ->doExtraAttributes ('table ' , $ id_class , null , []);
1259
+ $ text = "<table $ table_attr_str> \n" ;
1255
1260
$ text .= "<thead> \n" ;
1256
1261
$ text .= "<tr> \n" ;
1257
1262
foreach ($ headers as $ n => $ header ) {
0 commit comments