com.github.woojiahao.style.elements.document.DocumentText.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kMD2PDF Show documentation
Show all versions of kMD2PDF Show documentation
Simple and highly customizable markdown to PDF conversion library
package com.github.woojiahao.style.elements.document
import com.github.woojiahao.style.elements.Element
class DocumentText(elementName: String) : Element(elementName) {
private val contents = mutableListOf()
var hasPageNumber = false
private set
var pageNumberPrepend = ""
private set
var pageNumberAppend = ""
private set
operator fun String.unaryPlus() = contents.add(this)
fun pageNumber(prepend: String = "", append: String = "") {
hasPageNumber = true
pageNumberPrepend = prepend
pageNumberAppend = append
}
fun getContents() = contents.joinToString("\n")
}