1 package net.pterodactylus.sone.web.page
3 import freenet.clients.http.*
5 class PageMakerInteraction(toadletContext: ToadletContext, pageTitle: String) {
7 private val pageMaker: PageMaker = toadletContext.pageMaker
8 private val pageNode: PageNode = pageMaker.getPageNode(pageTitle, toadletContext)
10 fun addStyleSheet(styleSheet: String) {
11 pageNode.addCustomStyleSheet(styleSheet)
14 fun addLinkNode(linkAttributes: Map<String, String>) {
15 pageNode.headNode.addChild("link").let {
16 linkAttributes.forEach(it::addAttribute)
20 fun addShortcutIcon(shortcutIcon: String) {
21 pageNode.addForwardLink("icon", shortcutIcon)
24 fun setContent(content: String) {
25 pageNode.content.addChild("%", content)
28 fun renderPage(): String =
29 pageNode.outer.generate()