mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 04:43:45 +03:00
Fix directly nested markdown entities
This commit is contained in:
parent
8e36bb4c4d
commit
05b770a93f
|
@ -90,7 +90,11 @@ def parse(message, delimiters=None, url_re=None):
|
||||||
for ent in result:
|
for ent in result:
|
||||||
# If the end is after our start, it is affected
|
# If the end is after our start, it is affected
|
||||||
if ent.offset + ent.length > i:
|
if ent.offset + ent.length > i:
|
||||||
ent.length -= len(delim)
|
# If the old start is also before ours, it is fully enclosed
|
||||||
|
if ent.offset <= i:
|
||||||
|
ent.length -= len(delim) * 2
|
||||||
|
else:
|
||||||
|
ent.length -= len(delim)
|
||||||
|
|
||||||
# Append the found entity
|
# Append the found entity
|
||||||
ent = delimiters[delim]
|
ent = delimiters[delim]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user