diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2016-01-12 19:37:31 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2016-01-12 19:37:31 +0100 |
commit | 6cccf161648881e7285694a6b0893b73abbde9fb (patch) | |
tree | d1f06745c98b1174ce7b7864521e8fa9dfe87982 | |
parent | 8640e513391f3a3c9909396d45795543f01e87d2 (diff) | |
download | dokka-6cccf161648881e7285694a6b0893b73abbde9fb.tar.gz dokka-6cccf161648881e7285694a6b0893b73abbde9fb.tar.bz2 dokka-6cccf161648881e7285694a6b0893b73abbde9fb.zip |
don't sort enum values alphabetically (https://github.com/Kotlin/dokka/issues/47)
-rw-r--r-- | core/src/main/kotlin/Formats/StructuredFormatService.kt | 6 | ||||
-rw-r--r-- | core/testdata/format/enumClass.kt | 4 | ||||
-rw-r--r-- | core/testdata/format/enumClass.md | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index c9218c46..85b7d3c1 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -299,7 +299,7 @@ abstract class StructuredFormatService(locationService: LocationService, appendSection("Annotations", node.members(NodeKind.AnnotationClass)) appendSection("Exceptions", node.members(NodeKind.Exception)) appendSection("Extensions for External Classes", node.members(NodeKind.ExternalClass)) - appendSection("Enum Values", node.members(NodeKind.EnumItem)) + appendSection("Enum Values", node.members(NodeKind.EnumItem), sortMembers = false) appendSection("Constructors", node.members(NodeKind.Constructor)) appendSection("Properties", node.members(NodeKind.Property)) appendSection("Inherited Properties", node.inheritedMembers(NodeKind.Property)) @@ -345,12 +345,12 @@ abstract class StructuredFormatService(locationService: LocationService, } } - private fun appendSection(caption: String, members: List<DocumentationNode>) { + private fun appendSection(caption: String, members: List<DocumentationNode>, sortMembers: Boolean = true) { if (members.isEmpty()) return appendHeader(to, caption, 3) - val children = members.sortedBy { it.name } + val children = if (sortMembers) members.sortedBy { it.name } else members val membersMap = children.groupBy { link(node, it) } appendTable(to) { diff --git a/core/testdata/format/enumClass.kt b/core/testdata/format/enumClass.kt index c1af69d8..3c2a49fc 100644 --- a/core/testdata/format/enumClass.kt +++ b/core/testdata/format/enumClass.kt @@ -1,4 +1,4 @@ public enum class InlineOption { - LOCAL_CONTINUE_AND_BREAK, - ONLY_LOCAL_RETURN + ONLY_LOCAL_RETURN, + LOCAL_CONTINUE_AND_BREAK } diff --git a/core/testdata/format/enumClass.md b/core/testdata/format/enumClass.md index 7a0e03ff..4f390dab 100644 --- a/core/testdata/format/enumClass.md +++ b/core/testdata/format/enumClass.md @@ -10,6 +10,6 @@ ### Enum Values -| [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) | | | [ONLY_LOCAL_RETURN](test/-inline-option/-o-n-l-y_-l-o-c-a-l_-r-e-t-u-r-n) | | +| [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) | | |