Skip to content

Commit 69c10f0

Browse files
committed
Fix docs for default groups for docs
1 parent d822391 commit 69c10f0

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/ex_doc/retriever.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,10 @@ defmodule ExDoc.Retriever do
285285
defp get_docs_groups(module_groups, nodes_groups, doc_nodes) do
286286
module_groups = Enum.map(module_groups, &normalize_group/1)
287287

288-
# Doc nodes already have normalized groups
289288
nodes_groups_descriptions = Map.new(nodes_groups, &{&1.title, &1.description})
290289

290+
# Doc nodes already have normalized groups
291+
nodes_groups = ExDoc.Utils.natural_sort_by(nodes_groups, & &1.title)
291292
normal_groups = module_groups ++ nodes_groups
292293
nodes_by_group_title = Enum.group_by(doc_nodes, & &1.group)
293294

lib/mix/tasks/docs.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ defmodule Mix.Tasks.Docs do
402402
* First, groups defined as `@moduledoc groups: [...]` in the given order.
403403
* Then groups defined as keys in the `:groups_for_docs` configuration.
404404
* Then default groups: Types, Callbacks and Functions.
405-
* Finally, other groups returned by `:default_group_for_doc` by order of
406-
appearance of their belonging elements.
405+
* Finally, other groups returned by `:default_group_for_doc` by alphabetical
406+
order.
407407
408408
## Meta-tags configuration
409409

test/ex_doc/retriever_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ defmodule ExDoc.RetrieverTest do
7878

7979
config = %ExDoc.Config{}
8080
{[mod], []} = Retriever.docs_from_modules([A], config)
81-
[%{docs: [bar]}, %{docs: [baz]}, %{docs: [foo]}] = mod.docs_groups
81+
[%{docs: [foo]}, %{docs: [bar]}, %{docs: [baz]}] = mod.docs_groups
8282

8383
assert %{id: "c:foo/0", group: "a"} = foo
8484
assert %{id: "bar/0", group: "b"} = bar
@@ -101,7 +101,7 @@ defmodule ExDoc.RetrieverTest do
101101

102102
config = %ExDoc.Config{group_for_doc: & &1[:semi_group]}
103103
{[mod], []} = Retriever.docs_from_modules([A], config)
104-
[%{docs: [bar]}, %{docs: [baz]}, %{docs: [foo]}] = mod.docs_groups
104+
[%{docs: [foo]}, %{docs: [bar]}, %{docs: [baz]}] = mod.docs_groups
105105

106106
assert %{id: "c:foo/0", group: "a"} = foo
107107
assert %{id: "bar/0", group: "b"} = bar

0 commit comments

Comments
 (0)