diff options
author | Lukas Larsson <lukas@erlang.org> | 2020-02-21 14:34:32 +0100 |
---|---|---|
committer | Lukas Larsson <lukas@erlang.org> | 2020-02-24 09:53:15 +0100 |
commit | 8301a5f9db331fd5309c9b260e8d2ac33332e4f4 (patch) | |
tree | 9223ccf250db3d40da8f500010432674b3fd7684 /lib | |
parent | bfa13226dcea8e078400ed69e16ac1e7b08fce24 (diff) | |
download | erlang-8301a5f9db331fd5309c9b260e8d2ac33332e4f4.tar.gz |
Remove term_to_binary of doc chunks doc content
Diffstat (limited to 'lib')
-rw-r--r-- | lib/erl_docgen/priv/bin/chunk.escript | 4 | ||||
-rw-r--r-- | lib/stdlib/src/shell_docs.erl | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/erl_docgen/priv/bin/chunk.escript b/lib/erl_docgen/priv/bin/chunk.escript index 2fb397b627..4762a2e95b 100644 --- a/lib/erl_docgen/priv/bin/chunk.escript +++ b/lib/erl_docgen/priv/bin/chunk.escript @@ -665,7 +665,7 @@ to_chunk(Dom, Source, Module, AST) -> docs_v1(DocContents, Anno, Metadata, Docs) -> #docs_v1{ anno = Anno, - module_doc = #{<<"en">> => term_to_binary(shell_docs:normalize(DocContents))}, + module_doc = #{<<"en">> => shell_docs:normalize(DocContents)}, metadata = maps:merge(Metadata, (#docs_v1{})#docs_v1.metadata), docs = Docs }. @@ -678,7 +678,7 @@ docs_v1_entry(Kind, Anno, Name, Arity, Signature, Metadata, DocContents) -> Anno end, {{Kind, Name, Arity}, AnnoWLine, lists:flatten(Signature), - #{ <<"en">> => term_to_binary(shell_docs:normalize(DocContents))}, Metadata}. + #{ <<"en">> => shell_docs:normalize(DocContents)}, Metadata}. %% A special list_to_atom that handles %% 'and' diff --git a/lib/stdlib/src/shell_docs.erl b/lib/stdlib/src/shell_docs.erl index 25bf7cb69f..6e56030fca 100644 --- a/lib/stdlib/src/shell_docs.erl +++ b/lib/stdlib/src/shell_docs.erl @@ -71,13 +71,13 @@ validate(#docs_v1{ module_doc = MDocs, docs = AllDocs }) -> true = lists:all(fun(Elem) -> ?IS_INLINE(Elem) end, ?INLINE), true = lists:all(fun(Elem) -> ?IS_BLOCK(Elem) end, ?BLOCK), - _ = maps:map(fun(_Key,MDoc) -> validate(binary_to_term(MDoc)) end, MDocs), + _ = maps:map(fun(_Key,MDoc) -> validate(MDoc) end, MDocs), lists:map(fun({_,_Anno, Sig, Docs, _Meta}) -> case lists:all(fun erlang:is_binary/1, Sig) of false -> throw({invalid_signature,Sig}); true -> ok end, - maps:map(fun(_Key,Doc) -> validate(binary_to_term(Doc)) end, Docs) + maps:map(fun(_Key,Doc) -> validate(Doc) end, Docs) end, AllDocs); validate([H|T]) when is_tuple(H) -> _ = validate(H), @@ -333,10 +333,10 @@ get_local_doc({F,A}, Docs) -> get_local_doc(unicode:characters_to_binary(io_lib:format("~tp/~p",[F,A])), Docs); get_local_doc(_Missing, #{ <<"en">> := Docs }) -> %% English if it exists - normalize(binary_to_term(Docs)); + normalize(Docs); get_local_doc(_Missing, ModuleDoc) when map_size(ModuleDoc) > 0 -> %% Otherwise take first alternative found - normalize(binary_to_term(maps:get(hd(maps:keys(ModuleDoc)), ModuleDoc))); + normalize(maps:get(hd(maps:keys(ModuleDoc)), ModuleDoc)); get_local_doc(Missing, hidden) -> [{p,[],[<<"The documentation for ">>,Missing, <<" is hidden. This probably means that it is internal " |