wip.py: fix convert_list non closing tags at the end

This commit is contained in:
Adrien Bourmault 2023-04-10 19:20:04 +02:00
parent 1dfb40d0b2
commit e556ecdda7
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 9 additions and 12 deletions

View File

@ -850,8 +850,7 @@ def convert_list(markdown_str):
# Find items
for i in range(len(strlist)):
if tyto.words_tags[13][0] in strlist[i] or \
tyto.words_tags[13][1] in strlist[i]:
if strlist[i] == "":
continue
# = and +
@ -902,22 +901,20 @@ def convert_list(markdown_str):
# rank up
if cur_rank > rank:
for i in range(cur_rank - rank - 1):
work_str += " "*(rank+i) + OPENING[rank_stack.append(UL)]
rank_stack.append(state)
work_str += " "*rank + OPENING[state]
for i in range(cur_rank - rank):
work_str += " "*(rank+i) + OPENING[state]
rank_stack.append(state)
# rank down
elif cur_rank < rank:
for i in range(rank - cur_rank - 1):
for i in range(rank - cur_rank):
work_str += " "*(rank-i-1) + CLOSING[rank_stack.pop()]
work_str += " "*cur_rank + CLOSING[rank_stack.pop()]
work_str += " "*cur_rank + '<li>' + text + "</li>\n"
work_str += " "*(cur_rank-1) + CLOSING[rank_stack.pop()]
for i in range(cur_rank):
work_str += " "*(cur_rank-i-1) + CLOSING[rank_stack.pop()]
return work_str