Fix span wrapper processing

This commit is contained in:
Kibzik
2023-03-15 20:00:32 +03:00
parent b5ad043335
commit 047bfeca20
7 changed files with 82 additions and 75 deletions

View File

@@ -67,14 +67,14 @@ class ChapterItem:
for i in self.sub_items:
sub_dicts.append(i.to_dict(lvl + 1))
if lvl > LiveCartaConfig.SUPPORTED_LEVELS:
if lvl > LiveCartaConfig.NUM_SUPPORTED_LEVELS:
return {
"title": self.title,
"contents": [self.content] + [x['contents'] for x in sub_dicts],
"sub_items": []
}
if (lvl == LiveCartaConfig.SUPPORTED_LEVELS) and sub_dicts:
if (lvl == LiveCartaConfig.NUM_SUPPORTED_LEVELS) and sub_dicts:
return {
"title": self.title,
"contents": [self.content] + flatten([x['contents'] for x in sub_dicts]),