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.34 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.33 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.32 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.31 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.30 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.29 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.28 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.27 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.26 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.25 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.24 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.23 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.22 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.21 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.20 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.19 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.18 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.17 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.16 lib/stepmod/utils/converters/sup.rb
stepmod-utils-0.3.15 lib/stepmod/utils/converters/sup.rb