Skip to content

Commit

Permalink
Merge pull request #99 from aws-beam/escape-four-dots-with-parenthesis
Browse files Browse the repository at this point in the history
Escape .... by using (...) instead as per edoc suggestion upon encountering this error
  • Loading branch information
onno-vos-dev committed Dec 15, 2023
2 parents fe5e24b + fc656cb commit db6561f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/aws_codegen/docstring.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ defmodule AWS.CodeGen.Docstring do
|> Enum.map(&justify_line(&1, @max_erlang_line_length, "%% "))
|> Enum.join("\n")
|> fix_long_break_lines()
|> escape_ellipsis_followed_by_dot()
|> String.trim_trailing()
|> String.replace(@two_break_lines, "\n%%\n")
|> String.replace(~r/'/, "'")
Expand Down Expand Up @@ -62,6 +63,13 @@ defmodule AWS.CodeGen.Docstring do
String.replace(text, " ", " ")
end

# aws-sdk-go docs may use .... to act as a "wildcard" which breaks edocs with the following error:
# warning: found "..." followed by ".", please use parens around "..." instead
# so let's do exactly what edoc is suggesting
defp escape_ellipsis_followed_by_dot(text) do
String.replace(text, "....", "(...).")
end

defp fix_long_break_lines(text) do
String.replace(text, ~r/[\n]{3,}/, @two_break_lines)
end
Expand Down

0 comments on commit db6561f

Please sign in to comment.