Skip to content

Commit a000c6c

Browse files
committed
use new struct for node group
1 parent 981f0b0 commit a000c6c

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

Diff for: lib/ex_doc/nodes.ex

+13-10
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ defmodule ExDoc.ModuleNode do
2727

2828
@typep annotation :: atom()
2929

30-
# TODO: Maybe this is worth its own module
31-
@type doc_group :: %{
32-
title: String.t() | atom(),
33-
description: String.t() | nil,
34-
doc: ExDoc.DocAST.t() | nil,
35-
rendered_doc: String.t() | nil
36-
}
37-
3830
@type t :: %__MODULE__{
3931
id: String.t(),
4032
title: String.t(),
@@ -51,7 +43,7 @@ defmodule ExDoc.ModuleNode do
5143
moduledoc_file: String.t(),
5244
source_path: String.t() | nil,
5345
source_url: String.t() | nil,
54-
docs_groups: [doc_group],
46+
docs_groups: [ExDoc.DocGroupNode.t()],
5547
docs: [ExDoc.DocNode.t()],
5648
typespecs: [ExDoc.DocNode.t()],
5749
type: atom(),
@@ -97,9 +89,20 @@ defmodule ExDoc.DocNode do
9789
signature: String.t(),
9890
specs: [ExDoc.Language.spec_ast()],
9991
annotations: [annotation()],
100-
group: String.t() | ExDoc.ModuleNode.doc_group() | nil,
92+
group: String.t() | ExDoc.DocGroupNode.t() | nil,
10193
doc_file: String.t(),
10294
doc_line: non_neg_integer(),
10395
source_url: String.t() | nil
10496
}
10597
end
98+
99+
defmodule ExDoc.DocGroupNode do
100+
defstruct title: nil, description: nil, doc: nil, rendered_doc: nil
101+
102+
@type t :: %__MODULE__{
103+
title: String.t() | atom(),
104+
description: String.t() | nil,
105+
doc: ExDoc.DocAST.t() | nil,
106+
rendered_doc: String.t() | nil
107+
}
108+
end

Diff for: lib/ex_doc/retriever.ex

+3-2
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,12 @@ defmodule ExDoc.Retriever do
305305
text -> doc_ast("text/markdown", %{"en" => text}, [])
306306
end
307307

308-
Map.merge(group, %{
308+
%ExDoc.DocGroupNode{
309+
title: group.title,
309310
description: description,
310311
doc: doc_ast,
311312
rendered_doc: nil
312-
})
313+
}
313314
end
314315

315316
## General helpers

0 commit comments

Comments
 (0)