Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Commit

Permalink
Support @deprecated tags (TODO)
Browse files Browse the repository at this point in the history
This outputs Markdown to the chunk, but at least it's conformant with
EEP-48 which requires a binary.

Let's take the following example:

    %% @deprecated See {@link file/2} for details.

Currently, it's output as a binary:

    #{deprecated => <<"See `file/2` for details.">>,

However, not to lose information, it could also be output
as an htmltree:

    #{deprecated =>
      [<<"See ">>,
       {a,[{href,<<"#file-2">>}],[{code,[],[<<"file/2">>]}]},
       <<" for details.">>],
  • Loading branch information
erszcz committed Mar 28, 2020
1 parent 0c81cea commit ed5f585
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/edoc_chunks.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,13 @@ extract_doc_contents(XPath, Doc, Opts) ->
end.

edoc_extract_metadata(Doc, Opts) ->
case xpath_to_text("./since", Doc, Opts) of
<<"">> -> #{};
Since -> #{since => Since}
end.
Since = xpath_to_text("./since", Doc, Opts),
Deprecated = xpath_to_text("./deprecated/description/fullDescription", Doc, Opts),
maps:from_list([{since, Since} || truthy(Since) ] ++
[{deprecated, Deprecated} || truthy(Deprecated) ]).

truthy(<<>>) -> false;
truthy(B) when is_binary(B) -> true.

edoc_extract_docs(Doc, Opts) ->
edoc_extract_types(Doc, Opts) ++ edoc_extract_functions(Doc, Opts).
Expand Down

0 comments on commit ed5f585

Please sign in to comment.