From 89d490680e61334751ae17df81c19eca33174cbb Mon Sep 17 00:00:00 2001
From: Mathieu Loiseau <mathieu.loiseau@liris.cnrs.fr>
Date: Mon, 29 May 2023 10:01:49 +0200
Subject: [PATCH] =?UTF-8?q?pas=20corrig=C3=A9,=20mais=20ne=20plante=20plus?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 wikstraktor.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/wikstraktor.py b/wikstraktor.py
index fec1efb..898ddb8 100755
--- a/wikstraktor.py
+++ b/wikstraktor.py
@@ -599,16 +599,24 @@ class Wikstraktor:
 			pattern_ex = self.constants['sense_pattern'][0]["add_subdef"] + self.constants['sense_pattern'][0]["ex"]
 		#Process examples
 		a = 0
-		#print(newSense, sub_items)# DEBUG:
+		#print(sub_items)# DEBUG:
 		for item_list in sub_items:
+			print(a, item_list.pattern, 'vs', pattern_ex)# DEBUG:
 			if item_list.pattern == pattern_ex:
 				for item in item_list.items:
 					newSense.add_example(self.process_example(item))
 					#Si on veut traiter les sous items (ex traductions), on peut utiliser
 					#item_list.sublists(a)
+			# print(a, item_list.pattern, 'vs', pattern_subdef, item_list.items, len(item_list.sublists()))# DEBUG:
+			# print(item_list.sublists(a))# DEBUG:
 			if def_level and item_list.pattern == pattern_subdef:
 				for item in item_list.items:
-					newSense.add_subsense(self.process_definition(item, item_list.sublists(a), False))
+					try:
+						sub_sub = item_list.sublists(a)
+					except IndexError as err:
+						sub_sub = []
+					print(sub_sub, item_list.sublists())
+					newSense.add_subsense(self.process_definition(item, sub_sub, False))
 			a += 1
 		return newSense
 
-- 
GitLab