diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-12-22 09:50:17 +0200 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-12-22 09:50:17 +0200 |
commit | 18399493263820cf6098603025802ddf862f1920 (patch) | |
tree | b8c915c272cdc484df2b511ad50a9ff829c33612 /src/Analysis/CommentsAPI.kt | |
parent | bd6cddd932c308519ce386197b93de145462bec2 (diff) | |
download | dokka-18399493263820cf6098603025802ddf862f1920.tar.gz dokka-18399493263820cf6098603025802ddf862f1920.tar.bz2 dokka-18399493263820cf6098603025802ddf862f1920.zip |
Document some types in Dokka and fix to make them work.
Diffstat (limited to 'src/Analysis/CommentsAPI.kt')
-rw-r--r-- | src/Analysis/CommentsAPI.kt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Analysis/CommentsAPI.kt b/src/Analysis/CommentsAPI.kt index 215f3e98..5f3f6283 100644 --- a/src/Analysis/CommentsAPI.kt +++ b/src/Analysis/CommentsAPI.kt @@ -5,6 +5,11 @@ import org.jetbrains.jet.lang.resolve.* import org.jetbrains.jet.kdoc.psi.api.* import org.jetbrains.jet.lang.psi.* +/** + * 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) @@ -17,6 +22,9 @@ fun DeclarationDescriptor.getDocumentationElements(): List<KDoc> { .reverse() // make reversed list } +/** + * Extracts text from KDoc, removes comment symbols and trims whitespace + */ fun KDoc?.extractText(): String { if (this == null) return "" @@ -27,7 +35,7 @@ fun KDoc?.extractText(): String { return lines.map { val comment = it.trim().dropWhile { it == '/' || it == '*' } (if (comment.endsWith("*/")) - comment.substring(0, comment.length - 2) + comment.substring(0, comment.length() - 2) else comment).trim() }.join("\n") |