diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-09-10 13:43:53 +0200 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-09-10 13:43:53 +0200 |
commit | 8050cf6b6f7205a44ad0adebeaa19e202607f91d (patch) | |
tree | b5ab9e9ab2df2654fb93f3b49b8208a8c712d257 /src/Model/PackageDocs.kt | |
parent | aace0f39335c7428ffcfd44cbe1371ecc32ddd08 (diff) | |
download | dokka-8050cf6b6f7205a44ad0adebeaa19e202607f91d.tar.gz dokka-8050cf6b6f7205a44ad0adebeaa19e202607f91d.tar.bz2 dokka-8050cf6b6f7205a44ad0adebeaa19e202607f91d.zip |
fix package docs parsing, add test
Diffstat (limited to 'src/Model/PackageDocs.kt')
-rw-r--r-- | src/Model/PackageDocs.kt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Model/PackageDocs.kt b/src/Model/PackageDocs.kt index b5ef2126..68b4dcc1 100644 --- a/src/Model/PackageDocs.kt +++ b/src/Model/PackageDocs.kt @@ -5,7 +5,7 @@ import org.intellij.markdown.MarkdownTokenTypes import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import java.io.File -public class PackageDocs(val documentationBuilder: DocumentationBuilder, +public class PackageDocs(val documentationBuilder: DocumentationBuilder?, val linkResolveContext: DeclarationDescriptor?, val logger: DokkaLogger) { public val moduleContent: MutableContent = MutableContent() @@ -21,9 +21,9 @@ public class PackageDocs(val documentationBuilder: DocumentationBuilder, var targetContent: MutableContent = moduleContent tree.children.forEach { if (it.type == MarkdownElementTypes.ATX_1) { - val headingText = it.child(MarkdownTokenTypes.TEXT)?.text + val headingText = it.child(MarkdownTokenTypes.ATX_CONTENT)?.text if (headingText != null) { - targetContent = findTargetContent(headingText) + targetContent = findTargetContent(headingText.trimStart()) } } else { buildContentTo(it, targetContent, { resolveContentLink(it) }) @@ -48,7 +48,7 @@ public class PackageDocs(val documentationBuilder: DocumentationBuilder, _packageContent.getOrPut(packageName) { -> MutableContent() } private fun resolveContentLink(href: String): ContentBlock { - if (linkResolveContext != null) { + if (linkResolveContext != null && documentationBuilder != null) { return documentationBuilder.resolveContentLink(linkResolveContext, href) } return ContentExternalLink("#") |