invirt.pebble.InvirtPebbleExtension.kt Maven / Gradle / Ivy
package invirt.pebble
import invirt.pebble.filters.DateWithDaySuffixFilter
import invirt.pebble.functions.*
import invirt.utils.uuid7
import io.pebbletemplates.pebble.extension.AbstractExtension
import io.pebbletemplates.pebble.extension.Filter
import io.pebbletemplates.pebble.extension.Function
import java.time.LocalDate
class InvirtPebbleExtension : AbstractExtension() {
override fun getFunctions(): Map {
return listOf(
pebbleFunction("today") { LocalDate.now() },
pebbleFunction("uuid") { uuid7() },
// Utils
currencyFromMinorUnitFunction,
errorsFunction,
// JSON
jsonFunction,
jsonArrayFunction,
// Request
requestFunction
).associateBy { it.name }
}
override fun getFilters(): Map {
return mapOf(
"dateWithDaySuffix" to DateWithDaySuffixFilter()
)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy