Class: Gollum::Macro::Note

Inherits:
Gollum::Macro show all
Defined in:
lib/gollum-lib/macro/note.rb

Instance Method Summary collapse

Methods inherited from Gollum::Macro

#initialize, instance

Constructor Details

This class inherits a constructor from Gollum::Macro

Instance Method Details

#render(notice, octicon = 'info') ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gollum-lib/macro/note.rb', line 4

def render(notice, octicon = 'info')
  icon = ""
  unless octicon.empty?
    begin
      icon = Octicons::Octicon.new(octicon, {width: 24, height: 24})
    rescue RuntimeError
      icon = Octicons::Octicon.new('info', {width: 24, height: 24})
    end
    icon.options[:class] << ' mr-2'
    icon = icon.to_svg
  end
  "<div class='flash'>#{icon}#{notice}</div>"
end