Sha256: 011ca8966b18e45248cd67b61e78dfb8f82c093997c9253e0d5d22de6200658b
Contents?: true
Size: 1.9 KB
Versions: 7
Compression:
Stored size: 1.9 KB
Contents
# frozen_string_literal: true require_relative "unary_function" module Plurimath module Math module Function class Tilde < UnaryFunction attr_accessor :attributes def initialize(parameter_one = nil, attributes = {}) super(parameter_one) @attributes = attributes end def to_mathml_without_math_tag mover = Utility.ox_element("mover") mover[:accent] = attributes[:accent] if attributes && attributes[:accent] first_value = (Utility.ox_element("mo") << "~") second_value = parameter_one.to_mathml_without_math_tag if parameter_one Utility.update_nodes(mover, [second_value, first_value]) end def to_omml_without_math_tag(display_style) return r_element("~", rpr_tag: false) unless parameter_one if attributes && attributes[:accent] acc_tag(display_style) else symbol = Symbols::Symbol.new("~") Overset.new(parameter_one, symbol).to_omml_without_math_tag(true) end end def validate_function_formula false end def to_unicodemath "#{unicodemath_parens(parameter_one)}̃" end def line_breaking(obj) parameter_one&.line_breaking(obj) obj.update(Utility.filter_values(obj.value)) if obj.value_exist? end protected def acc_tag(display_style) acc_tag = Utility.ox_element("acc", namespace: "m") acc_pr_tag = Utility.ox_element("accPr", namespace: "m") acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "˜" })) Utility.update_nodes( acc_tag, [ acc_pr_tag, omml_parameter(parameter_one, display_style, tag_name: "e"), ], ) [acc_tag] end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems