module ReverseAsciidoctor

Constants

VERSION

Public Class Methods

cleaner() click to toggle source
# File lib/reverse_asciidoctor.rb, line 66
def self.cleaner
  @cleaner ||= Cleaner.new
end
config() { |config| ... } click to toggle source
# File lib/reverse_asciidoctor.rb, line 60
def self.config
  @config ||= Config.new
  yield @config if block_given?
  @config
end
convert(input, options = {}) click to toggle source
# File lib/reverse_asciidoctor.rb, line 45
def self.convert(input, options = {})
  root = case input
    when String                  then Nokogiri::HTML(input).root
    when Nokogiri::XML::Document then input.root
    when Nokogiri::XML::Node     then input
  end

  root or return ''

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