aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/utils.ex
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-05-14 19:00:07 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-05-14 19:00:07 +0700
commite82e73478e577782407bc8452d17925675d99d10 (patch)
tree0784beff0a57cbeb239215314e0436b7f0a5253f /lib/pleroma/web/common_api/utils.ex
parent23276e8d6848fa8eae390c16b6e0619c12546e4a (diff)
parentcdcdbd88da76f18c21da7f6f15a29883044902c8 (diff)
downloadpleroma-e82e73478e577782407bc8452d17925675d99d10.tar.gz
Merge remote-tracking branch 'pleroma/develop' into feature/addressable-lists
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r--lib/pleroma/web/common_api/utils.ex12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 32c3b4b98..f082b77d8 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -191,6 +191,18 @@ defmodule Pleroma.Web.CommonAPI.Utils do
end
@doc """
+ Formatting text as BBCode.
+ """
+ def format_input(text, "text/bbcode", options) do
+ text
+ |> String.replace(~r/\r/, "")
+ |> Formatter.html_escape("text/plain")
+ |> BBCode.to_html()
+ |> (fn {:ok, html} -> html end).()
+ |> Formatter.linkify(options)
+ end
+
+ @doc """
Formatting text to html.
"""
def format_input(text, "text/html", options) do