unicode fix in tags
This commit is contained in:
parent
8a2dd36b7e
commit
6855447204
2 changed files with 5 additions and 5 deletions
|
|
@ -36,7 +36,7 @@ module Diaspora
|
|||
|
||||
def format_tags(text, opts={})
|
||||
return text if opts[:plain_text]
|
||||
regex = /(^|\s)#([a-zA-Z0-9\-]+)/
|
||||
regex = /(^|\s)#(\w+)/
|
||||
form_message = text.gsub(regex) do |matched_string|
|
||||
"#{$~[1]}<a href=\"/tags/#{$~[2]}\" class=\"tag\">##{$~[2]}</a>"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ describe Diaspora::Taggable do
|
|||
|
||||
describe '#format_tags' do
|
||||
before do
|
||||
@str = '#what #hey'
|
||||
@str = '#what #hey #vöglein'
|
||||
@object.send(@object.class.field_with_tags_setter, @str)
|
||||
@object.build_tags
|
||||
@object.save!
|
||||
end
|
||||
it 'links the tag to /p' do
|
||||
link = link_to('#what', '/tags/what', :class => 'tag')
|
||||
link = link_to('#vöglein', '/tags/vöglein', :class => 'tag')
|
||||
@object.format_tags(@str).should include(link)
|
||||
end
|
||||
it 'responds to plain_text' do
|
||||
|
|
@ -38,8 +38,8 @@ describe Diaspora::Taggable do
|
|||
end
|
||||
describe '#tag_strings' do
|
||||
it 'returns a string for every #thing' do
|
||||
str = '#what #hey #that"smybike. #@hey ##boo # #THATWASMYBIKE #hey#there #135440we #abc/23 ###'
|
||||
arr = ['what', 'hey', 'that', 'THATWASMYBIKE', '135440we', 'abc']
|
||||
str = '#what #hey #that"smybike. #@hey ##boo # #THATWASMYBIKE #vöglein #hey#there #135440we #abc/23 ###'
|
||||
arr = ['what', 'hey', 'that', 'THATWASMYBIKE', 'vöglein', '135440we', 'abc']
|
||||
|
||||
@object.send(@object.class.field_with_tags_setter, str)
|
||||
@object.tag_strings.should =~ arr
|
||||
|
|
|
|||
Loading…
Reference in a new issue