Class: Redcarpet::Render::MsfMdHTML

Inherits:
HTML
  • Object
show all
Defined in:
lib/msf/util/document_generator/document_normalizer.rb

Instance Method Summary collapse

Instance Method Details

#block_code(code, language) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/msf/util/document_generator/document_normalizer.rb', line 8

def block_code(code, language)
  code = $1 if code =~ /^<ruby>(.+)<\/ruby>/m

  "<pre>" \
    "<code>#{CGI.escape_html(code)}</code>" \
  "</pre>"
end

#header(text, header_level) ⇒ Object



29
30
31
# File 'lib/msf/util/document_generator/document_normalizer.rb', line 29

def header(text, header_level)
  %Q|<h#{header_level}>#{text}</h#{header_level}><hr>|
end

#list(content, list_type) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/msf/util/document_generator/document_normalizer.rb', line 17

def list(content, list_type)
  if list_type == :unordered && content.scan(/<li>/).flatten.length > 15
    %Q|<p><div id=\"long_list\"><ul>#{content}<ul></div></p>|
  elsif list_type == :unordered
    %Q|<ul>#{content}</ul>|
  elsif list_type == :ordered
    %Q|<ol>#{content}</ol>|
  else
    content
  end
end

#table(header, body) ⇒ Object



33
34
35
# File 'lib/msf/util/document_generator/document_normalizer.rb', line 33

def table(header, body)
  %Q|<table class="kb_table" cellpadding="5" cellspacing="2" border="1">#{header}#{body}</table><br>|
end