Module: Haid

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

Defined Under Namespace

Classes: File

Constant Summary collapse

VERSION =
"0.1.2"

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 = "      <!DOCTYPE html>\n      <html lang=\"en\">\n      <head>\n        <meta charset=\"UTF-8\">\n        <title>\#{file_name}</title>\n      </head>\n      <body>\n        <div class=\"content\">\n          \#{content}\n        </div>\n      </body>\n      </html>\n    HTML\n    file.write(html)\n  end\nend\n"