Sha256: a59df99d6524731596fe54150293589fd878fd49936890b463d7cc31d9faccd8

Contents?: true

Size: 513 Bytes

Versions: 10

Compression:

Stored size: 513 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 state[:equation]

          "#{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

10 entries across 10 versions & 1 rubygems

Version Path
stepmod-utils-0.4.8 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.4.7 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.4.6 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.4.5 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.4.2 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.4.1 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.4.0 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.37 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.36 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.35 lib/stepmod/utils/converters/sup.rb