projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add unit test for Pleroma API app controller
[akkoma]
/
lib
/
pleroma
/
formatter.ex
diff --git
a/lib/pleroma/formatter.ex
b/lib/pleroma/formatter.ex
index 1be12055f2954b333ce16a913703b70ef9d4bf17..ae37946ab79630af6111ae439a8849a33df4f379 100644
(file)
--- a/
lib/pleroma/formatter.ex
+++ b/
lib/pleroma/formatter.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-202
0
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-202
1
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Formatter do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Formatter do
@@
-62,7
+62,7
@@
defmodule Pleroma.Formatter do
def hashtag_handler("#" <> tag = tag_text, _buffer, _opts, acc) do
tag = String.downcase(tag)
def hashtag_handler("#" <> tag = tag_text, _buffer, _opts, acc) do
tag = String.downcase(tag)
- url = "#{Pleroma.Web.
base_
url()}/tag/#{tag}"
+ url = "#{Pleroma.Web.
Endpoint.
url()}/tag/#{tag}"
link =
Phoenix.HTML.Tag.content_tag(:a, tag_text,
link =
Phoenix.HTML.Tag.content_tag(:a, tag_text,
@@
-122,7
+122,7
@@
defmodule Pleroma.Formatter do
end
def markdown_to_html(text) do
end
def markdown_to_html(text) do
- Earmark.as_html!(text)
+ Earmark.as_html!(text
, %Earmark.Options{compact_output: true}
)
end
def html_escape({text, mentions, hashtags}, type) do
end
def html_escape({text, mentions, hashtags}, type) do
@@
-142,17
+142,6
@@
defmodule Pleroma.Formatter do
|> Enum.join("")
end
|> 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}")
def truncate(text, max_length \\ 200, omission \\ "...") do
# Remove trailing whitespace
text = Regex.replace(~r/([^ \t\r\n])([ \t]+$)/u, text, "\\g{1}")