Mangadex fix alt title being removed by cleanDescription (#1378)

* Update MdUtil.kt

* Update ApiMangaParser.kt

* Update MdUtil.kt
This commit is contained in:
spicemace 2025-01-21 14:12:11 -08:00 committed by GitHub
parent 5f19859589
commit 9b6600d31f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -96,9 +96,9 @@ class ApiMangaParser(
originalLanguage = mangaAttributesDto.originalLanguage,
).orEmpty()
description = MdUtil.cleanDescription(
if (altTitlesInDesc) MdUtil.addAltTitleToDesc(rawDesc, altTitles) else rawDesc,
)
val cleanDesc = MdUtil.cleanDescription(rawDesc)
description = if (altTitlesInDesc) MdUtil.addAltTitleToDesc(cleanDesc, altTitles) else cleanDesc
authors = mangaRelationshipsDto.filter { relationshipDto ->
relationshipDto.type.equals(MdConstants.Types.author, true)

View File

@ -89,7 +89,7 @@ class MdUtil {
fun cleanDescription(string: String): String {
return Parser.unescapeEntities(string, false)
.substringBefore("---")
.substringBefore("\n---")
.replace(markdownLinksRegex, "$1")
.replace(markdownItalicBoldRegex, "$1")
.replace(markdownItalicRegex, "$1")
@ -265,7 +265,7 @@ class MdUtil {
} else {
val altTitlesDesc = altTitles
.joinToString("\n", "${Injekt.get<Application>().getString(R.string.alt_titles)}:\n") { "$it" }
description + (if (description.isBlank()) "" else "\n\n") + altTitlesDesc
description + (if (description.isBlank()) "" else "\n\n") + Parser.unescapeEntities(altTitlesDesc, false)
}
}
}