row_lines=lines[start:end]# Lines between separators including separator line start as it gives information about the number of columns of the row
ifrow_lines:
# Combine multiline content into single strings for each cell
forlineinrow_lines:
ifis_separator(line)andnotin_data_row:
number_of_columns_row=line.count("+")-1
in_data_row=True
parts=re.split(r"\s*\+\s*",line.strip("+"))
# Add as many cells as columns with span attributes
delimiter_index=0
# Determine the alignment of the cell - In order to replicate Pandoc's behaviour (do not support of alignment colons on separator lines (just header separator)
# we need to assign the default alignment as defined in the header separator line
# We may not need the code below, as that supports alignment per cell and row
#alignments = []
#for part_index in range(len(parts)):
# if parts[part_index].startswith(":") and not parts[part_index].endswith(":"):
# alignments.append("align=\"left\"")
# elif not parts[part_index].startswith(":") and parts[part_index].endswith(":"):