Sha256: 9a100cb748dc5499ed9b1541a908f637f8f6cf974bb043b4c97031f6de1d5ec6

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

require_relative "unary_function"

module Plurimath
  module Math
    module Function
      class Sqrt < UnaryFunction
        def to_mathml_without_math_tag
          sqrt_tag = Utility.ox_element("msqrt")
          Utility.update_nodes(
            sqrt_tag,
            Array(parameter_one&.to_mathml_without_math_tag),
          )
          sqrt_tag
        end

        def to_omml_without_math_tag(display_style)
          rad_element = Utility.ox_element("rad", namespace: "m")
          pr_element = Utility.ox_element("radPr", namespace: "m")
          pr_element << Utility.ox_element(
            "degHide",
            namespace: "m",
            attributes: { "m:val": "1" },
          )
          Utility.update_nodes(
            rad_element,
            [
              (pr_element << Utility.pr_element("ctrl", true, namespace: "m")),
              Utility.ox_element("deg", namespace: "m"),
              omml_parameter(parameter_one, display_style, tag_name: "e"),
            ],
          )
          [rad_element]
        end

        def line_breaking(obj)
          parameter_one&.line_breaking(obj)
          obj.update(Utility.filter_values(obj.value)) if obj.value_exist?
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plurimath-0.7.2 lib/plurimath/math/function/sqrt.rb
plurimath-0.7.1 lib/plurimath/math/function/sqrt.rb
plurimath-0.7.0 lib/plurimath/math/function/sqrt.rb