diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2019-12-17 22:13:45 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2019-12-18 09:19:37 +0300 |
commit | b53573a837e606ef3536ec338510cadacab55d7c (patch) | |
tree | 61006ec6103d13e471cbce2602e9e681fb6f70c2 /lib/pleroma/web/metadata | |
parent | a879c396bb3a07929d4821ef2c29610808962c6d (diff) | |
download | pleroma-b53573a837e606ef3536ec338510cadacab55d7c.tar.gz |
add tag feeds
Diffstat (limited to 'lib/pleroma/web/metadata')
-rw-r--r-- | lib/pleroma/web/metadata/utils.ex | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/pleroma/web/metadata/utils.ex b/lib/pleroma/web/metadata/utils.ex index 382ecf426..c0dae1b7e 100644 --- a/lib/pleroma/web/metadata/utils.ex +++ b/lib/pleroma/web/metadata/utils.ex @@ -20,14 +20,21 @@ defmodule Pleroma.Web.Metadata.Utils do 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 |