X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fcommon_api%2Futils.ex;h=1dfe50b408266efd29f341ac37f5dc3b7b652d53;hb=cdcdbd88da76f18c21da7f6f15a29883044902c8;hp=887f878c440ed2a6e6550017596c3f3764d1db12;hpb=aa9d37898527260383814a7cf5665d3345075122;p=akkoma diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 887f878c4..1dfe50b40 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -182,6 +182,18 @@ defmodule Pleroma.Web.CommonAPI.Utils do end).() 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. """