Class: Malt::Engine::RDoc

Inherits:
Abstract show all
Defined in:
lib/malt/engines/rdoc.rb

Overview

RDoc template.

http://rdoc.rubyforge.org/

It's suggested that your program require 'rdoc/markup' and 'rdoc/markup/to_html' at load time when using this template engine.

Instance Attribute Summary

Attributes inherited from Abstract

#settings

Instance Method Summary collapse

Methods inherited from Abstract

#cache?, default, #initialize, #prepare_engine, register, type

Constructor Details

This class inherits a constructor from Malt::Engine::Abstract

Instance Method Details

#create_engine(params = {}) ⇒ Object


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/malt/engines/rdoc.rb', line 29

def create_engine(params={})
  into = parameters(params, :to)

  opts = engine_options(params)
  opts['rdoc_include'] = []
  opts['static_path']  = []

  rdoc_opts = ::RDoc::Options.new
  rdoc_opts.init_with(opts)

  # TODO: Do we need to cache on options too (if there ever are any)?
  cached(into) do
    ::RDoc::Markup::ToHtml.new(rdoc_opts)
  end
end

#render(params = {}) ⇒ Object

Convert rdoc text to html.


17
18
19
20
21
22
23
24
25
26
# File 'lib/malt/engines/rdoc.rb', line 17

def render(params={})
  into, text = parameters(params, :to, :text)

  case into
  when :html, nil
    prepare_engine(params).convert(text).to_s
  else
    super(params)
  end
end