mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
parent
95e0086eed
commit
343ffc23eb
1 changed files with 48 additions and 24 deletions
|
@ -389,11 +389,17 @@ QByteArray Parser::block(const MTPDpageBlockUnsupported &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockTitle &data) {
|
QByteArray Parser::block(const MTPDpageBlockTitle &data) {
|
||||||
return tag("h1", { { "class", "title" } }, rich(data.vtext()));
|
return tag("h1", {
|
||||||
|
{ "class", "title" },
|
||||||
|
{ "dir", "auto" },
|
||||||
|
}, rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockSubtitle &data) {
|
QByteArray Parser::block(const MTPDpageBlockSubtitle &data) {
|
||||||
return tag("h2", { { "class", "subtitle" } }, rich(data.vtext()));
|
return tag("h2", {
|
||||||
|
{ "class", "subtitle" },
|
||||||
|
{ "dir", "auto" },
|
||||||
|
}, rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockAuthorDate &data) {
|
QByteArray Parser::block(const MTPDpageBlockAuthorDate &data) {
|
||||||
|
@ -401,23 +407,29 @@ QByteArray Parser::block(const MTPDpageBlockAuthorDate &data) {
|
||||||
if (const auto date = data.vpublished_date().v) {
|
if (const auto date = data.vpublished_date().v) {
|
||||||
inner += " \xE2\x80\xA2 " + tag("time", Date(date));
|
inner += " \xE2\x80\xA2 " + tag("time", Date(date));
|
||||||
}
|
}
|
||||||
return tag("address", inner);
|
return tag("address", { { "dir", "auto" } }, inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockHeader &data) {
|
QByteArray Parser::block(const MTPDpageBlockHeader &data) {
|
||||||
return tag("h3", { { "class", "header" } }, rich(data.vtext()));
|
return tag("h3", {
|
||||||
|
{ "class", "header" },
|
||||||
|
{ "dir", "auto" },
|
||||||
|
}, rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockSubheader &data) {
|
QByteArray Parser::block(const MTPDpageBlockSubheader &data) {
|
||||||
return tag("h4", { { "class", "subheader" } }, rich(data.vtext()));
|
return tag("h4", {
|
||||||
|
{ "class", "subheader" },
|
||||||
|
{ "dir", "auto" },
|
||||||
|
}, rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockParagraph &data) {
|
QByteArray Parser::block(const MTPDpageBlockParagraph &data) {
|
||||||
return tag("p", rich(data.vtext()));
|
return tag("p", { { "dir", "auto" } }, rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockPreformatted &data) {
|
QByteArray Parser::block(const MTPDpageBlockPreformatted &data) {
|
||||||
auto list = Attributes();
|
auto list = Attributes{ { "dir", "auto" } };
|
||||||
const auto language = utf(data.vlanguage());
|
const auto language = utf(data.vlanguage());
|
||||||
if (!language.isEmpty()) {
|
if (!language.isEmpty()) {
|
||||||
list.push_back({ "data-language", language });
|
list.push_back({ "data-language", language });
|
||||||
|
@ -428,7 +440,10 @@ QByteArray Parser::block(const MTPDpageBlockPreformatted &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockFooter &data) {
|
QByteArray Parser::block(const MTPDpageBlockFooter &data) {
|
||||||
return tag("footer", { { "class", "footer" } }, rich(data.vtext()));
|
return tag("footer", {
|
||||||
|
{ "class", "footer" },
|
||||||
|
{ "dir", "auto" },
|
||||||
|
}, rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockDivider &data) {
|
QByteArray Parser::block(const MTPDpageBlockDivider &data) {
|
||||||
|
@ -447,19 +462,21 @@ QByteArray Parser::block(const MTPDpageBlockBlockquote &data) {
|
||||||
const auto caption = rich(data.vcaption());
|
const auto caption = rich(data.vcaption());
|
||||||
const auto cite = caption.isEmpty()
|
const auto cite = caption.isEmpty()
|
||||||
? QByteArray()
|
? QByteArray()
|
||||||
: tag("cite", caption);
|
: tag("cite", { { "dir", "auto" } }, caption);
|
||||||
return tag("blockquote", rich(data.vtext()) + cite);
|
return tag("blockquote", {
|
||||||
|
{ "dir", "auto" }
|
||||||
|
}, rich(data.vtext()) + cite);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockPullquote &data) {
|
QByteArray Parser::block(const MTPDpageBlockPullquote &data) {
|
||||||
const auto caption = rich(data.vcaption());
|
const auto caption = rich(data.vcaption());
|
||||||
const auto cite = caption.isEmpty()
|
const auto cite = caption.isEmpty()
|
||||||
? QByteArray()
|
? QByteArray()
|
||||||
: tag("cite", caption);
|
: tag("cite", { { "dir", "auto" } }, caption);
|
||||||
return tag(
|
return tag("div", {
|
||||||
"div",
|
{ "class", "pullquote" },
|
||||||
{ { "class", "pullquote" } },
|
{ "dir", "auto" },
|
||||||
rich(data.vtext()) + cite);
|
}, rich(data.vtext()) + cite);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(
|
QByteArray Parser::block(
|
||||||
|
@ -763,7 +780,10 @@ QByteArray Parser::block(const MTPDpageBlockAudio &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockKicker &data) {
|
QByteArray Parser::block(const MTPDpageBlockKicker &data) {
|
||||||
return tag("h5", { { "class", "kicker" } }, rich(data.vtext()));
|
return tag("h5", {
|
||||||
|
{ "class", "kicker" },
|
||||||
|
{ "dir", "auto" },
|
||||||
|
}, rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockTable &data) {
|
QByteArray Parser::block(const MTPDpageBlockTable &data) {
|
||||||
|
@ -780,7 +800,7 @@ QByteArray Parser::block(const MTPDpageBlockTable &data) {
|
||||||
}
|
}
|
||||||
auto title = rich(data.vtitle());
|
auto title = rich(data.vtitle());
|
||||||
if (!title.isEmpty()) {
|
if (!title.isEmpty()) {
|
||||||
title = tag("caption", title);
|
title = tag("caption", { { "dir", "auto" } }, title);
|
||||||
}
|
}
|
||||||
auto result = tag("table", attibutes, title + list(data.vrows()));
|
auto result = tag("table", attibutes, title + list(data.vrows()));
|
||||||
result = tag("figure", { { "class", "table" } }, result);
|
result = tag("figure", { { "class", "table" } }, result);
|
||||||
|
@ -800,7 +820,8 @@ QByteArray Parser::block(const MTPDpageBlockDetails &data) {
|
||||||
return tag(
|
return tag(
|
||||||
"details",
|
"details",
|
||||||
attributes,
|
attributes,
|
||||||
tag("summary", rich(data.vtitle())) + list(data.vblocks()));
|
(tag("summary", { { "dir", "auto" } }, rich(data.vtitle()))
|
||||||
|
+ list(data.vblocks())));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageBlockRelatedArticles &data) {
|
QByteArray Parser::block(const MTPDpageBlockRelatedArticles &data) {
|
||||||
|
@ -810,7 +831,10 @@ QByteArray Parser::block(const MTPDpageBlockRelatedArticles &data) {
|
||||||
}
|
}
|
||||||
auto title = rich(data.vtitle());
|
auto title = rich(data.vtitle());
|
||||||
if (!title.isEmpty()) {
|
if (!title.isEmpty()) {
|
||||||
title = tag("h4", { { "class", "related-title" } }, title);
|
title = tag("h4", {
|
||||||
|
{ "class", "related-title" },
|
||||||
|
{ "dir", "auto" },
|
||||||
|
}, title);
|
||||||
}
|
}
|
||||||
return tag("section", { { "class", "related" } }, title + result);
|
return tag("section", { { "class", "related" } }, title + result);
|
||||||
}
|
}
|
||||||
|
@ -899,7 +923,7 @@ QByteArray Parser::block(const MTPDpageTableCell &data) {
|
||||||
} else {
|
} else {
|
||||||
style += "vertical-align:top;";
|
style += "vertical-align:top;";
|
||||||
}
|
}
|
||||||
auto attributes = Attributes{ { "style", style } };
|
auto attributes = Attributes{ { "style", style }, { "dir", "auto" } };
|
||||||
if (const auto cs = data.vcolspan()) {
|
if (const auto cs = data.vcolspan()) {
|
||||||
attributes.push_back({ "colspan", Number(cs->v) });
|
attributes.push_back({ "colspan", Number(cs->v) });
|
||||||
}
|
}
|
||||||
|
@ -910,7 +934,7 @@ QByteArray Parser::block(const MTPDpageTableCell &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageListItemText &data) {
|
QByteArray Parser::block(const MTPDpageListItemText &data) {
|
||||||
return tag("li", rich(data.vtext()));
|
return tag("li", { { "dir", "auto" } }, rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Parser::block(const MTPDpageListItemBlocks &data) {
|
QByteArray Parser::block(const MTPDpageListItemBlocks &data) {
|
||||||
|
@ -920,7 +944,7 @@ QByteArray Parser::block(const MTPDpageListItemBlocks &data) {
|
||||||
QByteArray Parser::block(const MTPDpageListOrderedItemText &data) {
|
QByteArray Parser::block(const MTPDpageListOrderedItemText &data) {
|
||||||
return tag(
|
return tag(
|
||||||
"li",
|
"li",
|
||||||
{ { "value", utf(data.vnum()) } },
|
{ { "value", utf(data.vnum()) }, { "dir", "auto" } },
|
||||||
rich(data.vtext()));
|
rich(data.vtext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,11 +1097,11 @@ QByteArray Parser::caption(const MTPPageCaption &caption) {
|
||||||
auto text = rich(caption.data().vtext());
|
auto text = rich(caption.data().vtext());
|
||||||
const auto credit = rich(caption.data().vcredit());
|
const auto credit = rich(caption.data().vcredit());
|
||||||
if (!credit.isEmpty()) {
|
if (!credit.isEmpty()) {
|
||||||
text += tag("cite", credit);
|
text += tag("cite", { { "dir", "auto" } }, credit);
|
||||||
} else if (text.isEmpty()) {
|
} else if (text.isEmpty()) {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
return tag("figcaption", text);
|
return tag("figcaption", { { "dir", "auto" } }, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
Photo Parser::parse(const MTPPhoto &photo) {
|
Photo Parser::parse(const MTPPhoto &photo) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue