aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/HtmlFormatService.kt
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 15:00:33 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 15:00:33 +0400
commita0bfdbd8cc365cb11c26e81ee7587f0ec25df79d (patch)
treec68610d2003d2a4712b3fbc95561ac20390a161d /src/Formats/HtmlFormatService.kt
parent6168541bd5bb141c40a1e2a909afa84441b35ed5 (diff)
downloaddokka-a0bfdbd8cc365cb11c26e81ee7587f0ec25df79d.tar.gz
dokka-a0bfdbd8cc365cb11c26e81ee7587f0ec25df79d.tar.bz2
dokka-a0bfdbd8cc365cb11c26e81ee7587f0ec25df79d.zip
Location services, formatting services, initial self-documentation output.
Diffstat (limited to 'src/Formats/HtmlFormatService.kt')
-rw-r--r--src/Formats/HtmlFormatService.kt62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
new file mode 100644
index 00000000..4a0bca6f
--- /dev/null
+++ b/src/Formats/HtmlFormatService.kt
@@ -0,0 +1,62 @@
+package org.jetbrains.dokka
+
+public class HtmlFormatService(val locationService: LocationService,
+ val signatureGenerator: SignatureGenerator) : FormatService {
+ override val extension: String = "html"
+ override fun format(node: DocumentationNode, to: StringBuilder) {
+ with (to) {
+ appendln("<h2>")
+ appendln("Summary for ${node.name}")
+ appendln("</h2>")
+ appendln("<code>")
+ appendln(signatureGenerator.render(node))
+ appendln("</code>")
+ appendln()
+ appendln("<p>")
+ appendln(node.doc.summary)
+ appendln("</p>")
+ appendln("<hr/>")
+
+ for (section in node.doc.sections) {
+ appendln("<h3>")
+ appendln(section.label)
+ appendln("</h3>")
+ appendln("<p>")
+ appendln(section.text)
+ appendln("</p>")
+ }
+
+ appendln("<h3>")
+ appendln("Members")
+ appendln("</h3>")
+ appendln("<table>")
+
+ appendln("<thead>")
+ appendln("<tr>")
+ appendln("<td>Member</td>")
+ appendln("<td>Signature</td>")
+ appendln("<td>Summary</td>")
+ appendln("</tr>")
+ appendln("</thead>")
+
+ appendln("<tbody>")
+ for (member in node.members.sortBy { it.name }) {
+ val relativePath = locationService.relativeLocation(node, member, extension)
+ appendln("<tr>")
+ appendln("<td>")
+ append("<a href=\"${relativePath}\">${member.name}</a>")
+ appendln("</td>")
+ appendln("<td>")
+ append("${signatureGenerator.render(member)}")
+ appendln("</td>")
+ appendln("<td>")
+ append("${member.doc.summary}")
+ appendln("</td>")
+ appendln("</tr>")
+ }
+ appendln("</tbody>")
+ appendln("</table>")
+
+ }
+ }
+} \ No newline at end of file