[IsekaiScanEu] Fix chapters order #162
This commit is contained in:
@@ -60,7 +60,7 @@ internal class IsekaiScanEuParser(context: MangaLoaderContext) :
|
||||
|
||||
private fun parseChapters(ul: Element): List<MangaChapter> {
|
||||
val dateFormat = SimpleDateFormat(datePattern, Locale.US)
|
||||
return ul.select("li").mapChapters { i, li ->
|
||||
return ul.select("li").mapChapters(reversed = true) { i, li ->
|
||||
val a = li.selectFirst("a")
|
||||
val href = a?.attrAsRelativeUrlOrNull("href") ?: li.parseFailed("Link is missing")
|
||||
MangaChapter(
|
||||
|
||||
@@ -4,7 +4,10 @@ import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import org.koitharu.kotatsu.parsers.model.MangaChapter
|
||||
|
||||
@InternalParsersApi
|
||||
inline fun <T> Iterable<T>.mapChapters(transform: (index: Int, T) -> MangaChapter?): List<MangaChapter> {
|
||||
inline fun <T> Iterable<T>.mapChapters(
|
||||
reversed: Boolean = false,
|
||||
transform: (index: Int, T) -> MangaChapter?,
|
||||
): List<MangaChapter> {
|
||||
val builder = ChaptersListBuilder(collectionSize())
|
||||
var index = 0
|
||||
for (item in this) {
|
||||
@@ -12,6 +15,9 @@ inline fun <T> Iterable<T>.mapChapters(transform: (index: Int, T) -> MangaChapte
|
||||
index++
|
||||
}
|
||||
}
|
||||
if (reversed) {
|
||||
builder.reverse()
|
||||
}
|
||||
return builder.toList()
|
||||
}
|
||||
|
||||
@@ -39,4 +45,4 @@ internal class ChaptersListBuilder(initialSize: Int) {
|
||||
}
|
||||
|
||||
fun toList(): List<MangaChapter> = list
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user