From fc656cba1bcc477dba4f298d15566933dbca780a Mon Sep 17 00:00:00 2001 From: Onno Vos Date: Thu, 17 Aug 2023 10:14:16 +0200 Subject: [PATCH] Escape .... by using (...) instead as per edoc suggestion upon encountering this error --- lib/aws_codegen/docstring.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/aws_codegen/docstring.ex b/lib/aws_codegen/docstring.ex index 0ed8bd7..76cf0ba 100644 --- a/lib/aws_codegen/docstring.ex +++ b/lib/aws_codegen/docstring.ex @@ -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/'/, "'") @@ -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