diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-02-02 21:27:06 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-02-02 21:27:06 +0300 |
commit | 4d0496a1ddca7e62f40737fffa1d2f94c85d197c (patch) | |
tree | 8dc1422fdbcc1edf0c96bbe6db7a6bbd7db4c668 | |
parent | 955e22485813b7ed99ee69fe4a25eb9c4d21a074 (diff) | |
download | dokka-4d0496a1ddca7e62f40737fffa1d2f94c85d197c.tar.gz |
Take See Also into additional section, fix section headers
Looks like Returns section minor broken (doesn't contain return type)
3 files changed, 47 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt index d5f2039a2..ba662831f 100644 --- a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt +++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt @@ -626,13 +626,34 @@ open class JavaLayoutHtmlFormatOutputBuilder( code { +value } } } - for ((name, sections) in node.content.sections.groupBy { it.tag }) { + + val sectionsByTag = node.content.sections.groupByTo(mutableMapOf()) { it.tag } + + sectionsByTag.remove(ContentTags.SeeAlso)?.let { subjects -> + p { b { +"See Also" } } + ul { + subjects.forEach { + li { code { metaMarkup(it.children.flatMap { (it as ContentParagraph).children }) } } + } + } + } + + for ((name, sections) in sectionsByTag) { table { - thead { tr { td { h3 { +name } } } } + thead { + tr { + th { + colSpan = "2" + +name + } + } + } tbody { sections.forEach { tr { - td { it.subjectName?.let { +it } } + if (it.subjectName != null) { + td { +it.subjectName } + } td { metaMarkup(it.children) } diff --git a/core/src/test/kotlin/format/JavaLayoutHtmlFormatTest.kt b/core/src/test/kotlin/format/JavaLayoutHtmlFormatTest.kt index fae8f275d..36baa6adf 100644 --- a/core/src/test/kotlin/format/JavaLayoutHtmlFormatTest.kt +++ b/core/src/test/kotlin/format/JavaLayoutHtmlFormatTest.kt @@ -53,6 +53,14 @@ class JavaLayoutHtmlFormatTest : JavaLayoutHtmlFormatTestCase() { } } + + @Test + fun sections() { + verifyNode("sections.kt", noStdlibLink = true) { model -> + model.members.single().members.filter { it.name == "sectionsTest" } + } + } + @Test fun constJava() { verifyNode("ConstJava.java", noStdlibLink = true) diff --git a/core/testdata/format/java-layout-html/sections.kt b/core/testdata/format/java-layout-html/sections.kt new file mode 100644 index 000000000..51358d2f0 --- /dev/null +++ b/core/testdata/format/java-layout-html/sections.kt @@ -0,0 +1,15 @@ +package foo + +/** + * @throws ArrayOutOfBoundsException sometimes + * @return It's simple void + * @see foo.seeMeAlso + */ +fun sectionsTest(): Unit { + println("!") +} + + +fun seeMeAlso() { + +}
\ No newline at end of file |