diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-05-12 16:35:42 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-05-15 17:54:09 +0300 |
commit | fbfaef6a9abdb6743e7e6f9f9bbe7c72595ce0c2 (patch) | |
tree | 8da2c6de1fedf98e7a5781b10202bde602548c55 /core/src | |
parent | 17c87f18f03b2c31b68251b17cbfa2531e0bd63c (diff) | |
download | dokka-fbfaef6a9abdb6743e7e6f9f9bbe7c72595ce0c2.tar.gz dokka-fbfaef6a9abdb6743e7e6f9f9bbe7c72595ce0c2.tar.bz2 dokka-fbfaef6a9abdb6743e7e6f9f9bbe7c72595ce0c2.zip |
Fix parsing of line breaks inside javadoc comments
#141 fixed
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/Java/JavadocParser.kt | 1 | ||||
-rw-r--r-- | core/src/main/kotlin/Model/Content.kt | 6 | ||||
-rw-r--r-- | core/src/main/kotlin/javadoc/tags.kt | 7 |
3 files changed, 11 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt index af45f150..c25f5813 100644 --- a/core/src/main/kotlin/Java/JavadocParser.kt +++ b/core/src/main/kotlin/Java/JavadocParser.kt @@ -94,6 +94,7 @@ class JavadocParser(private val refGraph: NodeReferenceGraph, "ol" -> ContentOrderedList() "li" -> ContentListItem() "a" -> createLink(element) + "br" -> ContentBlock().apply { hardLineBreak() } else -> ContentBlock() } diff --git a/core/src/main/kotlin/Model/Content.kt b/core/src/main/kotlin/Model/Content.kt index c8585418..1f5bbc83 100644 --- a/core/src/main/kotlin/Model/Content.kt +++ b/core/src/main/kotlin/Model/Content.kt @@ -89,6 +89,11 @@ abstract class ContentNodeLink() : ContentBlock() { abstract val node: DocumentationNode? } +object ContentHardLineBreak : ContentNode { + override val textLength: Int + get() = 0 +} + class ContentNodeDirectLink(override val node: DocumentationNode): ContentNodeLink() { override fun equals(other: Any?): Boolean = super.equals(other) && other is ContentNodeDirectLink && node.name == other.node.name @@ -153,6 +158,7 @@ fun ContentBlock.identifier(value: String, kind: IdentifierKind = IdentifierKind fun ContentBlock.nbsp() = append(ContentNonBreakingSpace) fun ContentBlock.softLineBreak() = append(ContentSoftLineBreak) fun ContentBlock.indentedSoftLineBreak() = append(ContentIndentedSoftLineBreak) +fun ContentBlock.hardLineBreak() = append(ContentHardLineBreak) fun ContentBlock.strong(body: ContentBlock.() -> Unit) { val strong = ContentStrong() diff --git a/core/src/main/kotlin/javadoc/tags.kt b/core/src/main/kotlin/javadoc/tags.kt index b9ba7382..05d98b71 100644 --- a/core/src/main/kotlin/javadoc/tags.kt +++ b/core/src/main/kotlin/javadoc/tags.kt @@ -217,10 +217,11 @@ private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, node: Conten is Content -> { surroundWith(module, holder, "<p>", "</p>", node.summary, result) surroundWith(module, holder, "<p>", "</p>", node.description, result) -// node.sections.forEach { -// buildInlineTags(module, holder, it, result) -// } } + is ContentBlock -> { + surroundWith(module, holder, "", "", node, result) + } + is ContentHardLineBreak -> result.add(TextTag(holder, ContentText("<br/>"))) else -> result.add(TextTag(holder, ContentText("$node"))) } |