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!.content);
final headCells = _columnCount(parser.current.content);
final valBuf =
StringBuffer('${parser.current.content}\n${parser.next!.content}');
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.content}');
parser.advance();
}
return Element.empty(EmbeddableTable.tableType)
..attributes['data'] = valBuf.toString();
}