diff --git a/lib/ex_doc/language/erlang.ex b/lib/ex_doc/language/erlang.ex index 0cfa1fea7..0d1ce48da 100644 --- a/lib/ex_doc/language/erlang.ex +++ b/lib/ex_doc/language/erlang.ex @@ -215,6 +215,10 @@ defmodule ExDoc.Language.Erlang do binary end + defp walk_doc({:code, _attrs, [{:a, _, _, _}], _meta} = ast, _config) do + ast + end + defp walk_doc({:code, attrs, [code], meta} = ast, config) do {text, url} = case parse_autolink(code) do diff --git a/test/ex_doc/language/erlang_test.exs b/test/ex_doc/language/erlang_test.exs index 0a986ce37..8a1cc231d 100644 --- a/test/ex_doc/language/erlang_test.exs +++ b/test/ex_doc/language/erlang_test.exs @@ -124,6 +124,21 @@ defmodule ExDoc.Language.ErlangTest do ~s|array:array()| end + test "abstract types - description", c do + assert autolink_doc("{@type myList(X). A special kind of lists ...}", c) == + ~s|myList(X)| + end + + test "abstract types - description+dot", c do + assert autolink_doc("{@type myList(X, Y).}", c) == + ~s|myList(X, Y)| + end + + test "abstract types - no description", c do + assert autolink_doc("{@type myList()}", c) == + ~s|myList()| + end + test "bad module", c do assert ExUnit.CaptureIO.capture_io(:stderr, fn -> assert autolink_doc("{@link bad}", c) == ~s|bad|