Skip to content

Commit

Permalink
Merge pull request #102 from aws-beam/improvements-to-erlang-docs
Browse files Browse the repository at this point in the history
Improvements to erlang docs
  • Loading branch information
onno-vos-dev authored Feb 28, 2024
2 parents 506a18e + c78807d commit 1eab233
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions lib/aws_codegen/docstring.ex
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,23 @@ defmodule AWS.CodeGen.Docstring do
if String.contains?(text, "\n") do
"\n```\n#{String.trim_leading(text, "\n")}'''#{@two_break_lines}"
else
"`#{text}'"
## ex_doc blows up on these sorts of things as it sees them as a reference to a function.
## Just ignore them as they refer to aws-sdk-go based implementations and we don't really care about that
if String.ends_with?(text, "()") do
""
else
"`#{text}'"
end
end

{"a", attrs, children} = html_node ->
{"a", attrs, children} ->
case Enum.find(attrs, fn {attr, _} -> attr == "href" end) do
{_, href} ->
text = Floki.text(children)

if text == href do
"[#{href}]"
else
html_node
"#{text}: #{href}"
end

nil ->
Expand Down
2 changes: 1 addition & 1 deletion test/aws_codegen/docstring_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ defmodule AWS.CodeGen.DocstringTest do
"""
%% @doc A short description.
%%
%% This is a <a href="https://foo.bar">link</a>.
%% This is a link: https://foo.bar.
%% This is a `code' and a multiline is here:
%%
%% ```
Expand Down

0 comments on commit 1eab233

Please sign in to comment.