Class: CustomRender

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Defined in:
app/models/custom_render.rb

Instance Method Summary collapse

Instance Method Details



2
3
4
5
6
7
8
9
10
# File 'app/models/custom_render.rb', line 2

def link(link, title, content)
  if link =~ /^[a-z0-9]{24}$/
    page    = Page.find(link)
    title   ||= page.title
    content ||= page.title
    link    = page.path
  end
  "<a href='#{link}'>#{content}</a>"
end