Sha256: 3e0760bbbc61a6e04dc5a21ed8c1a8b967104dc19303872b33de34cb4f865dfd

Contents?: true

Size: 1015 Bytes

Versions: 7

Compression:

Stored size: 1015 Bytes

Contents

# frozen_string_literal: true

require_relative "../table"

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

          def to_unicodemath(options:)
            unicode_value = value.map { |val| val.to_unicodemath(options: options) }.join("@")
            "Ⓒ(#{unicode_value})"
          end

          def to_mathml_without_math_tag(intent, **)
            table_tag = super
            set_table_intent(table_tag) if intent
            table_tag.attributes["intent"] = intent_names[:equations] if intent
            table_tag
          end

          private

          def set_table_intent(tag)
            table = tag.nodes.find { |tag| tag.name == "mtable" }
            table["intent"] = intent_names[:cases]
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
plurimath-0.8.23 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.22 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.21 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.20 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.19 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.18 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.17 lib/plurimath/math/function/table/cases.rb