Sha256: 88b626f19a0f5a9db96363ba90792908774983e1d11a320c8485227a9d9722d5

Contents?: true

Size: 1.81 KB

Versions: 9

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

require 'reverse_adoc'
require 'stepmod/utils/converters/clause_ref'
require 'stepmod/utils/converters/express_ref'
require 'stepmod/utils/converters/module_ref'
require 'stepmod/utils/converters/def'
require 'stepmod/utils/converters/definition'
require 'stepmod/utils/converters/em'
require 'stepmod/utils/converters/example'
require 'stepmod/utils/converters/note'
require 'stepmod/utils/converters/ol'
require 'stepmod/utils/converters/stem'
require 'stepmod/utils/converters/term'
require 'stepmod/utils/converters/synonym'

require 'reverse_adoc/converters/a'
require 'reverse_adoc/converters/blockquote'
require 'reverse_adoc/converters/bypass'
require 'reverse_adoc/converters/br'
require 'reverse_adoc/converters/code'
require 'reverse_adoc/converters/drop'
require 'reverse_adoc/converters/head'
require 'reverse_adoc/converters/hr'
require 'reverse_adoc/converters/ignore'
require 'reverse_adoc/converters/li'
require 'reverse_adoc/converters/p'
require 'reverse_adoc/converters/pass_through'
require 'reverse_adoc/converters/q'
require 'reverse_adoc/converters/strong'
require 'reverse_adoc/converters/sup'
require 'reverse_adoc/converters/sub'
require 'reverse_adoc/converters/text'


module Stepmod
  module Utils
    class StepmodDefinitionConverter
      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 '')

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
stepmod-utils-0.2.7 lib/stepmod/utils/stepmod_definition_converter.rb
stepmod-utils-0.2.6 lib/stepmod/utils/stepmod_definition_converter.rb
stepmod-utils-0.2.5 lib/stepmod/utils/stepmod_definition_converter.rb
stepmod-utils-0.2.4 lib/stepmod/utils/stepmod_definition_converter.rb
stepmod-utils-0.2.3 lib/stepmod/utils/stepmod_definition_converter.rb
stepmod-utils-0.2.0 lib/stepmod/utils/stepmod_definition_converter.rb
stepmod-utils-0.1.8 lib/stepmod/utils/stepmod_definition_converter.rb
stepmod-utils-0.1.7 lib/stepmod/utils/stepmod_definition_converter.rb
stepmod-utils-0.1.6 lib/stepmod/utils/stepmod_definition_converter.rb