about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/lib/bangtags.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index c8e64d30c..150150f75 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -310,6 +310,16 @@ class Bangtags
                 ours.save
               end
             end
+          when 'urls'
+            plain = @parent_status.text.gsub(/(<br \/>|<br>|<\/p>)+/) { |match| "#{match}\n" }
+            plain = ActionController::Base.helpers.strip_tags(plain)
+            plain.gsub!(/ dot /i, '.')
+            chunk = plain.scan(/https?:\/\/[\w\-]+\.[\w\-]+(?:\.[\w\-]+)*/).uniq.join(' ')
+          when 'domains'
+            plain = @parent_status.text.gsub(/(<br \/>|<br>|<\/p>)+/) { |match| "#{match}\n" }
+            plain = ActionController::Base.helpers.strip_tags(plain)
+            plain.gsub!(/ dot /i, '.')
+            chunk = plain.scan(/[\w\-]+\.[\w\-]+(?:\.[\w\-]+)*/).uniq.join(' ')
           end
         when 'media'
           chunk = nil