Class: ReverseAsciidoctor::SmrlDescriptionConverter

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

Class Method Summary collapse

Class Method Details

.convert(input, options = {}) ⇒ Object



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

def self.convert(input, options = {})
  root = if input.is_a?(String)
            then Nokogiri::XML(input).root
          elsif input.is_a?(Nokogiri::XML::Document)
            then input.root
          elsif input.is_a?(Nokogiri::XML::Node)
            then input
          end

  root || (return '')

  ReverseAsciidoctor.config.with(options) do
    result = ReverseAsciidoctor::Converters.lookup(root.name).convert(root)
    ReverseAsciidoctor.cleaner.tidy(result)
  end
end