Skip to content

Commit

Permalink
Fix generating search_data.json for undocumented Erlang functions
Browse files Browse the repository at this point in the history
  • Loading branch information
starbelly committed Aug 7, 2023
1 parent a67fed1 commit 4114bbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/ex_doc/formatter/html/search_data.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ defmodule ExDoc.Formatter.HTML.SearchData do
extract_sections_from_markdown(doc)
end

defp extract_sections("application/erlang+html", %{rendered_doc: nil}) do
{nil, []}
end

defp extract_sections("application/erlang+html", %{rendered_doc: doc}) do
{clean_html(doc), []}
end
Expand Down
5 changes: 4 additions & 1 deletion test/ex_doc/formatter/html/erlang_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ defmodule ExDoc.Formatter.HTML.ErlangTest do
%% @doc
%% foo module.
-module(foo).
-export([foo/1]).
-export([foo/1, bar/0]).
-export_type([t/0]).
%% @doc
%% f/0 function.
-spec foo(atom()) -> atom().
foo(X) -> X.
-spec bar() -> baz.
bar() -> baz.
-type t() :: atom().
%% t/0 type.
""")
Expand Down

0 comments on commit 4114bbf

Please sign in to comment.