Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some un-needed verbosity when processing DocTrees. #1218

Merged
merged 7 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions api-doclet/src/main/kotlin/org/conscrypt/doclet/ClassInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ data class ClassInfo(val element: TypeElement) : Comparable<ClassInfo> {

private fun description() = html {
div("class-description") {
compose { element.commentTree() + element.tagTree() }
compose {
element.commentsAndTagTrees()
}
}
}

Expand All @@ -43,7 +45,7 @@ data class ClassInfo(val element: TypeElement) : Comparable<ClassInfo> {
div("member") {
h4(field.simpleName.toString())
compose {
field.commentTree() + field.tagTree()
field.commentsAndTagTrees()
}
}
}
Expand All @@ -58,7 +60,7 @@ data class ClassInfo(val element: TypeElement) : Comparable<ClassInfo> {
div("member") {
h4(cls.simpleName.toString())
compose {
cls.commentTree() + cls.tagTree()
cls.commentsAndTagTrees()
}
}
}
Expand Down
19 changes: 4 additions & 15 deletions api-doclet/src/main/kotlin/org/conscrypt/doclet/DocTreeUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,7 @@ fun Element.throwTags() = filterTags<ThrowsTree>()
.map { it.exceptionName.toString() to renderDocTreeList(it.description) }
.toList()

fun Element.docTree(): DocCommentTree? {
return docTrees.getDocCommentTree(this)
}

fun Element.commentTree() = html {
text {
docTree()?.let { renderDocTreeList(it.fullBody) } ?: ""
}
}

fun Element.tagTree() = html {
text {
docTree()?.let { renderBlockTagList(it.blockTags) } ?: ""
}
}
fun Element.docTree(): DocCommentTree? = docTrees.getDocCommentTree(this)
fun Element.commentTree() = docTree()?.let { renderDocTreeList(it.fullBody) } ?: ""
fun Element.tagTree() = docTree()?.let { renderBlockTagList(it.blockTags) } ?: ""
fun Element.commentsAndTagTrees() = commentTree() + tagTree()
Loading