%%% @author Saurabh Barjatiya [http://www.sbarjatiya.com] %%% @version 1.0 %%% @copyright 2014 Saurabh Barjatiya %%% @doc This module is used to learn how to use edoc to %%% generate good documentation for erlang modules. %%% To generate documentation using Linux shell use %%% erl -noshell -run edoc_run packages '[""]' '[{source_path, ["."]}, {dir, "documentation"}]' %%% To generate it from erlang shell use: %%% edoc.run([], [], [{source_path, ["."]}, {dir, "documentation"}]). %%% Note that overview.edoc file must be already present in output folder such as documentation %%% folder mentioned above for it to be used. Symoblic links also work. -module(edoc_example). %%% Only exported functions are part of documentation -export([add/2, subtract/2]). %%% @doc This function is used to add two integers. -spec add(integer(), integer()) -> integer(). add(Num1, Num2) -> Num1 + Num2. -spec subtract(integer(), integer()) -> integer(). %%% @doc This function is used to subtract two integers. %%% @see add/2 subtract(Num1, Num2) -> Num1 - Num2. %%% Only exported types would be part of documentation -export_type([color/0]). -type color() :: red | green | blue. %%% This would become documentation for color type, which can %%% be used to specify either red, green or blue.