Sha256: 7bf8a7697c83102de1758987b9160ac66ff6dd85c6f7b17e30591f799323915c

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Plurimath
  module Math
    class Core
      def class_name
        self.class.name.split("::").last.downcase
      end

      def insert_t_tag
        Array(to_omml_without_math_tag)
      end

      def tag_name
        "subsup"
      end

      def omml_tag_name
        "subSup"
      end

      def nary_attr_value
        ""
      end

      def empty_tag(wrapper_tag)
        r_tag = Utility.ox_element("r", namespace: "m")
        r_tag << (Utility.ox_element("t", namespace: "m") << "&#8203;")
        wrapper_tag << r_tag
      end

      def omml_parameter(field, tag_name: , namespace: "m")
        tag = Utility.ox_element(tag_name, namespace: namespace)
        return empty_tag(tag) unless field

        Utility.update_nodes(
          tag,
          field&.insert_t_tag,
        )
      end

      def validate_function_formula
        true
      end

      def r_element(string, rpr_tag: true)
        r_tag = Utility.ox_element("r", namespace: "m")
        if rpr_tag
          sty_tag = Utility.ox_element("sty", namespace: "m", attributes: { "m:val": "p" })
          r_tag << (Utility.ox_element("rPr", namespace: "m") << sty_tag)
        end
        r_tag << (Utility.ox_element("t", namespace: "m") << string)
        Array(r_tag)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plurimath-0.3.9 lib/plurimath/math/core.rb