diff options
| author | Dmitry Jemerov <intelliyole@gmail.com> | 2015-01-30 19:04:34 +0100 |
|---|---|---|
| committer | Dmitry Jemerov <intelliyole@gmail.com> | 2015-01-30 19:04:34 +0100 |
| commit | b5286f576f470ad1665a7b1acc9ea276bc1a0c18 (patch) | |
| tree | 5cf3800e961b9da84b2db03707603865496f5ed0 /src/Analysis | |
| parent | b55b258574a01a02f906f5f12646ecacfc640e20 (diff) | |
| parent | 0fac1d925b74f24002a4e1538088ce66c4b02cb9 (diff) | |
| download | dokka-b5286f576f470ad1665a7b1acc9ea276bc1a0c18.tar.gz dokka-b5286f576f470ad1665a7b1acc9ea276bc1a0c18.tar.bz2 dokka-b5286f576f470ad1665a7b1acc9ea276bc1a0c18.zip | |
Merge pull request #24 from orangy/sections-rewrite
Use KDoc PSI instead of custom Markdown extensions to parse KDoc into sections
Diffstat (limited to 'src/Analysis')
| -rw-r--r-- | src/Analysis/CommentsAPI.kt | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/Analysis/CommentsAPI.kt b/src/Analysis/CommentsAPI.kt deleted file mode 100644 index ce453113..00000000 --- a/src/Analysis/CommentsAPI.kt +++ /dev/null @@ -1,41 +0,0 @@ -package org.jetbrains.dokka - -import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.resolve.* -import org.jetbrains.kotlin.kdoc.psi.api.* - -/** - * Retrieves PSI elements representing documentation from the [DeclarationDescriptor] - * - * $$receiver: [DeclarationDescriptor] to get documentation nodes from - */ -fun DeclarationDescriptor.getDocumentationElements(): List<KDoc> { - val psiElement = DescriptorToSourceUtils.descriptorToDeclaration(this) - if (psiElement == null) - return listOf() - - return psiElement.children() // visit children - .takeWhile { it is KDoc } // all KDoc - .map { it as KDoc } // cast - .toList() - .reverse() // make reversed list -} - -/** - * Extracts text from KDoc, removes comment symbols and trims whitespace - */ -fun KDoc?.extractText(): String { - if (this == null) - return "" - val text = getText() - if (text == null) - return "" - val lines = text.replace("\r", "").split("\n") - return lines.map { - val comment = it.trim().dropWhile { it == '/' || it == '*' } - (if (comment.endsWith("*/")) - comment.substring(0, comment.length() - 2) - else - comment).trim() - }.join("\n").trim("\n") -}
\ No newline at end of file |
