aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/HtmlTemplateService.kt
blob: b9900757c3171459493c98e19f38072b56f6c350 (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 interface HtmlTemplateService {
    fun appendHeader(to: StringBuilder, title: String?)
    fun appendFooter(to: StringBuilder)

    companion 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>")
                }
            }
        }
    }
}