Split Federation as separate context
This commit is contained in:
7
lib/service/metadata/metadata.ex
Normal file
7
lib/service/metadata/metadata.ex
Normal file
@@ -0,0 +1,7 @@
|
||||
defprotocol Mobilizon.Service.Metadata do
|
||||
@doc """
|
||||
Build tags
|
||||
"""
|
||||
|
||||
def build_tags(entity)
|
||||
end
|
||||
12
lib/service/metadata/utils.ex
Normal file
12
lib/service/metadata/utils.ex
Normal file
@@ -0,0 +1,12 @@
|
||||
defmodule Mobilizon.Service.Metadata.Utils do
|
||||
@moduledoc """
|
||||
Tools to convert tags to string.
|
||||
"""
|
||||
|
||||
alias Phoenix.HTML
|
||||
|
||||
def stringify_tags(tags), do: Enum.reduce(tags, "", &stringify_tag/2)
|
||||
|
||||
defp stringify_tag(tag, acc) when is_tuple(tag), do: acc <> HTML.safe_to_string(tag)
|
||||
defp stringify_tag(tag, acc) when is_binary(tag), do: acc <> tag
|
||||
end
|
||||
Reference in New Issue
Block a user