From 017cf28e5e77f6eac6b64967a417a6acc76250bc Mon Sep 17 00:00:00 2001 From: Enzo Simonnet <enzosim@laposte.net> Date: Tue, 25 Oct 2022 14:21:55 +0000 Subject: [PATCH] =?UTF-8?q?def=20+=20ex=20OK=20N=C2=B0=20OK=20Pas=20bien?= =?UTF-8?q?=20imbriqu=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parsers/en_en.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/parsers/en_en.py b/parsers/en_en.py index 8271662..feedf89 100644 --- a/parsers/en_en.py +++ b/parsers/en_en.py @@ -47,9 +47,11 @@ class En_en_straktor(Wikstraktor): l = sensesContent.get_lists(('\\# ', '\\#:','\\## ', '\\##:' )) i = 0 senses = [] + nombreDef = 0 while i < len(l): if l[i].pattern == '\\# ': - newSense = Sense(f"{baseId}{i}") + nombreDef += 1 + newSense = Sense(f"{baseId}{nombreDef}") if len(l[i].templates) > 0: newSense.set_domain(l[i].templates[-1].arguments[-1].value)#We could use the second parameter for a comment newSense.add_def(self.wiki_language, self.wtp.parse(l[i].items[0]).plain_text().strip()) @@ -62,10 +64,12 @@ class En_en_straktor(Wikstraktor): if i == len(l)-1 or l[i+1].pattern == '\\# ' or l[i+1].pattern == '\\## ': senses.append(newSense) cnt = 0 + nombreSousDef = 0 while l[i].level == 3 and i < len(l) : cnt +=1 if l[i].pattern == '\\## ': - newSense2 = Sense(f"{baseId}{i}{cnt}") + nombreSousDef += 1 + newSense2 = Sense(f"{baseId}{nombreDef}{nombreSousDef}") if len(l[i].templates) > 0: newSense2.set_domain(l[i].templates[-1].arguments[-1].value)#We could use the second parameter for a comment newSense2.add_def(self.wiki_language, self.wtp.parse(l[i].items[0]).plain_text().strip()) -- GitLab