forked from mirrors/akkoma
Remove Pleroma.Formatter.minify/2
This commit is contained in:
parent
004bcedb07
commit
6727a3659f
4 changed files with 0 additions and 20 deletions
|
@ -142,17 +142,6 @@ defmodule Pleroma.Formatter do
|
||||||
|> Enum.join("")
|
|> Enum.join("")
|
||||||
end
|
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
|
def truncate(text, max_length \\ 200, omission \\ "...") do
|
||||||
# Remove trailing whitespace
|
# Remove trailing whitespace
|
||||||
text = Regex.replace(~r/([^ \t\r\n])([ \t]+$)/u, text, "\\g{1}")
|
text = Regex.replace(~r/([^ \t\r\n])([ \t]+$)/u, text, "\\g{1}")
|
||||||
|
|
|
@ -96,7 +96,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AudioVideoValidator do
|
||||||
content =
|
content =
|
||||||
content
|
content
|
||||||
|> Pleroma.Formatter.markdown_to_html()
|
|> Pleroma.Formatter.markdown_to_html()
|
||||||
|> Pleroma.Formatter.minify("text/html")
|
|
||||||
|> Pleroma.HTML.filter_tags()
|
|> Pleroma.HTML.filter_tags()
|
||||||
|
|
||||||
Map.put(data, "content", content)
|
Map.put(data, "content", content)
|
||||||
|
|
|
@ -296,7 +296,6 @@ defmodule Pleroma.Web.CommonAPI.Utils do
|
||||||
|> Formatter.mentions_escape(options)
|
|> Formatter.mentions_escape(options)
|
||||||
|> Formatter.markdown_to_html()
|
|> Formatter.markdown_to_html()
|
||||||
|> Formatter.linkify(options)
|
|> Formatter.linkify(options)
|
||||||
|> Formatter.minify("text/html")
|
|
||||||
|> Formatter.html_escape("text/html")
|
|> Formatter.html_escape("text/html")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -307,11 +307,4 @@ defmodule Pleroma.FormatterTest do
|
||||||
|
|
||||||
assert Formatter.html_escape(text, "text/plain") == expected
|
assert Formatter.html_escape(text, "text/plain") == expected
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue