Sha256: 43369c6e90b174675152c9ef9559068ff13057e81e08840e0a78ccd4fe3ed1d3

Contents?: true

Size: 521 Bytes

Versions: 8

Compression:

Stored size: 521 Bytes

Contents

# frozen_string_literal: true

module Stepmod
  module Utils
    module Converters
      class Sup < ReverseAdoc::Converters::Base
        def convert(node, state = {})
          content = treat_children(node, state)
          return stem_notation(content) if node.parent.name == 'eqn'

          "#{content[/^\s*/]}^#{content.strip}^#{content[/\s*$/]}"
        end

        def stem_notation(content)
          "^{#{content}}"
        end
      end

      ReverseAdoc::Converters.register :sup, Sup.new
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
stepmod-utils-0.3.5 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.4 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.2 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.1 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.0 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.2.7 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.2.6 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.2.5 lib/stepmod/utils/converters/sup.rb