Class: PostHTMLRender

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Includes:
ActionView::Helpers::AssetTagHelper, Rouge::Plugins::Redcarpet
Defined in:
lib/simpleblog.rb

Instance Method Summary collapse

Instance Method Details

#image(link, title, alt_text) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/simpleblog.rb', line 17

def image(link, title, alt_text)
  if title =~ /=(\d+)x(\d+)/
    %(<img src="#{ActionController::Base.helpers.asset_path(link)}" alt="#{alt_text}" class="markdown-image" style="max-width: #{$1}px; max-height:#{$2}px">)
  else
    %(<img src="#{ActionController::Base.helpers.asset_path(link)}" alt="#{alt_text}" class="markdown-image">)
  end
end