Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
81600c94
Commit
81600c94
authored
Apr 04, 2018
by
lain
Browse files
Handle + in links.
parent
bf953989
Pipeline
#1098
failed with stage
in 1 minute and 47 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
lib/pleroma/formatter.ex
View file @
81600c94
...
@@ -144,7 +144,7 @@ def get_custom_emoji() do
...
@@ -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
)
...
...
test/formatter_test.exs
View file @
81600c94
...
@@ -57,6 +57,13 @@ test "turning urls into links" do
...
@@ -57,6 +57,13 @@ test "turning urls into links" do
"<a href='https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul'>https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul</a>"
"<a href='https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul'>https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul</a>"
assert
Formatter
.
add_links
({[],
text
})
|>
Formatter
.
finalize
()
==
expected
assert
Formatter
.
add_links
({[],
text
})
|>
Formatter
.
finalize
()
==
expected
text
=
"https://www.google.co.jp/search?q=Nasim+Aghdam"
expected
=
"<a href='https://www.google.co.jp/search?q=Nasim+Aghdam'>https://www.google.co.jp/search?q=Nasim+Aghdam</a>"
assert
Formatter
.
add_links
({[],
text
})
|>
Formatter
.
finalize
()
==
expected
end
end
end
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment