edoc在hrl文件中没有生成所有文档类型?

3

我目前有三个文件:

tempfile.hrl

-export_type([temptype/0]).
-type temptype() :: string().
%% blah blah documentation

tempfile.erl

-module(tempfile).

... more code, but no references to the temptype() type.

random.erl

-module(random).
%% @headerfile "tempfile.hrl"
-include("tempfile.hrl").

-spec random() -> tempfile:temptype().

然而,当使用edoc时,temptype()的文档没有出现。有一个到tempfile.html#temptype的超链接,但它链接到了空白页。我甚至尝试使用-export_type,但那也没有起作用...可能是什么问题?谢谢。
2个回答

1

temptype()不是tempfile模块的一部分。

您可以将声明包含到tempfile模块中。

-export_type([temptype/0]).
-type temptype() :: string().

您不需要拥有一个tempfile.hrl文件。

=>

tempfile.erl

-module(tempfile).
-export_type([temptype/0]).
-type temptype() :: string().

random.erl

-module(random).

-spec random() -> tempfile:temptype().

0

如果您确实想要将头文件保持独立,可以使用通用的@headerfile标签来导入Erlang文件中的标签,如下所示:

tempfile.erl

-module(tempfile).

%%% @headerfile tempfile.hrl
... more code, but no references to the temptype() type.

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接