mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Pyrofork: Add blockquote markdown unparser
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
c13f3b766e
commit
4fc27cbae1
1 changed files with 14 additions and 1 deletions
|
|
@ -173,8 +173,21 @@ class Markdown:
|
|||
start_tag = f"{PRE_DELIM}{language}\n"
|
||||
end_tag = f"\n{PRE_DELIM}"
|
||||
elif entity_type == MessageEntityType.BLOCKQUOTE:
|
||||
start_tag = BLOCKQUOTE_DELIM
|
||||
start_tag = BLOCKQUOTE_DELIM + " "
|
||||
end_tag = ""
|
||||
blockquote_text = text[start:end]
|
||||
lines = blockquote_text.split("\n")
|
||||
last_length = 0
|
||||
for line in lines:
|
||||
if len(line) == 0 and last_length == end:
|
||||
continue
|
||||
start_offset = start+last_length
|
||||
last_length = last_length+len(line)
|
||||
end_offset = start_offset+last_length
|
||||
entities_offsets.append((start_tag, start_offset,))
|
||||
entities_offsets.append((end_tag, end_offset,))
|
||||
last_length = last_length+1
|
||||
continue
|
||||
elif entity_type == MessageEntityType.SPOILER:
|
||||
start_tag = end_tag = SPOILER_DELIM
|
||||
elif entity_type == MessageEntityType.TEXT_LINK:
|
||||
|
|
|
|||
Loading…
Reference in a new issue