aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt27
-rw-r--r--core/src/test/kotlin/format/JavaLayoutHtmlFormatTest.kt8
-rw-r--r--core/testdata/format/java-layout-html/sections.kt15
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