aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers')
-rw-r--r--plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt9
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt13
2 files changed, 18 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
index 75fbb187..afee1b33 100644
--- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
@@ -74,7 +74,11 @@ abstract class DefaultRenderer<T>(
nodes.forEach { it.build(this, pageContext, sourceSetRestriction) }
}
- open fun T.buildCode(code: ContentCode, pageContext: ContentPage) {
+ open fun T.buildCodeBlock(code: ContentCodeBlock, pageContext: ContentPage) {
+ code.children.forEach { it.build(this, pageContext) }
+ }
+
+ open fun T.buildCodeInline(code: ContentCodeInline, pageContext: ContentPage) {
code.children.forEach { it.build(this, pageContext) }
}
@@ -102,7 +106,8 @@ abstract class DefaultRenderer<T>(
when (node) {
is ContentText -> buildText(node)
is ContentHeader -> buildHeader(node, pageContext, sourceSetRestriction)
- is ContentCode -> buildCode(node, pageContext)
+ is ContentCodeBlock -> buildCodeBlock(node, pageContext)
+ is ContentCodeInline -> buildCodeInline(node, pageContext)
is ContentDRILink ->
buildLink(locationProvider.resolve(node.address, node.sourceSets, pageContext)) {
buildLinkText(node.children, pageContext, sourceSetRestriction)
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 8e18547c..44ca5e20 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -554,8 +554,8 @@ open class HtmlRenderer(
override fun FlowContent.buildLink(address: String, content: FlowContent.() -> Unit) =
a(href = address, block = content)
- override fun FlowContent.buildCode(
- code: ContentCode,
+ override fun FlowContent.buildCodeBlock(
+ code: ContentCodeBlock,
pageContext: ContentPage
) {
div("sample-container") {
@@ -566,6 +566,15 @@ open class HtmlRenderer(
}
}
+ override fun FlowContent.buildCodeInline(
+ code: ContentCodeInline,
+ pageContext: ContentPage
+ ) {
+ code {
+ code.children.forEach { buildContentNode(it, pageContext) }
+ }
+ }
+
private fun getSymbolSignature(page: ContentPage) = page.content.dfs { it.dci.kind == ContentKind.Symbol }
private fun flattenToText(node: ContentNode): String {