Downcase tags coming in through the TwAPI.
This commit is contained in:
parent
5ff4a5eee3
commit
6cac8e3c8b
|
@ -9,7 +9,7 @@ def linkify(text) do
|
||||||
@tag_regex ~r/\#\w+/u
|
@tag_regex ~r/\#\w+/u
|
||||||
def parse_tags(text) do
|
def parse_tags(text) do
|
||||||
Regex.scan(@tag_regex, text)
|
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
|
end
|
||||||
|
|
||||||
def parse_mentions(text) do
|
def parse_mentions(text) do
|
||||||
|
|
|
@ -16,9 +16,9 @@ test "turning urls into links" do
|
||||||
|
|
||||||
describe ".parse_tags" do
|
describe ".parse_tags" do
|
||||||
test "parses tags in the text" do
|
test "parses tags in the text" do
|
||||||
text = "Here's a #test. Maybe these are #working or not. What about #漢字? And #は。"
|
text = "Here's a #Test. Maybe these are #working or not. What about #漢字? And #は。"
|
||||||
expected = [
|
expected = [
|
||||||
{"#test", "test"},
|
{"#Test", "test"},
|
||||||
{"#working", "working"},
|
{"#working", "working"},
|
||||||
{"#漢字", "漢字"},
|
{"#漢字", "漢字"},
|
||||||
{"#は", "は"}
|
{"#は", "は"}
|
||||||
|
|
Loading…
Reference in New Issue