aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2021-12-07 18:13:29 +0300
committerIgnat Beresnev <ignat.beresnev@jetbrains.com>2021-12-07 18:13:29 +0300
commit349d841a31a172c810c864725d1d5b0b23bc96be (patch)
tree6f455a872a67cb0741acf790bea5700f59003a97 /plugins/base/src
parentc68c05a1e8876e9b8555df7bcdfeaca3e100f0d1 (diff)
downloaddokka-349d841a31a172c810c864725d1d5b0b23bc96be.tar.gz
dokka-349d841a31a172c810c864725d1d5b0b23bc96be.tar.bz2
dokka-349d841a31a172c810c864725d1d5b0b23bc96be.zip
Support deeply nested description terms and details
Diffstat (limited to 'plugins/base/src')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt22
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt2
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt2
4 files changed, 19 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 304b96fa..727b009c 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -111,6 +111,12 @@ open class HtmlRenderer(
) { childrenCallback() }
node.extra[InsertTemplateExtra] != null -> node.extra[InsertTemplateExtra]?.let { templateCommand(it.command) }
?: Unit
+ node.hasStyle(ListStyle.DescriptionTerm) -> DT(emptyMap(), consumer).visit {
+ this@wrapGroup.childrenCallback()
+ }
+ node.hasStyle(ListStyle.DescriptionDetails) -> DD(emptyMap(), consumer).visit {
+ this@wrapGroup.childrenCallback()
+ }
else -> childrenCallback()
}
}
@@ -294,12 +300,16 @@ open class HtmlRenderer(
node: ContentList,
pageContext: ContentPage,
sourceSetRestriction: Set<DisplaySourceSet>?
- ) = if (node.ordered) {
- ol { buildListItems(node.children, pageContext, sourceSetRestriction) }
- } else if (node.hasStyle(ListStyle.DescriptionList)) {
- dl { buildListItems(node.children, pageContext, sourceSetRestriction) }
- } else {
- ul { buildListItems(node.children, pageContext, sourceSetRestriction) }
+ ) = when {
+ node.ordered -> {
+ ol { buildListItems(node.children, pageContext, sourceSetRestriction) }
+ }
+ node.hasStyle(ListStyle.DescriptionList) -> {
+ dl { buildListItems(node.children, pageContext, sourceSetRestriction) }
+ }
+ else -> {
+ ul { buildListItems(node.children, pageContext, sourceSetRestriction) }
+ }
}
open fun DL.buildListItems(
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
index 2b4317c5..c38edea8 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
@@ -46,7 +46,7 @@ open class DocTagToContentConverter : CommentsToContentConverter {
ordered,
dci,
sourceSets.toDisplaySourceSets(),
- if (newStyles.isEmpty()) styles else styles + newStyles,
+ styles + newStyles,
((PropertyContainer.empty<ContentNode>()) + SimpleAttr("start", start.toString()))
)
)
diff --git a/plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt b/plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt
index d578ba5e..8b11dad1 100644
--- a/plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/ListStylesTest.kt
@@ -38,4 +38,4 @@ class ListStylesTest : HtmlRenderingOnlyTestBase() {
)
)
}
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt b/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt
index 6d8730f1..9a77172b 100644
--- a/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt
@@ -473,4 +473,4 @@ class CommentsToContentConverterTest {
}
}
}
-} \ No newline at end of file
+}