Skip to content

Fix strip_app to always rewrap in a list #2124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/ex_doc/language/erlang.ex
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,15 @@ defmodule ExDoc.Language.Erlang do
end

defp strip_app([{:code, attrs, [code], meta}], app) do
[{:code, attrs, strip_app(code, app), meta}]
[{:code, attrs, List.wrap(strip_app(code, app)), meta}]
end

defp strip_app(code, app) when is_binary(code) do
String.trim_leading(code, "//#{app}/")
List.wrap(String.trim_leading(code, "//#{app}/"))
end

defp strip_app(other, _app) do
other
List.wrap(other)
end

defp warn_ref(href, config) do
Expand Down