parseRow method
Implementation
Element parseRow(BlockParser parser, List<String?> alignments, String cellType) {
final line = parser.current.replaceFirst(_openingPipe, '').replaceFirst(_closingPipe, '');
final cells = line.split(_pipePattern);
parser.advance();
final row = <Element>[];
String? preCell;
for (var cell in cells) {
if (preCell != null) {
cell = preCell + cell;
preCell = null;
}
if (cell.endsWith('\\')) {
preCell = '${cell.substring(0, cell.length - 1)}|';
continue;
}
final contents = UnparsedContent(cell);
row.add(Element(cellType, [contents]));
}
for (var i = 0; i < row.length && i < alignments.length; i++) {
if (alignments[i] == null) {
continue;
}
row[i].attributes['style'] = 'text-align: ${alignments[i]};';
}
return Element('tr', row);
}