Sha256: 3d4b667bfb94a1ff4371da0097352be54761d28d9463cfee7be8a4993cac39c5

Contents?: true

Size: 978 Bytes

Versions: 4

Compression:

Stored size: 978 Bytes

Contents

# frozen_string_literal: true

require_relative "../table"

module Plurimath
  module Math
    module Function
      class Table
        class Eqarray < Table
          def initialize(value = [],
                         open_paren = "",
                         close_paren = "",
                         options = {})
            super
          end

          def to_unicodemath
            "#{open_paren&.to_unicodemath}█(#{value&.map(&:to_unicodemath).join("@")})#{close_paren&.to_unicodemath}"
          end

          def to_mathml_without_math_tag(intent)
            matrix = super
            set_table_intent(matrix) if intent
            matrix["intent"] = ":equations" if intent
            matrix
          end

          private

          def set_table_intent(tag)
            matrix = tag.nodes.find { |tag| tag.name == "mtable" }
            return unless matrix

            matrix["intent"] = ":cases"
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plurimath-0.8.14 lib/plurimath/math/function/table/eqarray.rb
plurimath-0.8.13 lib/plurimath/math/function/table/eqarray.rb
plurimath-0.8.12 lib/plurimath/math/function/table/eqarray.rb
plurimath-0.8.11 lib/plurimath/math/function/table/eqarray.rb