Accept port number in urls.
This commit is contained in:
parent
303289d7da
commit
60f92e406c
2 changed files with 8 additions and 1 deletions
|
@ -144,7 +144,7 @@ def get_custom_emoji() do
|
||||||
@emoji
|
@emoji
|
||||||
end
|
end
|
||||||
|
|
||||||
@link_regex ~r/https?:\/\/[\w\.\/?=\-#\+%&@~\(\)]+[\w\/]/u
|
@link_regex ~r/https?:\/\/[\w\.\/?=\-#\+%&@~\(\):]+[\w\/]/u
|
||||||
|
|
||||||
def html_escape(text) do
|
def html_escape(text) do
|
||||||
Regex.split(@link_regex, text, include_captures: true)
|
Regex.split(@link_regex, text, include_captures: true)
|
||||||
|
|
|
@ -34,6 +34,13 @@ test "turning urls into links" do
|
||||||
|
|
||||||
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
|
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
|
||||||
|
|
||||||
|
text = "https://mastodon.social:4000/@lambadalambda"
|
||||||
|
|
||||||
|
expected =
|
||||||
|
"<a href='https://mastodon.social:4000/@lambadalambda'>https://mastodon.social:4000/@lambadalambda</a>"
|
||||||
|
|
||||||
|
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
|
||||||
|
|
||||||
text = "@lambadalambda"
|
text = "@lambadalambda"
|
||||||
expected = "@lambadalambda"
|
expected = "@lambadalambda"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue