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
6cac8e3c
Commit
6cac8e3c
authored
Jun 18, 2017
by
lain
Browse files
Downcase tags coming in through the TwAPI.
parent
5ff4a5ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/formatter.ex
View file @
6cac8e3c
...
...
@@ -9,7 +9,7 @@ def linkify(text) do
@tag_regex
~r/\#\w+/u
def
parse_tags
(
text
)
do
Regex
.
scan
(
@tag_regex
,
text
)
|>
Enum
.
map
(
fn
([
"#"
<>
tag
=
full_tag
])
->
{
full_tag
,
tag
}
end
)
|>
Enum
.
map
(
fn
([
"#"
<>
tag
=
full_tag
])
->
{
full_tag
,
String
.
downcase
(
tag
)
}
end
)
end
def
parse_mentions
(
text
)
do
...
...
test/formatter_test.exs
View file @
6cac8e3c
...
...
@@ -16,9 +16,9 @@ test "turning urls into links" do
describe
".parse_tags"
do
test
"parses tags in the text"
do
text
=
"Here's a #
t
est. Maybe these are #working or not. What about #漢字? And #は。"
text
=
"Here's a #
T
est. Maybe these are #working or not. What about #漢字? And #は。"
expected
=
[
{
"#
t
est"
,
"test"
},
{
"#
T
est"
,
"test"
},
{
"#working"
,
"working"
},
{
"#漢字"
,
"漢字"
},
{
"#は"
,
"は"
}
...
...
Write
Preview
Markdown
is supported
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