Skip to content

Commit

Permalink
Add hyphen(-) to MENTION_PATTERN
Browse files Browse the repository at this point in the history
  • Loading branch information
michiomochi committed Aug 31, 2017
1 parent f6567a1 commit 45ff371
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/mato/html_filters/mention_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MentionLink
# @return [Proc]
attr_reader :link_builder

MENTION_PATTERN = /\@[a-zA-Z0-9_]+\b/ # e.g. @foo
MENTION_PATTERN = /\@[a-zA-Z0-9_-]+\b/ # e.g. @foo

# @param [Regexp] pattern
# @param [Proc] link_builder A block that takes Hash<String, Array<Nokogiri::XML::Node>>
Expand Down
2 changes: 1 addition & 1 deletion test/html_filters/mention_link_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def subject
end

def test_mention_filter_for_valid
assert_html_eq process('@valid').render_html, %{<p><a href="https://twitter.com/@valid" class="mention">@valid</a></p>\n}
assert_html_eq process('@va_l-id').render_html, %{<p><a href="https://twitter.com/@va_l-id" class="mention">@va_l-id</a></p>\n}
end

def test_mention_filter_for_multiple_valid_accounts
Expand Down

0 comments on commit 45ff371

Please sign in to comment.