extend regex, up version, fix enter on android tv
This commit is contained in:
@@ -7,7 +7,7 @@ plugins {
|
||||
alias(libs.plugins.convention.ktor.client)
|
||||
}
|
||||
|
||||
val appVersion = "1.25.2"
|
||||
val appVersion = "1.25.3"
|
||||
|
||||
android {
|
||||
buildFeatures { buildConfig = true }
|
||||
|
||||
+4
-4
@@ -6,7 +6,7 @@ import ru.shadowsparky.chat.domain.TextToken
|
||||
|
||||
@Factory
|
||||
class MovieTextParser : ChatTextParser {
|
||||
private val regex = Regex("«(.*?)»|\"(.*?)\"")
|
||||
private val regex = Regex("«(.*?)»|\"(.*?)\"|\\*\\*(.*?)\\*\\*")
|
||||
|
||||
override fun parse(content: String): List<TextToken> {
|
||||
val tokens = mutableListOf<TextToken>()
|
||||
@@ -16,11 +16,11 @@ class MovieTextParser : ChatTextParser {
|
||||
tokens.add(TextToken.Plain(content.substring(lastIndex, matchResult.range.first)))
|
||||
}
|
||||
val movieTitle = matchResult.groupValues[1].takeIf { it.isNotEmpty() }
|
||||
?: matchResult.groupValues[2]
|
||||
tokens.add(TextToken.Link(text = movieTitle))
|
||||
?: matchResult.groupValues[2].takeIf { it.isNotEmpty() }
|
||||
?: matchResult.groupValues[3]
|
||||
tokens.add(TextToken.Link(movieTitle))
|
||||
lastIndex = matchResult.range.last + 1
|
||||
}
|
||||
|
||||
if (lastIndex < content.length) {
|
||||
tokens.add(TextToken.Plain(content.substring(lastIndex)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user