Sha256: 4d4963f37ac3b6279c44d16333aa314ab138476ee49af6b2a6a134f05903740e

Contents?: true

Size: 522 Bytes

Versions: 28

Compression:

Stored size: 522 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

28 entries across 28 versions & 1 rubygems

Version Path
stepmod-utils-0.3.14 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.13 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.12 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.11 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.10 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.9 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.8 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.7 lib/stepmod/utils/converters/sup.rb