From 45b89e6abf9480f62f5dd0433d2c86f37f18959f Mon Sep 17 00:00:00 2001
From: Miguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
Date: Tue, 1 Apr 2025 13:56:03 +0000
Subject: [PATCH] Fix when checking generated table rows

---
 toMkdocs/gridTableTools.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/toMkdocs/gridTableTools.py b/toMkdocs/gridTableTools.py
index ab2585a..6b4161c 100644
--- a/toMkdocs/gridTableTools.py
+++ b/toMkdocs/gridTableTools.py
@@ -529,9 +529,13 @@ def parseGridTableWithSpans(gridTable:str) -> tuple[GridTableRowList, GridTableR
 			if idx > 0 and cell.colspan == 0:
 				if forwardRowspan[cellIndex] > 0:
 					sum += 1
-				forwardRowspan[cellIndex] -= 1
+					forwardRowspan[cellIndex] -= 1
 			if forwardRowspan[cellIndex] == 0 and cell.rowspan > 1:
 				forwardRowspan[cellIndex] = cell.rowspan -1
+				colspan=1
+				while cell.colspan > colspan:
+					forwardRowspan[cellIndex + colspan] = cell.rowspan - 1
+					colspan += 1
 
 		if not sum == numberOfColumns:
 			raise ValueError('Grid table not converted properly')
@@ -548,9 +552,14 @@ def parseGridTableWithSpans(gridTable:str) -> tuple[GridTableRowList, GridTableR
 			if idx > 0 and cell.colspan == 0:
 				if forwardRowspan[cellIndex] > 0:
 					sum += 1
-				forwardRowspan[cellIndex] -= 1
+					forwardRowspan[cellIndex] -= 1
 			if forwardRowspan[cellIndex] == 0 and cell.rowspan > 1:
 				forwardRowspan[cellIndex] = cell.rowspan - 1
+				colspan=1
+				while cell.colspan > colspan:
+					forwardRowspan[cellIndex + colspan] = cell.rowspan - 1
+					colspan += 1
+					
 		if not sum == numberOfColumns:
 			raise ValueError('Grid table not converted properly')
 
-- 
GitLab