diff --git a/toMkdocs/gridTableTools.py b/toMkdocs/gridTableTools.py index e22c7330ed95d0d9b16bd4747b3337eedd7a8afd..d72934796db4632b9e26b00f9ba84617f9217774 100644 --- a/toMkdocs/gridTableTools.py +++ b/toMkdocs/gridTableTools.py @@ -398,6 +398,7 @@ def parseGridTableWithSpans(gridTable:str) -> tuple[GridTableRowList, GridTableR if len(cellsContent) <= numberOfColumns: # Colspan: Positions of | with respect to + need to be determined columnCellIndex = 0 + maxRowsTracker = max(rowsTracker) # Go through all cells in a columnt for columnIndex, content in enumerate(cellsContent): rowIndex = rowsTracker[columnCellIndex] @@ -405,7 +406,7 @@ def parseGridTableWithSpans(gridTable:str) -> tuple[GridTableRowList, GridTableR # Check whether a cell contains a header separator if matchGridTableBodySeparatorLine.match(content): # A new row is to be added - rowsTracker[columnCellIndex] = max(rowsTracker) + 1 # That actual row will have more than one row + rowsTracker[columnCellIndex] = maxRowsTracker + 1 # That actual row will have more than one row cell.listFlag = False columnForward = 0 @@ -413,7 +414,7 @@ def parseGridTableWithSpans(gridTable:str) -> tuple[GridTableRowList, GridTableR rowIndex = rowsTracker[columnCellIndex] # Correcting the rowIndex. Might have been changed by a previous iteration if rows[rowIndex][columnCellIndex].position >= delimiterPositions[delIndex]: columnForward += 1 - rowsTracker[columnCellIndex + columnForward - 1] = max(rowsTracker) + 1 if columnForward > 1 else 0 + rowsTracker[columnCellIndex + columnForward - 1] = maxRowsTracker + 1 if columnForward > 1 else 0 columnCellIndex += columnForward continue