From 77cf3f03cbc7aeddb4e3b966fb456d234d7ab3db Mon Sep 17 00:00:00 2001 From: Onno Vos Date: Wed, 28 Feb 2024 17:51:39 +0100 Subject: [PATCH 1/3] Ensure tags that contain references to AWS SDK GO functions are ignored as they blow up ex_doc --- lib/aws_codegen/docstring.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/aws_codegen/docstring.ex b/lib/aws_codegen/docstring.ex index 76cf0ba..ec795fb 100644 --- a/lib/aws_codegen/docstring.ex +++ b/lib/aws_codegen/docstring.ex @@ -274,7 +274,13 @@ 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 -> From 1970a8a8c2830b2416caa3c863a95011a3d7fe6c Mon Sep 17 00:00:00 2001 From: Onno Vos Date: Wed, 28 Feb 2024 17:52:00 +0100 Subject: [PATCH 2/3] Improve links and ensure more links are rendered in the docs --- lib/aws_codegen/docstring.ex | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/aws_codegen/docstring.ex b/lib/aws_codegen/docstring.ex index ec795fb..6486237 100644 --- a/lib/aws_codegen/docstring.ex +++ b/lib/aws_codegen/docstring.ex @@ -283,15 +283,14 @@ defmodule AWS.CodeGen.Docstring do 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 -> From c78807dc3a87340b583b681f3cad128e52062480 Mon Sep 17 00:00:00 2001 From: Onno Vos Date: Wed, 28 Feb 2024 18:07:01 +0100 Subject: [PATCH 3/3] Fix test after links got changed --- test/aws_codegen/docstring_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/aws_codegen/docstring_test.exs b/test/aws_codegen/docstring_test.exs index b04ee63..3c09b8e 100644 --- a/test/aws_codegen/docstring_test.exs +++ b/test/aws_codegen/docstring_test.exs @@ -211,7 +211,7 @@ defmodule AWS.CodeGen.DocstringTest do """ %% @doc A short description. %% - %% This is a link. + %% This is a link: https://foo.bar. %% This is a `code' and a multiline is here: %% %% ```