Use Redcarpet::Render::XHTML instead of our custom renderer

Now that my :link_attributes patch has been merged we don't need
the custom renderer to add the rel=nofollow attributes.
This commit is contained in:
Tom Hughes 2012-11-29 18:59:43 +00:00
parent 394dcd7316
commit 4bb95b3773
3 changed files with 4 additions and 18 deletions

View file

@ -82,27 +82,13 @@ module RichText
private
def html_parser
@@html_renderer ||= Renderer.new({
:filter_html => true, :safe_links_only => true
@@html_renderer ||= Redcarpet::Render::XHTML.new({
:filter_html => true, :safe_links_only => true, :link_attributes => { :rel => "nofollow" }
})
@@html_parser ||= Redcarpet::Markdown.new(@@html_renderer, {
:no_intra_emphasis => true, :autolink => true, :space_after_headers => true
})
end
class Renderer < Redcarpet::Render::XHTML
def link(link, title, alt_text)
"<a rel=\"nofollow\" href=\"#{link}\">#{alt_text}</a>"
end
def autolink(link, link_type)
if link_type == :email
"<a rel=\"nofollow\" href=\"mailto:#{link}\">#{link}</a>"
else
"<a rel=\"nofollow\" href=\"#{link}\">#{link}</a>"
end
end
end
end
class Text < Base