Sha256: 2ac0465b00b8eedf7a4022d5ebb569a4cdd0b5121144c1dae0c0191da34e4a79

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

require "reverse_adoc"
require "stepmod/utils/converters/a"
require "stepmod/utils/converters/blockquote"
require "stepmod/utils/converters/br"
require "stepmod/utils/converters/bypass"
require "stepmod/utils/converters/code"
require "stepmod/utils/converters/drop"
require "stepmod/utils/converters/em_express_description"
require "stepmod/utils/converters/example"
require "stepmod/utils/converters/express_ref_express_description"
require "stepmod/utils/converters/ext_description"
require "stepmod/utils/converters/ext_descriptions"
require "stepmod/utils/converters/head"
require "stepmod/utils/converters/hr"
require "stepmod/utils/converters/ignore"
require "stepmod/utils/converters/module_ref_express_description"
require "stepmod/utils/converters/note"
require "stepmod/utils/converters/p"
require "stepmod/utils/converters/pass_through"
require "stepmod/utils/converters/q"
require "stepmod/utils/converters/strong"
require "stepmod/utils/converters/sub"
require "stepmod/utils/converters/sup"
require "stepmod/utils/converters/text"
require "stepmod/utils/cleaner"

module Stepmod
  module Utils
    class SmrlDescriptionConverter
      def self.convert(input, options = {})
        root = case input
               when String
                 Nokogiri::XML(input).root
               when Nokogiri::XML::Document
                 input.root
               when Nokogiri::XML::Node
                 input
               end

        root || (return "")

        ReverseAdoc.config.with(options) do
          result = ReverseAdoc::Converters.lookup(root.name).convert(root, options)
          Stepmod::Utils::Cleaner.new.tidy(result)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stepmod-utils-0.3.24 lib/stepmod/utils/smrl_description_converter.rb
stepmod-utils-0.3.23 lib/stepmod/utils/smrl_description_converter.rb