Class: Codegen::HtmlGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/bkmrq/codegen/html_generator.rb

Class Method Summary collapse

Class Method Details

.divObject



14
15
16
17
18
# File 'lib/bkmrq/codegen/html_generator.rb', line 14

def self.div
  <<-HTML
  <div>#{yield}</div>
  HTML
end

.header(text, level) ⇒ Object



9
10
11
12
# File 'lib/bkmrq/codegen/html_generator.rb', line 9

def self.header(text, level)
  level = 6 if level > 6
  "<h#{level}>#{text}</h#{level}>"
end


5
6
7
# File 'lib/bkmrq/codegen/html_generator.rb', line 5

def self.link(text, url)
  "<a href=\"#{url}\" target=\"_blank\" rel=\"noopener noreferrer\">#{text}</a>"
end

.paragraphObject



20
21
22
23
24
# File 'lib/bkmrq/codegen/html_generator.rb', line 20

def self.paragraph
  <<-HTML
  <p>#{yield}</p>
  HTML
end