chore: refactored areas around to_existing_atom/1 uses

This commit is contained in:
2026-05-01 17:25:59 +02:00
parent 3505355980
commit 07ce5f8b4d
16 changed files with 1150 additions and 373 deletions

View File

@@ -174,7 +174,9 @@ defmodule BDS.Menu do
defp outline_kind(element), do: xml_attr(element, :type) || xml_attr(element, :kind)
defp outline_slug(element, :category_archive), do: xml_attr(element, :categoryName) || xml_attr(element, :slug)
defp outline_slug(element, :category_archive),
do: xml_attr(element, :categoryName) || xml_attr(element, :slug)
defp outline_slug(element, :home), do: xml_attr(element, :pageSlug) || xml_attr(element, :slug)
defp outline_slug(element, _kind), do: xml_attr(element, :pageSlug) || xml_attr(element, :slug)
@@ -203,15 +205,7 @@ defmodule BDS.Menu do
defp normalize_kind(nil), do: :page
defp normalize_kind(kind) when is_binary(kind) do
case kind do
"category-archive" -> :category_archive
other ->
other
|> String.to_existing_atom()
|> normalize_kind()
end
rescue
_error -> :page
BDS.BoundedAtoms.menu_kind(kind, :page)
end
defp normalize_optional_string(nil), do: nil