aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt5
-rw-r--r--plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt43
2 files changed, 44 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
index ecf31541..d74a1ca4 100644
--- a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
@@ -377,6 +377,11 @@ class JavadocParser(
"strong" -> ifChildrenPresent { Strong(children) }
"index" -> listOf(Index(children))
"i" -> ifChildrenPresent { I(children) }
+ "img" -> listOf(
+ Img(
+ children,
+ element.attributes().associate { (if (it.key == "src") "href" else it.key) to it.value })
+ )
"em" -> listOf(Em(children))
"code" -> ifChildrenPresent { if(keepFormatting) CodeBlock(children) else CodeInline(children) }
"pre" -> if(children.size == 1) {
diff --git a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
index bdb1af86..e6e1e105 100644
--- a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
+++ b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
@@ -4,11 +4,8 @@ import com.jetbrains.rd.util.first
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.DEnum
import org.jetbrains.dokka.model.DModule
-import org.jetbrains.dokka.model.doc.CodeBlock
-import org.jetbrains.dokka.model.doc.CodeInline
+import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.model.doc.P
-import org.jetbrains.dokka.model.doc.Pre
-import org.jetbrains.dokka.model.doc.Text
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import utils.*
@@ -214,4 +211,42 @@ class JavadocParserTest : BaseAbstractTest() {
}
}
}
+
+ @Test
+ fun `html img tag`() {
+ val source = """
+ |/src/main/kotlin/test/Test.java
+ |package example
+ |
+ | /**
+ | * <img src="/path/to/img.jpg" alt="Alt text"/>
+ | */
+ | public class Test {}
+ """.trimIndent()
+ testInline(
+ source,
+ configuration,
+ ) {
+ documentablesCreationStage = { modules ->
+ val docs = modules.first().packages.first().classlikes.single().documentation.first().value
+ val root = docs.children.first().root
+
+ kotlin.test.assertEquals(
+ listOf(
+ P(
+ children = listOf(
+ Img(
+ params = mapOf(
+ "href" to "/path/to/img.jpg",
+ "alt" to "Alt text"
+ )
+ )
+ )
+ )
+ ),
+ root.children
+ )
+ }
+ }
+ }
}