Sha256: 9d0e543af56ae02c96c0a25f6e56017ad530e5eb78d8b62083749663b1035dc6

Contents?: true

Size: 1021 Bytes

Versions: 4

Compression:

Stored size: 1021 Bytes

Contents

# frozen_string_literal: true

require_relative "unary_function"

module Plurimath
  module Math
    module Function
      class Right < UnaryFunction
        def to_asciimath
          "right#{parameter_one}"
        end

        def to_mathml_without_math_tag
          mo = Utility.ox_element("mo")
          mo << right_paren if parameter_one
          mo
        end

        def to_omml_without_math_tag
          mr = Utility.ox_element("m:r")
          if parameter_one
            mt = Utility.ox_element("m:t")
            mr << (mt << parameter_one)
          end
          [mr]
        end

        def to_html
          "<i>#{parameter_one}</i>"
        end

        def to_latex
          "\\right #{Latex::Constants::LEFT_RIGHT_PARENTHESIS.invert[parameter_one] || '.'}"
        end

        def validate_function_formula
          false
        end

        protected

        def right_paren
          return "}" if parameter_one == "\\}"

          parameter_one
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plurimath-0.3.9 lib/plurimath/math/function/right.rb
plurimath-0.3.8 lib/plurimath/math/function/right.rb
plurimath-0.3.7 lib/plurimath/math/function/right.rb
plurimath-0.3.6 lib/plurimath/math/function/right.rb