@@ -39,9 +39,7 @@ defmodule Mobilizon.Federation.WebFinger.XmlBuilder do
|
||||
defp to_xml(content) when is_binary(content), do: to_string(content)
|
||||
|
||||
defp to_xml(content) when is_list(content) do
|
||||
content
|
||||
|> Enum.map(&to_xml/1)
|
||||
|> Enum.join()
|
||||
Enum.map_join(content, &to_xml/1)
|
||||
end
|
||||
|
||||
defp to_xml(%NaiveDateTime{} = time), do: NaiveDateTime.to_iso8601(time)
|
||||
@@ -49,9 +47,7 @@ defmodule Mobilizon.Federation.WebFinger.XmlBuilder do
|
||||
@spec make_open_tag(tag :: atom, attributes :: map()) :: String.t()
|
||||
defp make_open_tag(tag, attributes) do
|
||||
attributes_string =
|
||||
attributes
|
||||
|> Enum.map(fn {attribute, value} -> "#{attribute}=\"#{value}\"" end)
|
||||
|> Enum.join(" ")
|
||||
Enum.map_join(attributes, " ", fn {attribute, value} -> "#{attribute}=\"#{value}\"" end)
|
||||
|
||||
[to_string(tag), attributes_string] |> Enum.join(" ") |> String.trim()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user