aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/HtmlTemplateService.kt
blob: 54bfa3004969a1b629639d1699b8397688bbf1ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.jetbrains.dokka

public trait HtmlTemplateService {
    fun appendHeader(to: StringBuilder, title: String?)
    fun appendFooter(to: StringBuilder)

    class object {
        public fun default(css: String? = null): HtmlTemplateService {
            return object : HtmlTemplateService {
                override fun appendFooter(to: StringBuilder) {
                    to.appendln("</BODY>")
                    to.appendln("</HTML>")
                }
                override fun appendHeader(to: StringBuilder, title: String?) {
                    to.appendln("<HTML>")
                    to.appendln("<HEAD>")
                    if (title != null) {
                        to.appendln("<title>$title</title>")
                    }
                    if (css != null) {
                        to.appendln("<link rel=\"stylesheet\" href=\"$css\">")
                    }
                    to.appendln("</HEAD>")
                    to.appendln("<BODY>")
                }
            }
        }
    }
}