Class: SM::ToHtml

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc_patch.rb

Instance Method Summary collapse

Instance Method Details

#accept_pure_html(am, fragment) ⇒ Object



91
92
93
# File 'lib/rdoc_patch.rb', line 91

def accept_pure_html(am, fragment)
  @res << fragment.txt
end

#accept_pure_ruby(am, fragment) ⇒ Object



95
96
97
# File 'lib/rdoc_patch.rb', line 95

def accept_pure_ruby(am, fragment)
  @res << eval(fragment.txt)
end

#accept_transclude(am, fragment) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/rdoc_patch.rb', line 74

def accept_transclude(am, fragment)
  if @context.context.parent and
      (found = find_method_contents(@context.context.parent.in_files, *fragment.txt.split('#')))
    @res << '<pre style="background-color: white">'
    #  to do: hilite syntax; make method name clickable
    found.each_with_index do |tok, index|
      next if 0 == index and tok.text =~ /^\#/
      next if 1 == index and tok.text == "\n"
      @res << tok.to_html
    end
    @res << '</pre>'
  else
    raise "missing transclusion: #{ fragment.inspect }"
    @res << fragment.txt
  end
end