parse method
Parses a table into its three parts:
- a head row of head cells (
<th>
cells) - a divider of hyphens and pipes (not rendered)
- many body rows of body cells (
<td>
cells)
Implementation
@override
Node? parse(BlockParser parser) {
final columnCount = _columnCount(parser.next!);
final headCells = _columnCount(parser.current);
final valBuf = StringBuffer('${parser.current}\n${parser.next!}');
parser.advance();
if (columnCount != headCells) {
return null;
}
// advance header and divider of hyphens.
parser.advance();
while (!parser.isDone && !BlockSyntax.isAtBlockEnd(parser)) {
valBuf.write('\n${parser.current}');
parser.advance();
}
return Element.empty(EmbeddableTable.tableType)
..attributes['data'] = valBuf.toString();
}