add tag feeds

This commit is contained in:
Maksim Pechnikov 2019-12-17 22:13:45 +03:00
commit b53573a837
9 changed files with 149 additions and 33 deletions

View file

@ -19,15 +19,22 @@ defmodule Pleroma.Web.Metadata.Utils do
end
def scrub_html_and_truncate(content, max_length \\ 200) when is_binary(content) do
content
|> scrub_html
|> Emoji.Formatter.demojify()
|> Formatter.truncate(max_length)
end
def scrub_html(content) when is_binary(content) do
content
# html content comes from DB already encoded, decode first and scrub after
|> HtmlEntities.decode()
|> String.replace(~r/<br\s?\/?>/, " ")
|> HTML.strip_tags()
|> Emoji.Formatter.demojify()
|> Formatter.truncate(max_length)
end
def scrub_html(content), do: content
def attachment_url(url) do
MediaProxy.url(url)
end