[erlang-questions] edoc: documenting "-type"

Serge Aleynikov serge@REDACTED
Fri Feb 1 16:20:36 CET 2013


I have a similar question. In the following test module the generated
documentation for proto() type includes proper comment, but the
options() doc doesn't include comment.  It seems to be immaterial if "%%
Protocol options." appear on the same line as the ending "]." of the
options() type or the next line. Why is the edoc generator doesn't
include comment for the options() type?

-module(test).
-export([t/2]).

-type proto() :: tcp | ssl.
%% Protocol type.

-type options() :: [
          {server, Server::string()}
        | {port, Port::integer()}
        ].
%% Protocol options.
%%     * Server - server to connect to (no MX lookup)
%%     * Relay  - domain to do MX lookup of list of servers

-spec t(Proto :: proto(), Options :: options()) -> ok.
t(_Proto, _Options) -> ok.


Segment of relevant generated docs:

<h3 class="typedecl"><a name="type-options">options()</a></h3>
<p><pre>options() =
    [{server, Server :: string()} | {port, Port :: integer()}]</pre></p>

<h3 class="typedecl"><a name="type-proto">proto()</a></h3>
<p><pre>proto() = tcp | ssl</pre></p>
<p>  Protocol type.</p>




>     On Wednesday, July 13, 2011 1:30:43 PM UTC+4, Lukas Larsson wrote:
>         Hi,
> 
>         It is not supported via the traditional edoc syntax, however it
>         is supported by the new type documentation generation. If you write
> 
>         -type key() :: binary() | atom().
>         %% This type is awesome.  Really, it is great.
> 
>         The comment below the type will be included in the generated edoc.
> 
>         Lukas



More information about the erlang-questions mailing list