Sha256: 6560c9f22e67522b99e7d328533efb8fcf7ecabe88c6fd070cbde079cff320a4

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require_relative "binary_function"

module Plurimath
  module Math
    module Function
      class Color < BinaryFunction
        def to_asciimath
          first_value = "(#{parameter_one&.to_asciimath&.gsub(/\s/, '')})"
          second_value = "(#{parameter_two&.to_asciimath})"
          "color#{first_value}#{second_value}"
        end

        def to_mathml_without_math_tag
          Utility.update_nodes(
            Utility.ox_element(
              "mstyle",
              attributes: { mathcolor: parameter_one&.to_asciimath&.gsub(/\s/, "")&.gsub(/"/, "") },
            ),
            [parameter_two&.to_mathml_without_math_tag],
          )
        end

        def to_latex
          first_value = parameter_one&.to_asciimath&.gsub(/\s/, "")
          second_value = parameter_two&.to_latex
          "{\\#{class_name}{#{first_value}} #{second_value}}"
        end

        def to_omml_without_math_tag
          Array(parameter_two.insert_t_tag)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plurimath-0.3.9 lib/plurimath/math/function/color.rb
plurimath-0.3.8 lib/plurimath/math/function/color.rb