diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-04-30 12:27:06 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-04-30 12:27:06 -0500 |
commit | 6727a3659f60c0e09fa6375b6c0843c01f5be3dc (patch) | |
tree | 2b007d0eff57a86073909a2449ae5e29a6a14379 | |
parent | 004bcedb074d50bc42803e4c0a884239bd504b3d (diff) | |
download | pleroma-6727a3659f60c0e09fa6375b6c0843c01f5be3dc.tar.gz |
Remove Pleroma.Formatter.minify/2
-rw-r--r-- | lib/pleroma/formatter.ex | 11 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex | 1 | ||||
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 1 | ||||
-rw-r--r-- | test/pleroma/formatter_test.exs | 7 |
4 files changed, 0 insertions, 20 deletions
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index 2aa236ca9..baf652a5a 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -142,17 +142,6 @@ defmodule Pleroma.Formatter do |> Enum.join("") end - def minify({text, mentions, hashtags}, type) do - {minify(text, type), mentions, hashtags} - end - - def minify(text, "text/html") do - text - |> String.replace(">\n", ">") - |> String.replace("> ", ">") - |> String.replace(" <", "<") - end - def truncate(text, max_length \\ 200, omission \\ "...") do # Remove trailing whitespace text = Regex.replace(~r/([^ \t\r\n])([ \t]+$)/u, text, "\\g{1}") diff --git a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex index fa3e2c026..9b38aa4c2 100644 --- a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex @@ -96,7 +96,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AudioVideoValidator do content = content |> Pleroma.Formatter.markdown_to_html() - |> Pleroma.Formatter.minify("text/html") |> Pleroma.HTML.filter_tags() Map.put(data, "content", content) diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index be86009af..4731e79be 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -296,7 +296,6 @@ defmodule Pleroma.Web.CommonAPI.Utils do |> Formatter.mentions_escape(options) |> Formatter.markdown_to_html() |> Formatter.linkify(options) - |> Formatter.minify("text/html") |> Formatter.html_escape("text/html") end diff --git a/test/pleroma/formatter_test.exs b/test/pleroma/formatter_test.exs index ceedd1b6d..5781a3f01 100644 --- a/test/pleroma/formatter_test.exs +++ b/test/pleroma/formatter_test.exs @@ -307,11 +307,4 @@ defmodule Pleroma.FormatterTest do assert Formatter.html_escape(text, "text/plain") == expected end - - test "it minifies html" do - text = "<p>\nhello</p>\n<p>\nworld</p>\n" - expected = "<p>hello</p><p>world</p>" - - assert Formatter.minify(text, "text/html") == expected - end end |