class JsDuck::Welcome
Public Class Methods
create(filename, doc_formatter)
click to toggle source
Creates Welcome
object from filename.
# File lib/jsduck/welcome.rb, line 8 def self.create(filename, doc_formatter) if filename Welcome.new(filename, doc_formatter) else Util::NullObject.new(:to_html => "") end end
new(filename, doc_formatter)
click to toggle source
Parses welcome HTML or Markdown file with content for welcome page.
# File lib/jsduck/welcome.rb, line 17 def initialize(filename, doc_formatter) @html = Util::IO.read(filename) if filename =~ /\.(md|markdown)\z/i @html = '<div class="markdown">' + doc_formatter.format(@html) + '</div>' end end
Public Instance Methods
to_html(style="")
click to toggle source
Returns the HTML
# File lib/jsduck/welcome.rb, line 25 def to_html(style="") "<div id='welcome-content' style='#{style}'>#{@html}</div>" end