Class: TomDoc::Generators::HTML

Inherits:
TomDoc::Generator show all
Defined in:
lib/tomdoc/generators/html.rb

Instance Attribute Summary

Attributes inherited from TomDoc::Generator

#options, #scopes

Instance Method Summary collapse

Methods inherited from TomDoc::Generator

#constant?, #constant_names, generate, #generate, #initialize, #matches_pattern?, #process, #pygments, #valid?, #valid_tomdoc?, #write, #write_scope

Constructor Details

This class inherits a constructor from TomDoc::Generator

Instance Method Details

#highlight(text) ⇒ Object



4
5
6
# File 'lib/tomdoc/generators/html.rb', line 4

def highlight(text)
  pygments(text, '-l', 'ruby', '-f', 'html')
end

#write_class_methods(scope, prefix) ⇒ Object



15
16
17
18
19
# File 'lib/tomdoc/generators/html.rb', line 15

def write_class_methods(scope, prefix)
  out = '<ul>'
  out << super.join
  write out
end

#write_instance_methods(scope, prefix) ⇒ Object



21
22
23
24
25
26
# File 'lib/tomdoc/generators/html.rb', line 21

def write_instance_methods(scope, prefix)
  out = ''
  out << super.join
  out << '</ul>'
  write out
end

#write_method(method, prefix = '') ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/tomdoc/generators/html.rb', line 28

def write_method(method, prefix = '')
  if method.args.any?
    args = '(' + method.args.join(', ') + ')'
  end
  out = '<li>'
  out << "<b>#{prefix}#{method.to_s}#{args}</b>"

  out << '<pre>'
  out << method.tomdoc.tomdoc
  out << '</pre>'

  out << '</li>'
end


12
13
# File 'lib/tomdoc/generators/html.rb', line 12

def write_scope_footer(scope, prefix)
end

#write_scope_header(scope, prefix) ⇒ Object



8
9
10
# File 'lib/tomdoc/generators/html.rb', line 8

def write_scope_header(scope, prefix)
  #write "<h1>#{scope.name}</h1>"
end