diff options
-rw-r--r-- | build.gradle | 1 | ||||
-rw-r--r-- | core/build.gradle | 2 | ||||
-rw-r--r-- | core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt | 53 | ||||
-rw-r--r-- | core/src/main/resources/dokka/format/java-layout-html.properties | 2 |
4 files changed, 47 insertions, 11 deletions
diff --git a/build.gradle b/build.gradle index 0002ee69..5772bc5d 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,7 @@ allprojects { maven { url 'https://jitpack.io' } maven { url "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/$bundled_kotlin_compiler_version/maven" } ivy(repo) + maven { url "https://dl.bintray.com/kotlin/kotlinx.html" } } } diff --git a/core/build.gradle b/core/build.gradle index a8f0f275..d37b98b3 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -33,6 +33,8 @@ dependencies { compile intellijCoreAnalysis() + compile 'org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.8' + //tools.jar def toolsJar = files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs().findAll { it.path.endsWith("jar") }) compileOnly toolsJar diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt index c023c477..832c466e 100644 --- a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt +++ b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt @@ -1,7 +1,11 @@ -package org.jetbrains.dokka.formats +package org.jetbrains.dokka.Formats +import com.google.inject.Inject +import kotlinx.html.li +import kotlinx.html.stream.appendHTML +import kotlinx.html.ul import org.jetbrains.dokka.* -import org.jetbrains.dokka.Formats.KotlinFormatDescriptorBase +import java.io.File class JavaLayoutHtmlFormatDescriptor : KotlinFormatDescriptorBase() { @@ -22,24 +26,53 @@ class JavaLayoutHtmlFormatService : FormatService { class JavaLayoutHtmlFormatOutputBuilder : FormattedOutputBuilder { override fun appendNodes(nodes: Iterable<DocumentationNode>) { - TODO("not implemented") + + } +} + + +class JavaLayoutHtmlFormatNavListBuilder @Inject constructor(private val locationService: LocationService) : OutlineFormatService { + override fun getOutlineFileName(location: Location): File { + TODO() + } + + override fun appendOutlineHeader(location: Location, node: DocumentationNode, to: StringBuilder) { + with(to.appendHTML()) { + //a(href = ) + li { + when { + node.kind == NodeKind.Package -> appendOutline(location, to, node.members) + } + } + } + } + + override fun appendOutlineLevel(to: StringBuilder, body: () -> Unit) { + with(to.appendHTML()) { + ul { body() } + } } + } -class JavaLayoutHtmlFormatGenerator : Generator { +class JavaLayoutHtmlFormatGenerator @Inject constructor( + private val outlineFormatService: OutlineFormatService +) : Generator { override fun buildPages(nodes: Iterable<DocumentationNode>) { - TODO("not implemented") + } override fun buildOutlines(nodes: Iterable<DocumentationNode>) { - TODO("not implemented") + for (node in nodes) { + if (node.kind == NodeKind.Module) { + //outlineFormatService.formatOutline() + } + } } - override fun buildSupportFiles() { - TODO("not implemented") - } + override fun buildSupportFiles() {} override fun buildPackageList(nodes: Iterable<DocumentationNode>) { - TODO("not implemented") + } }
\ No newline at end of file diff --git a/core/src/main/resources/dokka/format/java-layout-html.properties b/core/src/main/resources/dokka/format/java-layout-html.properties index c5c6bb15..fbb2bbed 100644 --- a/core/src/main/resources/dokka/format/java-layout-html.properties +++ b/core/src/main/resources/dokka/format/java-layout-html.properties @@ -1,2 +1,2 @@ -class=org.jetbrains.dokka.formats.JavaLayoutHtmlFormatDescriptor +class=org.jetbrains.dokka.Formats.JavaLayoutHtmlFormatDescriptor description=Produces Kotlin Style Docs with Javadoc like layout
\ No newline at end of file |