简体   繁体   English

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

[英]edoc not generating all documentation types in hrl file?

I currently have three files: 我目前有三个文件:

tempfile.hrl tempfile.hrl

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

tempfile.erl tempfile.erl

-module(tempfile).

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

random.erl random.erl

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

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

However when using edoc, none of the documentation for temptype() appears. 但是,在使用edoc时,不会出现temptype()任何文档。 A hyperlink to tempfile.html#temptype appears, but it links to nowhere. 出现了一个指向tempfile.html#temptype超链接,但它链接到无处。 I even tried to use -export_type but that didn't work... What could be the issue? 我甚至尝试使用-export_type但这不起作用......可能是什么问题? Thanks. 谢谢。

temptype() is not part of the module tempfile. temptype()不是模块tempfile的一部分。

What you can do is to include the declaration into the tempfile module. 您可以做的是将声明包含在tempfile模块中。

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

You don't have to have a tempfile.hrl then. 您不必拥有tempfile.hrl。

=> =>

tempfile.erl tempfile.erl

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

random.erl random.erl

-module(random).

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

If you do want to keep the header file separate, the generic @headerfile tag can be used to import tags from an Erlang file like this: 如果您确实希望将头文件保持独立,可以使用通用的@headerfile标记从Erlang文件中导入标记,如下所示:

tempfile.erl tempfile.erl

-module(tempfile).

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM