imporvised smart_converter method to parsse content better
This commit is contained in:
parent
8171fddea6
commit
ad76febf40
|
@ -47,6 +47,8 @@ class AnnouncementFeedsController < ApplicationController
|
|||
def smart_convertor(text)
|
||||
html_string = text
|
||||
links = html_string.scan(/img.*?src="(.*?)"/i)
|
||||
links = links + html_string.scan(/a.*?href="(.*?)"/i)
|
||||
links.uniq!
|
||||
links.each do |link|
|
||||
l = link.first
|
||||
new_link = nil
|
||||
|
@ -56,7 +58,7 @@ class AnnouncementFeedsController < ApplicationController
|
|||
l1 = l.gsub("../","")
|
||||
new_link = request.protocol + request.host_with_port + "/" + l1
|
||||
end
|
||||
html_string = html_string.sub(l,new_link) if !new_link.nil?
|
||||
html_string = html_string.gsub(l,new_link) if !new_link.nil?
|
||||
end
|
||||
return html_string
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue