From 42124fd3fc58c7f87d2927fae7477ffad50f1048 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Mon, 20 Jun 2022 11:38:43 +0300 Subject: [PATCH] Update readme --- README.md | 49 ++++++++++++++----- .../koitharu/kotatsu/parsers/MangaParser.kt | 4 +- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 5d3ddde5f..4987e1626 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,42 @@ Library that provides manga sources. 1. Add it in your root build.gradle at the end of repositories: -```groovy -allprojects { - repositories { - ... - maven { url 'https://jitpack.io' } + ```groovy + allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } } -} -``` + ``` -2. Add the dependency +2. Add the dependency -```groovy -dependencies { - implementation 'com.github.nv95:kotatsu-parsers:master-SNAPSHOT' -} -``` \ No newline at end of file + For Java/Kotlin project: + ```groovy + dependencies { + implementation("com.github.nv95:kotatsu-parsers:$parsers_version") + } + ``` + + For Android project: + ```groovy + dependencies { + implementation("com.github.nv95:kotatsu-parsers:$parsers_version") { + exclude group: 'org.json', module: 'json' + } + } + ``` + + See for versions at [JitPack](https://jitpack.io/#nv95/kotatsu-parsers) + +3. Usage in code + + ```kotlin + val parser = MangaSource.MANGADEX.newParser(mangaLoaderContext) + ``` + + `mangaLoaderContext` is an implementation of the `MangaLoaderContext` class. + See [Android](https://github.com/nv95/Kotatsu/blob/devel/app/src/main/java/org/koitharu/kotatsu/core/parser/MangaLoaderContextImpl.kt) and [Non-Android](https://github.com/nv95/kotatsu-dl/blob/master/src/main/kotlin/org/koitharu/kotatsu_dl/env/MangaLoaderContextImpl.kt) implementation examples. + + Note that the `MangaSource.LOCAL` and `MangaSource.DUMMY` parsers cannot be instantiated. \ No newline at end of file diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt index 0eb6764cf..4a05b3d0f 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt @@ -45,6 +45,7 @@ abstract class MangaParser @InternalParsersApi constructor(val source: MangaSour * @param tags genres for filtering, values from [getTags] and [Manga.tags]. May be null or empty * @param sortOrder one of [sortOrders] or null for default value */ + @JvmSynthetic @InternalParsersApi abstract suspend fun getList( offset: Int, @@ -156,8 +157,7 @@ abstract class MangaParser @InternalParsersApi constructor(val source: MangaSour } @InternalParsersApi - @Suppress("NOTHING_TO_INLINE") - protected inline fun parseFailed(message: String? = null): Nothing { + protected fun parseFailed(message: String? = null): Nothing { throw ParseException(message, null) } } \ No newline at end of file