diff options
author | kaniini <nenolod@gmail.com> | 2019-04-27 07:44:24 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-04-27 07:44:24 +0000 |
commit | 002ea343f8c6dc9669bce91942f835a2c7cc6ae7 (patch) | |
tree | 2886d3742bdec921839bfca4e4b76b60925c3ed0 /lib/pleroma/web/common_api | |
parent | 81bc274930ea4e78224a475da03847caa94ecbea (diff) | |
parent | ef52aa0e6647d00f5ff984d655ef4b27ab3e6b1a (diff) | |
download | pleroma-002ea343f8c6dc9669bce91942f835a2c7cc6ae7.tar.gz |
Merge branch 'feature/bbcode' into 'develop'
BBCode support (backend)
See merge request pleroma/pleroma!1097
Diffstat (limited to 'lib/pleroma/web/common_api')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 12 |
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 887f878c4..1dfe50b40 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -183,6 +183,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 |