<%= paper.title %>
<%
def fix_local_url(siteurl, contents)
doc = Nokogiri::HTML.fragment(contents, encoding = 'UTF-8')
doc.css('img[src], script[src]').each do |src_tag|
src = src_tag.attribute('src').value
next if src.blank?
if src.match(/^\/[^\/]+/)
src_tag.attribute('src').value = siteurl + src
end
end
doc.css('a[href], link[href]').each do |link_tag|
href = link_tag.attribute('href').value
next if href.blank?
if href.match(/^\/[^\/]+/)
link_tag.attribute('href').value = siteurl + href
end
end
doc.to_html
end
have_papaers = papers_data.present?
if paper.image.present?
img_src = siteurl + paper.image.url
else
img_src = nil
end
if paper.description.present?
paper_description = fix_local_url(siteurl, paper.description).html_safe
else
paper_description = nil
end
if paper.content.present?
paper_content = fix_local_url(siteurl, paper.content).html_safe
else
paper_content = nil
end
%>