1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

all fields in text sources are lazy

This commit is contained in:
InsanusMokrassar 2020-01-05 20:07:51 +06:00
parent bb3ebb455e
commit 4ac01d5331
6 changed files with 10 additions and 8 deletions

View File

@ -8,7 +8,7 @@ class BoldTextSource(
source: String,
textParts: List<TextPart>
) : MultilevelTextSource {
override val textParts: List<TextPart> = source.fullListOfSubSource(textParts)
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
override val asMarkdownSource: String by lazy { source.boldMarkdown() }
override val asMarkdownV2Source: String by lazy { boldMarkdownV2() }
override val asHtmlSource: String by lazy { boldHTML() }

View File

@ -15,9 +15,11 @@ class HashTagTextSource(
source: String,
textParts: List<TextPart>
) : MultilevelTextSource {
override val textParts: List<TextPart> = source.withoutSharp.fullListOfSubSource(
textParts.shiftSourcesToTheLeft(1)
)
override val textParts: List<TextPart> by lazy {
source.withoutSharp.fullListOfSubSource(
textParts.shiftSourcesToTheLeft(1)
)
}
override val asMarkdownSource: String by lazy { source.hashTagMarkdown() }
override val asMarkdownV2Source: String by lazy { hashTagMarkdownV2() }
override val asHtmlSource: String by lazy { hashTagHTML() }

View File

@ -8,7 +8,7 @@ class ItalicTextSource(
source: String,
textParts: List<TextPart>
) : MultilevelTextSource {
override val textParts: List<TextPart> = source.fullListOfSubSource(textParts)
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
override val asMarkdownSource: String by lazy { source.italicMarkdown() }
override val asMarkdownV2Source: String by lazy { italicMarkdownV2() }
override val asHtmlSource: String by lazy { italicHTML() }

View File

@ -8,7 +8,7 @@ class PhoneNumberTextSource(
source: String,
textParts: List<TextPart>
) : MultilevelTextSource {
override val textParts: List<TextPart> = source.fullListOfSubSource(textParts)
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
override val asMarkdownSource: String by lazy { source.phoneMarkdown() }
override val asMarkdownV2Source: String by lazy { phoneMarkdownV2() }
override val asHtmlSource: String by lazy { phoneHTML() }

View File

@ -8,7 +8,7 @@ class StrikethroughTextSource(
source: String,
textParts: List<TextPart>
) : MultilevelTextSource {
override val textParts: List<TextPart> = source.fullListOfSubSource(textParts)
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
override val asHtmlSource: String by lazy { strikethroughHTML() }
override val asMarkdownV2Source: String by lazy { strikethroughMarkdownV2() }
override val asMarkdownSource: String by lazy { source.strikethroughMarkdown() }

View File

@ -8,7 +8,7 @@ class UnderlineTextSource(
source: String,
textParts: List<TextPart>
) : MultilevelTextSource {
override val textParts: List<TextPart> = source.fullListOfSubSource(textParts)
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
override val asMarkdownSource: String by lazy { source.underlineMarkdown() }
override val asMarkdownV2Source: String by lazy { underlineMarkdownV2() }
override val asHtmlSource: String by lazy { underlineHTML() }