Class: Nanoc2::Filters::RDoc

Inherits:
Nanoc2::Filter show all
Defined in:
lib/nanoc2/filters/rdoc.rb

Constant Summary

Constants inherited from Nanoc2::Filter

Nanoc2::Filter::EXTENSIONS_MAP

Constants inherited from Plugin

Plugin::MAP

Instance Method Summary collapse

Methods inherited from Nanoc2::Filter

#assigns, #filename, #initialize

Methods inherited from Plugin

identifier, identifiers, named, register

Constructor Details

This class inherits a constructor from Nanoc2::Filter

Instance Method Details

#run(content) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nanoc2/filters/rdoc.rb', line 6

def run(content)
  begin
    # new RDoc
    require 'rdoc/markup'
    require 'rdoc/markup/to_html'
    
    ::RDoc::Markup.new.convert(content, ::RDoc::Markup::ToHtml.new)
  rescue LoadError
    # old RDoc
    require 'rdoc/markup/simple_markup'
    require 'rdoc/markup/simple_markup/to_html'

    ::SM::SimpleMarkup.new.convert(content, ::SM::ToHtml.new)
  end
end