plurimath 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec-opal +1 -1
- data/.rubocop.yml +9 -5
- data/.rubocop_todo.yml +0 -0
- data/Gemfile +7 -5
- data/Rakefile +11 -0
- data/lib/plurimath/asciimath/parse.rb +0 -1
- data/lib/plurimath/asciimath/parser.rb +0 -3
- data/lib/plurimath/asciimath.rb +5 -0
- data/lib/plurimath/errors.rb +0 -4
- data/lib/plurimath/formatter/numbers.rb +12 -0
- data/lib/plurimath/formatter/standard.rb +0 -1
- data/lib/plurimath/formatter.rb +6 -9
- data/lib/plurimath/html/parse.rb +0 -1
- data/lib/plurimath/html/parser.rb +0 -3
- data/lib/plurimath/html.rb +5 -0
- data/lib/plurimath/latex/parse.rb +0 -1
- data/lib/plurimath/latex/parser.rb +2 -5
- data/lib/plurimath/latex.rb +5 -0
- data/lib/plurimath/math/core.rb +6 -2
- data/lib/plurimath/math/formula/mrow.rb +2 -41
- data/lib/plurimath/math/formula/mstyle.rb +6 -0
- data/lib/plurimath/math/formula.rb +52 -301
- data/lib/plurimath/math/function/abs.rb +0 -1
- data/lib/plurimath/math/function/arccos.rb +0 -1
- data/lib/plurimath/math/function/arcsin.rb +0 -1
- data/lib/plurimath/math/function/arctan.rb +0 -1
- data/lib/plurimath/math/function/arg.rb +0 -1
- data/lib/plurimath/math/function/bar.rb +0 -1
- data/lib/plurimath/math/function/base.rb +0 -3
- data/lib/plurimath/math/function/binary_function.rb +5 -3
- data/lib/plurimath/math/function/cancel.rb +0 -1
- data/lib/plurimath/math/function/ceil.rb +0 -1
- data/lib/plurimath/math/function/color.rb +0 -1
- data/lib/plurimath/math/function/cos.rb +0 -1
- data/lib/plurimath/math/function/cosh.rb +0 -1
- data/lib/plurimath/math/function/cot.rb +0 -1
- data/lib/plurimath/math/function/coth.rb +0 -1
- data/lib/plurimath/math/function/csc.rb +0 -1
- data/lib/plurimath/math/function/csch.rb +0 -1
- data/lib/plurimath/math/function/ddot.rb +0 -1
- data/lib/plurimath/math/function/deg.rb +0 -1
- data/lib/plurimath/math/function/det.rb +0 -1
- data/lib/plurimath/math/function/dim.rb +0 -1
- data/lib/plurimath/math/function/dot.rb +0 -1
- data/lib/plurimath/math/function/exp.rb +0 -1
- data/lib/plurimath/math/function/fenced.rb +1 -197
- data/lib/plurimath/math/function/floor.rb +0 -1
- data/lib/plurimath/math/function/font_style/bold-fraktur.rb +0 -1
- data/lib/plurimath/math/function/font_style/bold-italic.rb +0 -1
- data/lib/plurimath/math/function/font_style/bold-sans-serif.rb +0 -1
- data/lib/plurimath/math/function/font_style/bold-script.rb +0 -1
- data/lib/plurimath/math/function/font_style/bold.rb +0 -1
- data/lib/plurimath/math/function/font_style/double_struck.rb +0 -1
- data/lib/plurimath/math/function/font_style/fraktur.rb +0 -1
- data/lib/plurimath/math/function/font_style/italic.rb +0 -1
- data/lib/plurimath/math/function/font_style/monospace.rb +0 -1
- data/lib/plurimath/math/function/font_style/normal.rb +0 -1
- data/lib/plurimath/math/function/font_style/sans-serif-bold-italic.rb +0 -1
- data/lib/plurimath/math/function/font_style/sans-serif-italic.rb +0 -1
- data/lib/plurimath/math/function/font_style/sans-serif.rb +0 -1
- data/lib/plurimath/math/function/font_style/script.rb +0 -1
- data/lib/plurimath/math/function/font_style.rb +29 -2
- data/lib/plurimath/math/function/frac.rb +0 -3
- data/lib/plurimath/math/function/gcd.rb +0 -1
- data/lib/plurimath/math/function/glb.rb +0 -1
- data/lib/plurimath/math/function/hat.rb +0 -1
- data/lib/plurimath/math/function/hom.rb +0 -1
- data/lib/plurimath/math/function/inf.rb +1 -2
- data/lib/plurimath/math/function/int.rb +2 -3
- data/lib/plurimath/math/function/intent.rb +0 -1
- data/lib/plurimath/math/function/ker.rb +0 -1
- data/lib/plurimath/math/function/lcm.rb +0 -1
- data/lib/plurimath/math/function/left.rb +0 -1
- data/lib/plurimath/math/function/lg.rb +0 -1
- data/lib/plurimath/math/function/lim.rb +1 -2
- data/lib/plurimath/math/function/liminf.rb +0 -1
- data/lib/plurimath/math/function/limits.rb +0 -1
- data/lib/plurimath/math/function/limsup.rb +0 -1
- data/lib/plurimath/math/function/linebreak.rb +0 -1
- data/lib/plurimath/math/function/ln.rb +0 -1
- data/lib/plurimath/math/function/log.rb +1 -2
- data/lib/plurimath/math/function/longdiv.rb +0 -3
- data/lib/plurimath/math/function/lub.rb +0 -1
- data/lib/plurimath/math/function/max.rb +0 -1
- data/lib/plurimath/math/function/mbox.rb +0 -1
- data/lib/plurimath/math/function/menclose.rb +0 -3
- data/lib/plurimath/math/function/merror.rb +0 -3
- data/lib/plurimath/math/function/mglyph.rb +0 -3
- data/lib/plurimath/math/function/min.rb +0 -1
- data/lib/plurimath/math/function/mlabeledtr.rb +0 -20
- data/lib/plurimath/math/function/mod.rb +0 -1
- data/lib/plurimath/math/function/mpadded.rb +0 -3
- data/lib/plurimath/math/function/ms.rb +1 -77
- data/lib/plurimath/math/function/msgroup.rb +0 -27
- data/lib/plurimath/math/function/msline.rb +0 -3
- data/lib/plurimath/math/function/multiscript.rb +0 -14
- data/lib/plurimath/math/function/nary.rb +4 -0
- data/lib/plurimath/math/function/none.rb +1 -4
- data/lib/plurimath/math/function/norm.rb +0 -1
- data/lib/plurimath/math/function/obrace.rb +0 -1
- data/lib/plurimath/math/function/oint.rb +2 -3
- data/lib/plurimath/math/function/over.rb +0 -3
- data/lib/plurimath/math/function/overset.rb +3 -3
- data/lib/plurimath/math/function/phantom.rb +0 -3
- data/lib/plurimath/math/function/power.rb +0 -3
- data/lib/plurimath/math/function/power_base.rb +0 -3
- data/lib/plurimath/math/function/prod.rb +2 -3
- data/lib/plurimath/math/function/right.rb +0 -1
- data/lib/plurimath/math/function/root.rb +0 -3
- data/lib/plurimath/math/function/rule.rb +0 -1
- data/lib/plurimath/math/function/scarries.rb +0 -3
- data/lib/plurimath/math/function/scarry.rb +22 -0
- data/lib/plurimath/math/function/sec.rb +0 -1
- data/lib/plurimath/math/function/sech.rb +0 -1
- data/lib/plurimath/math/function/semantics.rb +0 -15
- data/lib/plurimath/math/function/sin.rb +0 -1
- data/lib/plurimath/math/function/sinh.rb +0 -1
- data/lib/plurimath/math/function/sqrt.rb +0 -3
- data/lib/plurimath/math/function/stackrel.rb +0 -3
- data/lib/plurimath/math/function/substack.rb +0 -1
- data/lib/plurimath/math/function/sum.rb +2 -3
- data/lib/plurimath/math/function/sup.rb +0 -1
- data/lib/plurimath/math/function/table/align.rb +0 -1
- data/lib/plurimath/math/function/table/array.rb +0 -1
- data/lib/plurimath/math/function/table/bmatrix.rb +0 -1
- data/lib/plurimath/math/function/table/cases.rb +0 -1
- data/lib/plurimath/math/function/table/eqarray.rb +0 -1
- data/lib/plurimath/math/function/table/matrix.rb +0 -1
- data/lib/plurimath/math/function/table/multline.rb +0 -1
- data/lib/plurimath/math/function/table/pmatrix.rb +0 -1
- data/lib/plurimath/math/function/table/split.rb +0 -1
- data/lib/plurimath/math/function/table/vmatrix.rb +0 -1
- data/lib/plurimath/math/function/table.rb +10 -23
- data/lib/plurimath/math/function/tan.rb +0 -1
- data/lib/plurimath/math/function/tanh.rb +0 -1
- data/lib/plurimath/math/function/td.rb +0 -4
- data/lib/plurimath/math/function/ternary_function.rb +6 -2
- data/lib/plurimath/math/function/text.rb +0 -5
- data/lib/plurimath/math/function/tilde.rb +4 -1
- data/lib/plurimath/math/function/tr.rb +0 -13
- data/lib/plurimath/math/function/ubrace.rb +0 -1
- data/lib/plurimath/math/function/ul.rb +4 -1
- data/lib/plurimath/math/function/underover.rb +0 -3
- data/lib/plurimath/math/function/underset.rb +22 -45
- data/lib/plurimath/math/function/unitsml.rb +2 -1
- data/lib/plurimath/math/function/vec.rb +4 -1
- data/lib/plurimath/math/function.rb +107 -10
- data/lib/plurimath/math/number.rb +1 -4
- data/lib/plurimath/math/symbols/comma.rb +1 -1
- data/lib/plurimath/math/symbols/plus.rb +1 -1
- data/lib/plurimath/math/symbols/symbol.rb +17 -4
- data/lib/plurimath/math.rb +8 -26
- data/lib/plurimath/mathml/formula_transformation.rb +442 -0
- data/lib/plurimath/mathml/parser.rb +11 -50
- data/lib/plurimath/mathml/translator.rb +584 -0
- data/lib/plurimath/mathml/utility/formula_transformation.rb +2 -341
- data/lib/plurimath/mathml.rb +5 -0
- data/lib/plurimath/number_formatter.rb +2 -1
- data/lib/plurimath/omml/parser.rb +0 -1
- data/lib/plurimath/omml/transform.rb +2 -1
- data/lib/plurimath/omml.rb +3 -0
- data/lib/plurimath/setup/opal.rb.erb +3 -4
- data/lib/plurimath/unicode_math/parse.rb +0 -5
- data/lib/plurimath/unicode_math/parser.rb +1 -6
- data/lib/plurimath/unicode_math/parsing_rules/absence_rules.rb +0 -1
- data/lib/plurimath/unicode_math/parsing_rules/common_rules.rb +0 -1
- data/lib/plurimath/unicode_math/parsing_rules/constants_rules.rb +0 -1
- data/lib/plurimath/unicode_math/parsing_rules/masked.rb +0 -1
- data/lib/plurimath/unicode_math/parsing_rules/sub_sup.rb +0 -1
- data/lib/plurimath/unicode_math/parsing_rules.rb +14 -0
- data/lib/plurimath/unicode_math.rb +6 -0
- data/lib/plurimath/utility.rb +1 -1
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath/xml_engine/oga.rb +6 -6
- data/lib/plurimath/xml_engine/ox_engine.rb +2 -2
- data/lib/plurimath/xml_engine.rb +2 -0
- data/lib/plurimath.rb +43 -18
- data/plurimath.gemspec +5 -4
- metadata +33 -15
- data/lib/plurimath/mathml/utility/empty_defined_methods.rb +0 -483
- data/lib/plurimath/mathml/utility.rb +0 -369
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc005169c3f0268023980ba0d02d40a3e169c73ec1c75541f1ea71d8cadf6de6
|
|
4
|
+
data.tar.gz: 0d9fb467134da2b44ad20d1952d1795f4fa7e233a657b5589ea3b5cf5e99fb26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4d59a8681ab5b3b988d3a46ecfadc50661c43cc2d897816d943b3c621a6f8db202a8fca9b59c72fa732384284071aeec20851051b645cb7c29e4126fa0377d3
|
|
7
|
+
data.tar.gz: 54013f676433c00728a7b022b5c16ec3b77d2afd1949573ee56c0d90c936600289647cef2a886978e23da5be20af8d232dabf4e6ff9d3454dca77667f69d0f50
|
data/.rspec-opal
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
1
|
inherit_from:
|
|
4
2
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
|
3
|
+
- .rubocop_todo.yml
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
plugins:
|
|
6
|
+
- rubocop-performance
|
|
7
|
+
- rubocop-rake
|
|
8
|
+
- rubocop-rspec
|
|
8
9
|
|
|
9
10
|
AllCops:
|
|
10
|
-
TargetRubyVersion:
|
|
11
|
+
TargetRubyVersion: 3.0
|
|
12
|
+
NewCops: enable
|
|
13
|
+
Exclude:
|
|
14
|
+
- 'vendor/**/*'
|
data/.rubocop_todo.yml
ADDED
|
File without changes
|
data/Gemfile
CHANGED
|
@@ -3,12 +3,14 @@ source "https://rubygems.org"
|
|
|
3
3
|
# Specify your gem's dependencies in plurimath.gemspec
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
+
gem 'lutaml-model', github: "lutaml/lutaml-model", branch: "main"
|
|
7
|
+
gem 'canon'
|
|
6
8
|
gem "rake", "~> 12.0"
|
|
7
9
|
gem "rspec", "~> 3.0"
|
|
8
|
-
gem
|
|
9
|
-
gem
|
|
10
|
-
gem
|
|
11
|
-
gem 'opal-rspec', "~> 1.1.0a"
|
|
10
|
+
gem "rubocop-performance"
|
|
11
|
+
gem "rubocop-rake"
|
|
12
|
+
gem "rubocop-rspec"
|
|
12
13
|
gem 'oga'
|
|
14
|
+
gem 'opal-rspec', "~> 1.1.0a"
|
|
13
15
|
gem 'ox'
|
|
14
|
-
gem
|
|
16
|
+
gem 'simplecov', require: false, group: :test
|
data/Rakefile
CHANGED
|
@@ -105,7 +105,18 @@ def write_intent_doc_file(file)
|
|
|
105
105
|
file.write("\nIntent for unary classes like, sin, cos, tan, etc. will be `Function`.\n")
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
def require_math_function_files
|
|
109
|
+
(
|
|
110
|
+
Dir.glob(File.join(__dir__, "lib/plurimath/math/function", "*.rb")) +
|
|
111
|
+
Dir.glob(File.join(__dir__, "lib/plurimath/math/function", "*", "*.rb"))
|
|
112
|
+
).each do |file|
|
|
113
|
+
require file
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
108
117
|
def intent_classes
|
|
118
|
+
require_math_function_files
|
|
119
|
+
|
|
109
120
|
intent_classes = [
|
|
110
121
|
Plurimath::Math::Function::TernaryFunction.descendants,
|
|
111
122
|
Plurimath::Math::Function::BinaryFunction.descendants,
|
data/lib/plurimath/asciimath.rb
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Plurimath
|
|
4
4
|
class Asciimath
|
|
5
|
+
autoload :Constants, "#{__dir__}/asciimath/constants"
|
|
6
|
+
autoload :Parse, "#{__dir__}/asciimath/parse"
|
|
7
|
+
autoload :Parser, "#{__dir__}/asciimath/parser"
|
|
8
|
+
autoload :Transform, "#{__dir__}/asciimath/transform"
|
|
9
|
+
|
|
5
10
|
attr_accessor :text
|
|
6
11
|
|
|
7
12
|
def initialize(text)
|
data/lib/plurimath/errors.rb
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Plurimath
|
|
4
|
+
module Formatter
|
|
5
|
+
module Numbers
|
|
6
|
+
autoload :Base, "#{__dir__}/numbers/base"
|
|
7
|
+
autoload :Fraction, "#{__dir__}/numbers/fraction"
|
|
8
|
+
autoload :Integer, "#{__dir__}/numbers/integer"
|
|
9
|
+
autoload :Significant, "#{__dir__}/numbers/significant"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/plurimath/formatter.rb
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "errors/formatter/unsupported_base"
|
|
4
|
-
require_relative "formatter/numeric_formatter"
|
|
5
|
-
require_relative "formatter/supported_locales"
|
|
6
|
-
require_relative "formatter/numbers/base"
|
|
7
|
-
require_relative "formatter/numbers/integer"
|
|
8
|
-
require_relative "formatter/numbers/fraction"
|
|
9
|
-
require_relative "formatter/numbers/significant"
|
|
10
|
-
require_relative "formatter/number_formatter"
|
|
11
|
-
|
|
12
3
|
module Plurimath
|
|
13
4
|
module Formatter
|
|
5
|
+
autoload :NumericFormatter, "#{__dir__}/formatter/numeric_formatter"
|
|
6
|
+
autoload :NumberFormatter, "#{__dir__}/formatter/number_formatter"
|
|
7
|
+
autoload :SupportedLocales, "#{__dir__}/formatter/supported_locales"
|
|
8
|
+
autoload :UnsupportedBase, "#{__dir__}/errors/formatter/unsupported_base"
|
|
9
|
+
autoload :Numbers, "#{__dir__}/formatter/numbers"
|
|
10
|
+
autoload :Standard, "#{__dir__}/formatter/standard"
|
|
14
11
|
end
|
|
15
12
|
end
|
data/lib/plurimath/html/parse.rb
CHANGED
data/lib/plurimath/html.rb
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Plurimath
|
|
4
4
|
class Html
|
|
5
|
+
autoload :Constants, "#{__dir__}/html/constants"
|
|
6
|
+
autoload :Parse, "#{__dir__}/html/parse"
|
|
7
|
+
autoload :Parser, "#{__dir__}/html/parser"
|
|
8
|
+
autoload :Transform, "#{__dir__}/html/transform"
|
|
9
|
+
|
|
5
10
|
attr_accessor :text
|
|
6
11
|
|
|
7
12
|
def initialize(text)
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "parse"
|
|
4
|
-
require_relative "constants"
|
|
5
|
-
require_relative "transform"
|
|
6
3
|
module Plurimath
|
|
7
4
|
class Latex
|
|
8
5
|
class Parser
|
|
@@ -11,6 +8,7 @@ module Plurimath
|
|
|
11
8
|
TEXT_REGEX = %r(\\(?:mbox|text)\{[^\}]+\})
|
|
12
9
|
|
|
13
10
|
def initialize(text)
|
|
11
|
+
@enti = ::HTMLEntities.new
|
|
14
12
|
@text = pre_processing(text)
|
|
15
13
|
end
|
|
16
14
|
|
|
@@ -26,8 +24,7 @@ module Plurimath
|
|
|
26
24
|
|
|
27
25
|
def pre_processing(text)
|
|
28
26
|
text_functions = text.scan(TEXT_REGEX)
|
|
29
|
-
|
|
30
|
-
text = enti.encode(enti.decode(text), :hexadecimal)
|
|
27
|
+
text = @enti.encode(@enti.decode(text), :hexadecimal)
|
|
31
28
|
text = gsub_space_and_unicodes(text)
|
|
32
29
|
text.gsub(TEXT_REGEX) { |str| text_functions.shift }
|
|
33
30
|
end
|
data/lib/plurimath/latex.rb
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Plurimath
|
|
4
4
|
class Latex
|
|
5
|
+
autoload :Constants, "#{__dir__}/latex/constants"
|
|
6
|
+
autoload :Parse, "#{__dir__}/latex/parse"
|
|
7
|
+
autoload :Parser, "#{__dir__}/latex/parser"
|
|
8
|
+
autoload :Transform, "#{__dir__}/latex/transform"
|
|
9
|
+
|
|
5
10
|
attr_accessor :text
|
|
6
11
|
|
|
7
12
|
def initialize(text)
|
data/lib/plurimath/math/core.rb
CHANGED
|
@@ -285,7 +285,12 @@ module Plurimath
|
|
|
285
285
|
end
|
|
286
286
|
|
|
287
287
|
def variables
|
|
288
|
-
instance_variables
|
|
288
|
+
instance_variables.reject do |var|
|
|
289
|
+
name = var.to_s
|
|
290
|
+
name.start_with?("@__") ||
|
|
291
|
+
name.start_with?("@lutaml") ||
|
|
292
|
+
name == "@using_default"
|
|
293
|
+
end
|
|
289
294
|
end
|
|
290
295
|
|
|
291
296
|
def ox_element(node, attributes: [], namespace: "")
|
|
@@ -348,7 +353,6 @@ module Plurimath
|
|
|
348
353
|
def pretty_print_instance_variables
|
|
349
354
|
excluded_vars = [
|
|
350
355
|
:@left_right_wrapper,
|
|
351
|
-
:@temp_mathml_order,
|
|
352
356
|
:@using_default,
|
|
353
357
|
:@displaystyle,
|
|
354
358
|
:@__encoding,
|
|
@@ -16,30 +16,10 @@ module Plurimath
|
|
|
16
16
|
@is_mrow = true
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def element_order=(value)
|
|
20
|
-
@value = validated_order(value&.map(&:name), rejectable_array: ["comment"])
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def content; end
|
|
24
|
-
|
|
25
|
-
def content=(value)
|
|
26
|
-
arr_value = Array(value)
|
|
27
|
-
if no_content_in?(arr_value)
|
|
28
|
-
delete_all_text
|
|
29
|
-
else
|
|
30
|
-
validate_text_order(
|
|
31
|
-
arr_value.map { |val| validate_symbols(val) unless val.strip.empty? }
|
|
32
|
-
)
|
|
33
|
-
end
|
|
34
|
-
organize_value
|
|
35
|
-
end
|
|
36
|
-
|
|
37
19
|
def is_mrow?
|
|
38
20
|
@is_mrow
|
|
39
21
|
end
|
|
40
22
|
|
|
41
|
-
private
|
|
42
|
-
|
|
43
23
|
def organize_value
|
|
44
24
|
return if value.any?(String)
|
|
45
25
|
return unless is_mrow
|
|
@@ -62,6 +42,8 @@ module Plurimath
|
|
|
62
42
|
end
|
|
63
43
|
end
|
|
64
44
|
|
|
45
|
+
private
|
|
46
|
+
|
|
65
47
|
def update_current_element(element, value, index)
|
|
66
48
|
if first_and_last_values_nil?(value)
|
|
67
49
|
replace_symbols_with_parens(value)
|
|
@@ -70,27 +52,6 @@ module Plurimath
|
|
|
70
52
|
end
|
|
71
53
|
end
|
|
72
54
|
|
|
73
|
-
def validate_text_order(value)
|
|
74
|
-
@value.each_with_index do |item, index|
|
|
75
|
-
next unless item == "text"
|
|
76
|
-
|
|
77
|
-
if value.first
|
|
78
|
-
@value[index] = value.shift
|
|
79
|
-
else
|
|
80
|
-
value.shift
|
|
81
|
-
@value.delete_at(index)
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def delete_all_text
|
|
87
|
-
@value.delete("text")
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def no_content_in?(value)
|
|
91
|
-
value.nil? || value.empty? || value&.all? { |val| val.strip.empty? }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
55
|
def first_and_last_values_nil?(value)
|
|
95
56
|
value.first.class_name == "symbol" &&
|
|
96
57
|
value.first.value.nil? &&
|
|
@@ -11,6 +11,12 @@ module Plurimath
|
|
|
11
11
|
def is_mstyle?
|
|
12
12
|
true
|
|
13
13
|
end
|
|
14
|
+
|
|
15
|
+
def omml_content(display_style, options:)
|
|
16
|
+
# Use Mstyle's own @displaystyle, not the passed-in display_style
|
|
17
|
+
effective_display = @displaystyle.nil? ? display_style : @displaystyle
|
|
18
|
+
value&.map { |val| val.insert_t_tag(effective_display, options: options) }
|
|
19
|
+
end
|
|
14
20
|
end
|
|
15
21
|
end
|
|
16
22
|
end
|