1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-03 00:15:27 +00:00
tgbotapi/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PreTextSource.kt

24 lines
847 B
Kotlin
Raw Normal View History

2020-10-04 11:06:30 +00:00
package dev.inmo.tgbotapi.types.MessageEntity.textsources
2020-11-06 12:52:59 +00:00
import dev.inmo.tgbotapi.CommonAbstracts.*
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.utils.*
import dev.inmo.tgbotapi.utils.internal.*
import dev.inmo.tgbotapi.utils.internal.preMarkdown
import dev.inmo.tgbotapi.utils.internal.preMarkdownV2
2020-11-06 12:52:59 +00:00
/**
* @see pre
*/
data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
val language: String? = null
) : TextSource {
override val asMarkdownSource: String by lazy { source.preMarkdown(language) }
override val asMarkdownV2Source: String by lazy { source.preMarkdownV2(language) }
override val asHtmlSource: String by lazy { source.preHTML(language) }
}
2020-11-06 12:52:59 +00:00
@Suppress("NOTHING_TO_INLINE")
inline fun pre(code: String, language: String? = null) = PreTextSource(code, language)