diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index 92e3da6ec..3bf6ae5d9 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -3067,7 +3067,7 @@ Result> parse_html(string &str) { if (tag_name != "a" && tag_name != "b" && tag_name != "strong" && tag_name != "i" && tag_name != "em" && tag_name != "s" && tag_name != "strike" && tag_name != "del" && tag_name != "u" && tag_name != "ins" && tag_name != "tg-spoiler" && tag_name != "tg-emoji" && tag_name != "span" && tag_name != "pre" && - tag_name != "code") { + tag_name != "code" && tag_name != "blockquote") { return Status::Error(400, PSLICE() << "Unsupported start tag \"" << tag_name << "\" at byte offset " << begin_pos); } @@ -3235,6 +3235,8 @@ Result> parse_html(string &str) { entities.emplace_back(MessageEntity::Type::Code, entity_offset, entity_length, nested_entities.back().argument); } + } else if (tag_name == "blockquote") { + entities.emplace_back(MessageEntity::Type::BlockQuote, entity_offset, entity_length); } else { UNREACHABLE(); } diff --git a/test/message_entities.cpp b/test/message_entities.cpp index 265c034b5..0d71db872 100644 --- a/test/message_entities.cpp +++ b/test/message_entities.cpp @@ -1283,6 +1283,7 @@ TEST(MessageEntities, parse_html) { check_parse_html("➡️ ➡️➡️ ➡️", "➡️ ➡️➡️ ➡️", {{td::MessageEntity::Type::Strikethrough, 5, 5}}); check_parse_html("➡️ ➡️➡️ ➡️", "➡️ ➡️➡️ ➡️", {{td::MessageEntity::Type::Strikethrough, 5, 5}}); check_parse_html("➡️ ➡️➡️ ➡️", "➡️ ➡️➡️ ➡️", {{td::MessageEntity::Type::Strikethrough, 5, 5}}); + check_parse_html("➡️ ➡️
➡️ ➡️
", "➡️ ➡️➡️ ➡️", {{td::MessageEntity::Type::BlockQuote, 5, 5}}); check_parse_html("➡️ ➡️➡️ ➡️➡️ ➡️", "➡️ ➡️➡️ ➡️➡️ ➡️", {{td::MessageEntity::Type::Italic, 5, 5}, {td::MessageEntity::Type::Bold, 10, 5}}); check_parse_html("🏟 🏟🏟 <🏟", "🏟 🏟🏟 <🏟", {{td::MessageEntity::Type::Italic, 5, 6}}); @@ -1367,6 +1368,8 @@ TEST(MessageEntities, parse_html) { check_parse_html("🏟 🏟🏟1", "🏟 🏟🏟1", {{td::MessageEntity::Type::Bold, 5, 3}, {td::MessageEntity::Type::CustomEmoji, 5, 2, td::CustomEmojiId(static_cast(1))}}); + check_parse_html("
a<
b;", "a