Class: ArticleHTMLRender

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



9
10
11
12
13
14
15
# File 'lib/simpleblog.rb', line 9

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