Added utilities to wrap TextWithEntities.
This commit is contained in:
parent
745ce34dd5
commit
09b56b019b
2 changed files with 10 additions and 0 deletions
|
|
@ -46,6 +46,13 @@ TextWithEntities PlainLink(const QString &text) {
|
||||||
return WithSingleEntity(text, EntityType::PlainLink);
|
return WithSingleEntity(text, EntityType::PlainLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextWithEntities Wrapped(TextWithEntities text, EntityType type) {
|
||||||
|
text.entities.insert(
|
||||||
|
text.entities.begin(),
|
||||||
|
{ type, 0, int(text.text.size()), {} });
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
TextWithEntities RichLangValue(const QString &text) {
|
TextWithEntities RichLangValue(const QString &text) {
|
||||||
static const auto kStart = QRegularExpression("(\\*\\*|__)");
|
static const auto kStart = QRegularExpression("(\\*\\*|__)");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ inline constexpr auto Upper = details::ToUpperType{};
|
||||||
const QString &text,
|
const QString &text,
|
||||||
const QString &url = "internal:action");
|
const QString &url = "internal:action");
|
||||||
[[nodiscard]] TextWithEntities PlainLink(const QString &text);
|
[[nodiscard]] TextWithEntities PlainLink(const QString &text);
|
||||||
|
[[nodiscard]] TextWithEntities Wrapped(
|
||||||
|
TextWithEntities text,
|
||||||
|
EntityType type);
|
||||||
[[nodiscard]] TextWithEntities RichLangValue(const QString &text);
|
[[nodiscard]] TextWithEntities RichLangValue(const QString &text);
|
||||||
[[nodiscard]] inline TextWithEntities WithEntities(const QString &text) {
|
[[nodiscard]] inline TextWithEntities WithEntities(const QString &text) {
|
||||||
return { text };
|
return { text };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue