Mangadex fix alt title being removed by cleanDescription (#1378)
* Update MdUtil.kt * Update ApiMangaParser.kt * Update MdUtil.kt
This commit is contained in:
parent
5f19859589
commit
9b6600d31f
@ -96,9 +96,9 @@ class ApiMangaParser(
|
|||||||
originalLanguage = mangaAttributesDto.originalLanguage,
|
originalLanguage = mangaAttributesDto.originalLanguage,
|
||||||
).orEmpty()
|
).orEmpty()
|
||||||
|
|
||||||
description = MdUtil.cleanDescription(
|
val cleanDesc = MdUtil.cleanDescription(rawDesc)
|
||||||
if (altTitlesInDesc) MdUtil.addAltTitleToDesc(rawDesc, altTitles) else rawDesc,
|
|
||||||
)
|
description = if (altTitlesInDesc) MdUtil.addAltTitleToDesc(cleanDesc, altTitles) else cleanDesc
|
||||||
|
|
||||||
authors = mangaRelationshipsDto.filter { relationshipDto ->
|
authors = mangaRelationshipsDto.filter { relationshipDto ->
|
||||||
relationshipDto.type.equals(MdConstants.Types.author, true)
|
relationshipDto.type.equals(MdConstants.Types.author, true)
|
||||||
|
@ -89,7 +89,7 @@ class MdUtil {
|
|||||||
|
|
||||||
fun cleanDescription(string: String): String {
|
fun cleanDescription(string: String): String {
|
||||||
return Parser.unescapeEntities(string, false)
|
return Parser.unescapeEntities(string, false)
|
||||||
.substringBefore("---")
|
.substringBefore("\n---")
|
||||||
.replace(markdownLinksRegex, "$1")
|
.replace(markdownLinksRegex, "$1")
|
||||||
.replace(markdownItalicBoldRegex, "$1")
|
.replace(markdownItalicBoldRegex, "$1")
|
||||||
.replace(markdownItalicRegex, "$1")
|
.replace(markdownItalicRegex, "$1")
|
||||||
@ -265,7 +265,7 @@ class MdUtil {
|
|||||||
} else {
|
} else {
|
||||||
val altTitlesDesc = altTitles
|
val altTitlesDesc = altTitles
|
||||||
.joinToString("\n", "${Injekt.get<Application>().getString(R.string.alt_titles)}:\n") { "• $it" }
|
.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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user