1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Fix method signatures

This commit is contained in:
Allan Wang 2018-09-27 20:36:01 -04:00
parent 2e22f2ae6a
commit 2bc366f8f4

View File

@ -104,22 +104,19 @@ internal abstract class FrostParserBase<out T : Any>(private val redirectToText:
protected abstract fun parseImpl(doc: Document): T? protected abstract fun parseImpl(doc: Document): T?
// protected abstract fun parse(doc: Document): T?
/** /**
* Attempts to find inner <i> element with some style containing a url * Attempts to find inner <i> element with some style containing a url
* Returns the formatted url, or an empty string if nothing was found * Returns the formatted url, or an empty string if nothing was found
*/ */
protected fun Element.getInnerImgStyle() = protected fun Element.getInnerImgStyle(): String? =
select("i.img[style*=url]").getStyleUrl() select("i.img[style*=url]").getStyleUrl()
protected fun Elements.getStyleUrl() = protected fun Elements.getStyleUrl(): String? =
FB_CSS_URL_MATCHER.find(attr("style"))[1]?.formattedFbUrl FB_CSS_URL_MATCHER.find(attr("style"))[1]?.formattedFbUrl
protected open fun textToDoc(text: String): Document = if (!redirectToText) protected open fun textToDoc(text: String): Document? =
Jsoup.parse(text) if (!redirectToText) Jsoup.parse(text)
else else throw RuntimeException("${this::class.java.simpleName} requires text redirect but did not implement textToDoc")
throw RuntimeException("${this::class.java.simpleName} requires text redirect but did not implement textToDoc")
protected fun parseLink(element: Element?): FrostLink? { protected fun parseLink(element: Element?): FrostLink? {
val a = element?.getElementsByTag("a")?.first() ?: return null val a = element?.getElementsByTag("a")?.first() ?: return null