lib/plurimath/math/formula.rb in plurimath-0.8.11 vs lib/plurimath/math/formula.rb in plurimath-0.8.12
- old
+ new
@@ -8,10 +8,11 @@
MATH_ZONE_TYPES = %i[
omml
latex
mathml
asciimath
+ unicodemath
].freeze
POWER_BASE_CLASSES = %w[powerbase power base].freeze
DERIVATIVE_CONSTS = [
"𝑑",
"ⅅ",
@@ -163,10 +164,12 @@
" |_ \"#{to_latex}\"\n#{to_latex_math_zone(" ").join}"
when :mathml
" |_ \"#{to_mathml.gsub(/\n\s*/, "")}\"\n#{to_mathml_math_zone(" ").join}"
when :omml
" |_ \"#{to_omml.gsub(/\n\s*/, "")}\"\n#{to_omml_math_zone(" ", display_style: displaystyle).join}"
+ when :unicodemath
+ " |_ \"#{to_unicodemath}\"\n#{to_unicodemath_math_zone(" ").join}"
end
<<~MATHZONE.sub(/\n$/, "")
|_ Math zone
#{math_zone}
MATHZONE
@@ -195,9 +198,16 @@
def to_omml_math_zone(spacing = "", last = false, indent = true, display_style:)
filtered_values(value, lang: :omml).map.with_index(1) do |object, index|
last = index == @values.length
object.to_omml_math_zone(new_space(spacing, indent), last, indent, display_style: display_style)
+ end
+ end
+
+ def to_unicodemath_math_zone(spacing = "", last = false, indent = true)
+ filtered_values(value, lang: :unicodemath).map.with_index(1) do |object, index|
+ last = index == @values.length
+ object.to_unicodemath_math_zone(new_space(spacing, indent), last, indent)
end
end
def extract_class_name_from_text
return unless value.length < 2 && value.first.is_a?(Function::Text)