From 009bbb826b0bef0ab907117583eae616e8e1e611 Mon Sep 17 00:00:00 2001 From: MrZYX Date: Sat, 30 Apr 2011 00:08:33 +0200 Subject: [PATCH] added \b (word ending) to tag regex to exclude :;?! etc.; allow : in tags --- lib/diaspora/taggable.rb | 2 +- spec/shared_behaviors/taggable.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/diaspora/taggable.rb b/lib/diaspora/taggable.rb index 74b4377ff..2eff35442 100644 --- a/lib/diaspora/taggable.rb +++ b/lib/diaspora/taggable.rb @@ -4,7 +4,7 @@ module Diaspora module Taggable - VALID_TAG_BODY = /[^_,\s#*\[\]()\:\@\/"'\.%]+/ + VALID_TAG_BODY = /[^_,\s#*\[\]()\@\/"'\.%]+\b/ def self.included(model) model.class_eval do diff --git a/spec/shared_behaviors/taggable.rb b/spec/shared_behaviors/taggable.rb index 4a7838601..0b1bd95f0 100644 --- a/spec/shared_behaviors/taggable.rb +++ b/spec/shared_behaviors/taggable.rb @@ -39,8 +39,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 #vöglein #hey#there #135440we #abc/23 ###' - arr = ['what', 'hey', 'that', 'THATWASMYBIKE', 'vöglein', '135440we', 'abc'] + str = '#what #hey #that"smybike. #@hey ##boo # #THATWASMYBIKE #vöglein #hey#there #135440we #abc/23 ### #h!gh #ok? #see: #re:publica' + arr = ['what', 'hey', 'that', 'THATWASMYBIKE', 'vöglein', '135440we', 'abc', 'h!gh', 'ok', 'see', 're:publica'] @object.send(@object.class.field_with_tags_setter, str) @object.tag_strings.should =~ arr