X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetPostAjaxPage.kt;fp=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetPostAjaxPage.kt;h=eb8d8a05678607c3b4092c866e4154dfb59f6714;hp=3c35125c623e769e4c30994124b9fd9ea3a7ea0e;hb=2f4d45dce241da77f5109e97ba497f0dd4d5c1ec;hpb=4ef415ab45a6c4c7410b0a0f9c3f393ffad53da9 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt index 3c35125..eb8d8a0 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt @@ -5,11 +5,10 @@ import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.utils.jsonObject import net.pterodactylus.sone.utils.let import net.pterodactylus.sone.utils.parameters +import net.pterodactylus.sone.utils.render import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest import net.pterodactylus.util.template.Template -import net.pterodactylus.util.template.TemplateContext -import java.io.StringWriter /** * This AJAX handler retrieves information and rendered representation of a [Post]. @@ -42,5 +41,3 @@ class GetPostAjaxPage(webInterface: WebInterface, private val postTemplate: Temp }.let { postTemplate.render(it) } } - -private fun Template.render(templateContext: TemplateContext) = StringWriter().use { it.also { render(templateContext, it) } }.toString()