diff options
Diffstat (limited to 'plugins')
3 files changed, 51 insertions, 3 deletions
diff --git a/plugins/base/src/main/kotlin/parsers/Parser.kt b/plugins/base/src/main/kotlin/parsers/Parser.kt index 706f093b..894fa82f 100644 --- a/plugins/base/src/main/kotlin/parsers/Parser.kt +++ b/plugins/base/src/main/kotlin/parsers/Parser.kt @@ -43,7 +43,9 @@ abstract class Parser { private fun jkdocToListOfPairs(javadoc: String): List<Pair<String, String>> = "description $javadoc" .split("\n@") - .map { - it.substringBefore(' ') to it.substringAfter(' ') + .map { content -> + val contentWithEscapedAts = content.replace("\\@", "@") + val (tag, body) = contentWithEscapedAts.split(" ", limit = 2) + tag to body } } diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt index f8eba2fe..f67d73bb 100644 --- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt +++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt @@ -7,6 +7,7 @@ import org.jetbrains.dokka.base.transformers.pages.sourcelinks.SourceLinksTransf import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder import org.jetbrains.dokka.model.WithGenerics import org.jetbrains.dokka.model.dfs +import org.jetbrains.dokka.model.doc.Text import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest @@ -273,4 +274,42 @@ class LinkableContentTest : AbstractCoreTest() { } } } + + @Test + fun `Include module and package documentation with codeblock`() { + + val testDataDir = getTestDataDir("multiplatform/basicMultiplatformTest").toAbsolutePath() + val includesDir = getTestDataDir("linkable/includes").toAbsolutePath() + + val configuration = dokkaConfiguration { + moduleName = "example" + sourceSets { + sourceSet { + analysisPlatform = "js" + sourceRoots = listOf("jsMain", "commonMain", "jvmAndJsSecondCommonMain").map { + Paths.get("$testDataDir/$it/kotlin").toString() + } + name = "js" + includes = listOf(Paths.get("$includesDir/include2.md").toString()) + } + sourceSet { + analysisPlatform = "jvm" + sourceRoots = listOf("jvmMain", "commonMain", "jvmAndJsSecondCommonMain").map { + Paths.get("$testDataDir/$it/kotlin").toString() + } + name = "jvm" + includes = listOf(Paths.get("$includesDir/include1.md").toString()) + } + } + } + + testFromData(configuration) { + documentablesMergingStage = { + Assertions.assertNotEquals(null, it.packages.first().documentation.values.single().dfs { + (it as? Text)?.body?.contains("@SqlTable") ?: false + }) + } + } + + } } diff --git a/plugins/base/src/test/resources/linkable/includes/include1.md b/plugins/base/src/test/resources/linkable/includes/include1.md index 03d9037d..09882ec1 100644 --- a/plugins/base/src/test/resources/linkable/includes/include1.md +++ b/plugins/base/src/test/resources/linkable/includes/include1.md @@ -4,4 +4,11 @@ This is JVM documentation for module example # Package example -This is JVM documentation for package example
\ No newline at end of file +This is JVM documentation for package example + +## Example + +```kotlin +\@SqlTable(People::class) +class Person(val name: String, uuid: UUID = UUID.randomUUID()) : Entity(uuid) +``` |