multiple authors are concatenated

This commit is contained in:
mmacia committed 2026-07-02 22:34:01 +00:00
1 parent 34dea7a2ca
commit 515d60f331
2 files changed
+22 -1

No files matched your search

+13 -1
View File
@@ -52,7 +52,7 @@ defmodule FeedReader.Formats.Atom do
|> find_link()
|> URL.resolve_root_relative([feed.html_url, feed.feed_url])
author = get_in(raw, ["author", "name"]) |> text()
author = raw |> Map.get("author") |> author()
date = text(raw["published"]) || text(raw["updated"])
@@ -84,6 +84,18 @@ defmodule FeedReader.Formats.Atom do
defp content(value), do: text(value)
defp author(value) do
value
|> List.wrap()
|> Enum.map(&author_name/1)
|> Enum.reject(&is_nil/1)
|> Enum.join(", ")
|> blank_to_nil()
end
defp author_name(%{"name" => name}), do: text(name)
defp author_name(value), do: text(value)
defp find_link(links) do
case Enum.find(links, &((is_map(&1) and &1["href"]) && &1["rel"] in [nil, "alternate"])) do
%{"href" => href} -> clean(href)