mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-03 23:37:39 +01:00
fix: spoiler detection regex and cleaning (#787)
This commit is contained in:
parent
d58d2ba4b4
commit
a6675a5563
@ -1,7 +1,7 @@
|
||||
package com.github.diegoberaldin.raccoonforlemmy.core.markdown
|
||||
|
||||
internal object SpoilerRegex {
|
||||
val spoilerOpening = Regex("(:::\\s+spoiler\\s+)(?<title>.*)")
|
||||
val spoilerOpening = Regex("(:::\\s?spoiler\\s+)(?<title>.*)")
|
||||
val spoilerClosing = Regex(":::")
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,9 @@ private fun String.spoilerFixUp(): String = run {
|
||||
finalLinesSizeAtLastSpoiler = finalLines.size
|
||||
} else if (line.isNotBlank()) {
|
||||
if (isSpoilerOnTopOfStack) {
|
||||
// removes list inside spoilers
|
||||
// removes list and blank lines inside spoilers
|
||||
val cleanLine = line.replace(Regex("^\\s*?- "), "").trim()
|
||||
if (cleanLine.isNotEmpty()) {
|
||||
if (cleanLine.isNotBlank()) {
|
||||
finalLines += cleanLine
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user