All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.HtmlTextMode.kt Maven / Gradle / Ivy

Go to download

Annotation based HTML to Kotlin class parser with KMP support, jspoon successor

The newest version!
package dev.burnoo.kspoon

import com.fleeksoft.ksoup.nodes.Element
import dev.burnoo.kspoon.annotation.Selector

/**
 * Mode used for extracting content from [Element].
 */
public enum class HtmlTextMode {
    /**
     * Uses [Element.text] for extracting.
     * Gets the normalized, combined text of this element and all its children. Whitespace is normalized and trimmed.
     *
     * For example, given HTML `

Hello there now!

`, `p.text()` returns `"Hello there now!"` * * Default mode in [Kspoon] instance. */ Text, /** * Uses [Element.html] for extracting. * Retrieves the element's inner HTML. E.g. on a `
` with one empty `

`, would return * `

` */ InnerHtml, /** * Uses [Element.outerHtml] for extracting. * Get the outer HTML of this node. For example, on a `p` element, may return `

Para

`. * `

` */ OuterHtml, /** * Uses [Element.data] for extracting. * Get the combined data of this element. Data is e.g. the inside of a