plurimath 0.11.3 → 0.11.4
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/lib/plurimath/cli.rb +1 -1
- data/lib/plurimath/math/formula.rb +1 -1
- data/lib/plurimath/omml/formula_transformation.rb +17 -2
- data/lib/plurimath/omml/translator.rb +2 -0
- data/lib/plurimath/utility.rb +1 -1
- data/lib/plurimath/version.rb +1 -1
- data/plurimath.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1bd22352f6fdea1f20d57cc552cb7c192f487de748ce69389ddd85c38bcaa2e
|
|
4
|
+
data.tar.gz: fc2c2959d8cf67c04566de3296b9002e4ef691f6786b540aac9a2ce243018230
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60ade76c92676e02145a0db94913b1cbb07e7d14f03b11b53c6438bdc65c83fe661d037613b69d9dd2cd6fcc5c7d2de39e80275b8143eb8b5ae0506e28796815
|
|
7
|
+
data.tar.gz: ec5dc417656ad00f5b9cb96dcb95df5a4436fa793976f2f0bc13680d7be613787315992f20f81c349e628ef19c33f314f39ee0dec13d90dd597d6d6490164aec
|
data/lib/plurimath/cli.rb
CHANGED
|
@@ -56,7 +56,7 @@ module Plurimath
|
|
|
56
56
|
output_format = options[:output_format]
|
|
57
57
|
configure_xml_engine(input_format, output_format)
|
|
58
58
|
formula = Plurimath::Math.parse(input_string, input_format)
|
|
59
|
-
return puts formula.to_display(output_format.to_sym) if
|
|
59
|
+
return puts formula.to_display(output_format.to_sym) if options[:math_rendering].to_s == "true"
|
|
60
60
|
|
|
61
61
|
display_style = options[:display_style]
|
|
62
62
|
split = options[:split_on_linebreak]
|
|
@@ -102,21 +102,36 @@ module Plurimath
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
def linebreak_child?(node, child)
|
|
105
|
+
return true if ct_br_child?(child)
|
|
106
|
+
|
|
105
107
|
child == "" && node.respond_to?(:br) && node.br == ""
|
|
106
108
|
end
|
|
107
109
|
|
|
110
|
+
def ct_br_child?(child)
|
|
111
|
+
return false unless child.is_a?(Object)
|
|
112
|
+
|
|
113
|
+
Lutaml::Model::Utils.base_class_name(child.class.name) == "CTBr"
|
|
114
|
+
end
|
|
115
|
+
|
|
108
116
|
def styled_run?(children)
|
|
109
117
|
children.length > 1 && !children.first.is_a?(Math::Core)
|
|
110
118
|
end
|
|
111
119
|
|
|
112
120
|
def styled_run_value(children)
|
|
113
|
-
|
|
121
|
+
fonts, content = children.partition do |child|
|
|
122
|
+
font_style_class?(child)
|
|
123
|
+
end
|
|
124
|
+
font = fonts.first
|
|
114
125
|
font.new(
|
|
115
|
-
Utility.filter_values(
|
|
126
|
+
Utility.filter_values(content),
|
|
116
127
|
Utility::FONT_STYLES.key(font).to_s,
|
|
117
128
|
)
|
|
118
129
|
end
|
|
119
130
|
|
|
131
|
+
def font_style_class?(value)
|
|
132
|
+
value.is_a?(Class) && value <= Math::Function::FontStyle
|
|
133
|
+
end
|
|
134
|
+
|
|
120
135
|
def script_function_value(script_class, node)
|
|
121
136
|
script_class.new(
|
|
122
137
|
omml_argument_value(node.sub),
|
|
@@ -58,6 +58,8 @@ module Plurimath
|
|
|
58
58
|
"CTCtrlPr", "CTBoxPr" then nil
|
|
59
59
|
when "CTRPr" then word_run_properties_to_plurimath(node)
|
|
60
60
|
when "CTRPR" then math_run_properties_to_plurimath(node)
|
|
61
|
+
when "CTBr" then Math::Function::Linebreak.new
|
|
62
|
+
when "CTWordprocessingEmpty", "CTWordprocessingText" then nil
|
|
61
63
|
else
|
|
62
64
|
unsupported_node!(node)
|
|
63
65
|
end
|
data/lib/plurimath/utility.rb
CHANGED
|
@@ -552,7 +552,7 @@ lang: nil)
|
|
|
552
552
|
if value.last.is_a?(Math::Function::UnaryFunction)
|
|
553
553
|
value.last.parameter_one = value.shift if value.length > 1
|
|
554
554
|
value.last.attributes = attrs.transform_values do |v|
|
|
555
|
-
|
|
555
|
+
v.to_s == "true"
|
|
556
556
|
end
|
|
557
557
|
end
|
|
558
558
|
value
|
data/lib/plurimath/version.rb
CHANGED
data/plurimath.gemspec
CHANGED
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_dependency "htmlentities"
|
|
32
32
|
spec.add_dependency "lutaml-model", "~> 0.8.0"
|
|
33
33
|
spec.add_dependency "mml", "~> 2.3.6"
|
|
34
|
-
spec.add_dependency "omml", "~> 0.2.
|
|
34
|
+
spec.add_dependency "omml", "~> 0.2.5"
|
|
35
35
|
spec.add_dependency "ostruct"
|
|
36
36
|
spec.add_dependency "ox"
|
|
37
37
|
spec.add_dependency "parslet"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plurimath
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bigdecimal
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.2.
|
|
75
|
+
version: 0.2.5
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.2.
|
|
82
|
+
version: 0.2.5
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: ostruct
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|