Sha256: 81b50199aec67ffe807245988be91666268eb2da4547ebc42d8837b926bf59e4
Contents?: true
Size: 752 Bytes
Versions: 11
Compression:
Stored size: 752 Bytes
Contents
require 'jsduck/util/null_object' require 'jsduck/util/io' module JsDuck class Welcome # Creates Welcome object from filename. def self.create(filename, doc_formatter) if filename Welcome.new(filename, doc_formatter) else Util::NullObject.new(:to_html => "") end end # Parses welcome HTML or Markdown file with content for welcome page. 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 # Returns the HTML def to_html(style="") "<div id='welcome-content' style='#{style}'>#{@html}</div>" end end end
Version data entries
11 entries across 11 versions & 1 rubygems