Module: Haid

Defined in:
lib/haid.rb,
lib/haid/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.html_gen(content, file_name: 'index.html', bypass_html: false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/haid.rb', line 8

def self.html_gen(content, file_name: 'index.html', bypass_html: false)
  content = Sanitize.fragment(content) unless bypass_html
  File.open(file_name, 'w+') do |file|
    html = <<-HTML
      <!DOCTYPE html>
      <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>#{file_name}</title>
      </head>
      <body>
        <div class="content">
          #{content}
        </div>
      </body>
      </html>
    HTML
    file.write(html)
  end
end