Improve Formatter.minify/2
authorAlex Gleason <alex@alexgleason.me>
Tue, 13 Oct 2020 06:53:25 +0000 (01:53 -0500)
committerMark Felder <feld@FreeBSD.org>
Fri, 11 Dec 2020 23:22:24 +0000 (17:22 -0600)
lib/pleroma/formatter.ex

index b0e4a84ae8ed43dfbc243bde53eef0557d93d0b9..61906dda6aa406c79a30ebb8de060c3fa8a57fbb 100644 (file)
@@ -143,7 +143,10 @@ defmodule Pleroma.Formatter do
   end
 
   def minify(text, "text/html") do
-    String.replace(text, "\n", "")
+    text
+    |> String.replace(">\n", ">")
+    |> String.replace(">  ", ">")
+    |> String.replace("  <", "<")
   end
 
   def truncate(text, max_length \\ 200, omission \\ "...") do