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

com.github.woojiahao.conversion_handlers.IConversionHandler.kt Maven / Gradle / Ivy

package com.github.woojiahao.conversion_handlers

import com.github.kittinunf.result.Result
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import java.io.File

abstract class IConversionHandler(
  protected val html: String,
  protected val css: String,
  protected val targetLocation: File,
  protected val extra: Map = emptyMap()
) {
  abstract fun generateHtml(extra: Map = emptyMap()): String
  abstract fun convert(): Result

  protected fun htmlToXML(html: String) =
    Jsoup
      .parse(html)
      .apply { outputSettings().syntax(Document.OutputSettings.Syntax.xml) }
      .let { it.html().replace(" ", " ") }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy