add `parent:urls` & `parent:domains` bangtags

staging
multiple creatures 2019-07-17 16:51:26 -05:00
parent 65b79ae188
commit 6bffa56473
1 changed files with 10 additions and 0 deletions

View File

@ -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