lib/awesome_bot/links.rb in awesome_bot-1.8.3 vs lib/awesome_bot/links.rb in awesome_bot-1.8.4
- old
+ new
@@ -2,22 +2,26 @@
module AwesomeBot
class << self
def links_filter(list)
list.reject { |x| x.length < 9 }
.map do |x|
- x.gsub(',','%2c').gsub(/'.*/, '').gsub(/,.*/, '').gsub('/:', '/')
+ x.gsub(',','%2c').gsub(/'.*/, '').gsub(/,.*/, '')
end
.map do |x|
if x.include? ')]'
x.gsub /\)\].*/, ''
elsif (x.scan(')').count == 2) && (x.scan('(').count == 1)
x.gsub(/\)\).*/, ')')
elsif x.scan(')').count > 0
x.gsub(/\).*/, '')
elsif x.include? '[' # adoc
x.gsub(/\[.*/, '')
+ elsif x[-1]=='.' || x[-1]==':'
+ x[0..-2]
elsif x[-1]=='.'
x[0..-2]
+ elsif x[-3..-1]=='%2c'
+ x[0..-4]
else
x
end
end
end