plurimath 0.8.16 → 0.8.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gen_docs.yml +10 -8
- data/Gemfile +1 -1
- data/README.adoc +4 -0
- data/Rakefile +55 -8
- data/intent_supported_classes.adoc +82 -0
- data/lib/plurimath/asciimath/parse.rb +1 -0
- data/lib/plurimath/asciimath/transform.rb +12 -0
- data/lib/plurimath/formatter/number_formatter.rb +6 -6
- data/lib/plurimath/formatter/numeric_formatter.rb +5 -2
- data/lib/plurimath/formatter/standard.rb +2 -0
- data/lib/plurimath/math/core.rb +65 -6
- data/lib/plurimath/math/formula/mrow.rb +193 -0
- data/lib/plurimath/math/formula/mstyle.rb +17 -0
- data/lib/plurimath/math/formula.rb +317 -7
- data/lib/plurimath/math/function/abs.rb +5 -1
- data/lib/plurimath/math/function/base.rb +4 -0
- data/lib/plurimath/math/function/color.rb +17 -4
- data/lib/plurimath/math/function/fenced.rb +238 -7
- data/lib/plurimath/math/function/frac.rb +12 -1
- data/lib/plurimath/math/function/inf.rb +5 -1
- data/lib/plurimath/math/function/int.rb +5 -1
- data/lib/plurimath/math/function/intent.rb +6 -2
- data/lib/plurimath/math/function/lim.rb +5 -1
- data/lib/plurimath/math/function/linebreak.rb +2 -2
- data/lib/plurimath/math/function/longdiv.rb +3 -0
- data/lib/plurimath/math/function/menclose.rb +3 -0
- data/lib/plurimath/math/function/merror.rb +5 -2
- data/lib/plurimath/math/function/mglyph.rb +27 -0
- data/lib/plurimath/math/function/mlabeledtr.rb +19 -0
- data/lib/plurimath/math/function/mpadded.rb +28 -1
- data/lib/plurimath/math/function/ms.rb +80 -0
- data/lib/plurimath/math/function/msgroup.rb +15 -0
- data/lib/plurimath/math/function/msline.rb +5 -2
- data/lib/plurimath/math/function/multiscript.rb +14 -0
- data/lib/plurimath/math/function/nary.rb +13 -1
- data/lib/plurimath/math/function/oint.rb +5 -1
- data/lib/plurimath/math/function/over.rb +3 -0
- data/lib/plurimath/math/function/overset.rb +11 -0
- data/lib/plurimath/math/function/phantom.rb +3 -0
- data/lib/plurimath/math/function/power.rb +3 -0
- data/lib/plurimath/math/function/power_base.rb +3 -0
- data/lib/plurimath/math/function/prod.rb +5 -1
- data/lib/plurimath/math/function/root.rb +3 -0
- data/lib/plurimath/math/function/scarries.rb +3 -0
- data/lib/plurimath/math/function/semantics.rb +14 -0
- data/lib/plurimath/math/function/sqrt.rb +3 -0
- data/lib/plurimath/math/function/stackrel.rb +3 -0
- data/lib/plurimath/math/function/sum.rb +5 -1
- data/lib/plurimath/math/function/table/array.rb +1 -1
- data/lib/plurimath/math/function/table/bmatrix.rb +1 -1
- data/lib/plurimath/math/function/table/cases.rb +2 -2
- data/lib/plurimath/math/function/table/eqarray.rb +2 -2
- data/lib/plurimath/math/function/table/pmatrix.rb +1 -1
- data/lib/plurimath/math/function/table/vmatrix.rb +1 -1
- data/lib/plurimath/math/function/table.rb +65 -0
- data/lib/plurimath/math/function/td.rb +4 -1
- data/lib/plurimath/math/function/text.rb +22 -2
- data/lib/plurimath/math/function/tr.rb +13 -0
- data/lib/plurimath/math/function/unary_function.rb +5 -1
- data/lib/plurimath/math/function/underover.rb +3 -0
- data/lib/plurimath/math/function/underset.rb +44 -0
- data/lib/plurimath/math/number.rb +10 -1
- data/lib/plurimath/math/symbols/bigwedge.rb +4 -0
- data/lib/plurimath/math/symbols/cap.rb +0 -4
- data/lib/plurimath/math/symbols/clockoint.rb +1 -1
- data/lib/plurimath/math/symbols/cntclockoint.rb +1 -1
- data/lib/plurimath/math/symbols/coprod.rb +1 -1
- data/lib/plurimath/math/symbols/dd.rb +4 -0
- data/lib/plurimath/math/symbols/dint.rb +4 -0
- data/lib/plurimath/math/symbols/duni.rb +4 -0
- data/lib/plurimath/math/symbols/gg.rb +4 -4
- data/lib/plurimath/math/symbols/ii.rb +4 -0
- data/lib/plurimath/math/symbols/iiiint.rb +1 -1
- data/lib/plurimath/math/symbols/iiint.rb +4 -0
- data/lib/plurimath/math/symbols/iint.rb +1 -1
- data/lib/plurimath/math/symbols/intclockwise.rb +1 -1
- data/lib/plurimath/math/symbols/intercal.rb +4 -0
- data/lib/plurimath/math/symbols/jj.rb +4 -0
- data/lib/plurimath/math/symbols/ll.rb +4 -4
- data/lib/plurimath/math/symbols/minus.rb +1 -1
- data/lib/plurimath/math/symbols/oiiint.rb +1 -1
- data/lib/plurimath/math/symbols/oiint.rb +1 -1
- data/lib/plurimath/math/symbols/oint.rb +1 -1
- data/lib/plurimath/math/symbols/symbol.rb +12 -4
- data/lib/plurimath/math/symbols/upcase_dd.rb +4 -0
- data/lib/plurimath/math.rb +2 -0
- data/lib/plurimath/mathml/parser.rb +45 -86
- data/lib/plurimath/mathml/utility/empty_defined_methods.rb +477 -0
- data/lib/plurimath/mathml/utility/formula_transformation.rb +472 -0
- data/lib/plurimath/mathml/utility.rb +363 -0
- data/lib/plurimath/mathml.rb +1 -0
- data/lib/plurimath/unicode_math/transform.rb +2 -2
- data/lib/plurimath/utility/intent_encoding.rb +21 -21
- data/lib/plurimath/utility.rb +5 -23
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath.rb +9 -0
- data/plurimath.gemspec +4 -2
- metadata +38 -5
- data/lib/plurimath/mathml/transform.rb +0 -411
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "ternary_function"
|
4
|
+
require_relative "../../mathml/utility"
|
4
5
|
|
5
6
|
module Plurimath
|
6
7
|
module Math
|
7
8
|
module Function
|
8
9
|
class Fenced < TernaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
attr_accessor :options
|
10
13
|
|
11
14
|
def initialize(
|
@@ -39,6 +42,7 @@ module Plurimath
|
|
39
42
|
intent,
|
40
43
|
func_name: :interval_fence,
|
41
44
|
intent_name: intent_value(mrow_value, options: options),
|
45
|
+
options: intent_names,
|
42
46
|
)
|
43
47
|
end
|
44
48
|
|
@@ -145,8 +149,231 @@ module Plurimath
|
|
145
149
|
"#{parameter_one.to_unicodemath(options: options)}#{fenced_value}#{parameter_three.to_unicodemath(options: options)}"
|
146
150
|
end
|
147
151
|
|
152
|
+
def intent_names
|
153
|
+
{
|
154
|
+
open_closed_interval: "open-closed-interval",
|
155
|
+
closed_open_interval: "closed-open-interval",
|
156
|
+
binomial_coefficient: "binomial-coefficient",
|
157
|
+
closed_interval: "closed-interval",
|
158
|
+
open_interval: "open-interval",
|
159
|
+
fenced: ":fenced",
|
160
|
+
}
|
161
|
+
end
|
162
|
+
|
163
|
+
def separators=(value)
|
164
|
+
return if value.nil?
|
165
|
+
|
166
|
+
@options[:separators] = value
|
167
|
+
end
|
168
|
+
|
169
|
+
def content=(value)
|
170
|
+
if parens_nil?
|
171
|
+
@parameter_one = Math::Symbols::Paren::Lround.new
|
172
|
+
@parameter_three = Math::Symbols::Paren::Rround.new
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def open=(value)
|
177
|
+
return unless value
|
178
|
+
|
179
|
+
@parameter_one = validate_symbols(value)
|
180
|
+
end
|
181
|
+
|
182
|
+
def close=(value)
|
183
|
+
return unless value
|
184
|
+
|
185
|
+
@parameter_three = validate_symbols(value)
|
186
|
+
end
|
187
|
+
|
188
|
+
def element_order=(value)
|
189
|
+
@parameter_two = validated_order(value)
|
190
|
+
end
|
191
|
+
|
192
|
+
def mi_value=(value)
|
193
|
+
return if value.nil? || value.empty?
|
194
|
+
|
195
|
+
update(
|
196
|
+
replace_order_with_value(
|
197
|
+
@parameter_two,
|
198
|
+
Array(validate_symbols(value)),
|
199
|
+
"mi"
|
200
|
+
)
|
201
|
+
)
|
202
|
+
end
|
203
|
+
|
204
|
+
def mn_value=(value)
|
205
|
+
return if value.nil? || value.empty?
|
206
|
+
|
207
|
+
update(
|
208
|
+
replace_order_with_value(
|
209
|
+
@parameter_two,
|
210
|
+
Array(validate_symbols(value)),
|
211
|
+
"mn"
|
212
|
+
)
|
213
|
+
)
|
214
|
+
end
|
215
|
+
|
216
|
+
def mtext_value=(value)
|
217
|
+
return if value.nil? || value.empty?
|
218
|
+
|
219
|
+
update(
|
220
|
+
replace_order_with_value(
|
221
|
+
@parameter_two,
|
222
|
+
Array(validate_symbols(value)),
|
223
|
+
"mtext"
|
224
|
+
)
|
225
|
+
)
|
226
|
+
end
|
227
|
+
|
228
|
+
def mo_value=(value)
|
229
|
+
return if value.nil? || value.empty?
|
230
|
+
|
231
|
+
update(
|
232
|
+
replace_order_with_value(
|
233
|
+
@parameter_two,
|
234
|
+
Array(validate_symbols(value)),
|
235
|
+
"mo"
|
236
|
+
)
|
237
|
+
)
|
238
|
+
end
|
239
|
+
|
240
|
+
def mstyle_value=(value)
|
241
|
+
return if value.empty?
|
242
|
+
|
243
|
+
update(
|
244
|
+
replace_order_with_value(
|
245
|
+
@parameter_two,
|
246
|
+
Array(value),
|
247
|
+
"mstyle"
|
248
|
+
)
|
249
|
+
)
|
250
|
+
end
|
251
|
+
|
252
|
+
def munderover_value=(value)
|
253
|
+
update_temp_order(value, "munderover")
|
254
|
+
end
|
255
|
+
|
256
|
+
def msub_value=(value)
|
257
|
+
update_temp_order(value, "msub")
|
258
|
+
end
|
259
|
+
|
260
|
+
def msup_value=(value)
|
261
|
+
update_temp_order(value, "msup")
|
262
|
+
end
|
263
|
+
|
264
|
+
def mover_value=(value)
|
265
|
+
update_temp_order(value, "mover")
|
266
|
+
end
|
267
|
+
|
268
|
+
def munder_value=(value)
|
269
|
+
update_temp_order(value, "munder")
|
270
|
+
end
|
271
|
+
|
272
|
+
def msubsup_value=(value)
|
273
|
+
update_temp_order(value, "msubsup")
|
274
|
+
end
|
275
|
+
|
276
|
+
def mfrac_value=(value)
|
277
|
+
update_temp_order(value, "mfrac")
|
278
|
+
end
|
279
|
+
|
280
|
+
def msqrt_value=(value)
|
281
|
+
update_temp_order(value, "msqrt")
|
282
|
+
end
|
283
|
+
|
284
|
+
def mfenced_value=(value)
|
285
|
+
update_temp_order(value, "mfenced")
|
286
|
+
end
|
287
|
+
|
288
|
+
def mtable_value=(value)
|
289
|
+
return if value.nil? || value.empty?
|
290
|
+
|
291
|
+
update(
|
292
|
+
replace_order_with_value(
|
293
|
+
Array(@parameter_two),
|
294
|
+
update_temp_mathml_values(value),
|
295
|
+
"mtable"
|
296
|
+
)
|
297
|
+
)
|
298
|
+
end
|
299
|
+
|
300
|
+
def mrow_value=(value)
|
301
|
+
return if value.nil? || value.empty?
|
302
|
+
|
303
|
+
update(
|
304
|
+
replace_order_with_value(
|
305
|
+
Array(@parameter_two),
|
306
|
+
update_temp_mathml_values(
|
307
|
+
Array(filter_values(value, array_to_instance: true))
|
308
|
+
),
|
309
|
+
"mrow"
|
310
|
+
)
|
311
|
+
)
|
312
|
+
end
|
313
|
+
|
314
|
+
def mspace_value=(value)
|
315
|
+
return if value.nil? || value.empty?
|
316
|
+
|
317
|
+
if value.first.linebreak
|
318
|
+
linebreak = Math::Function::Linebreak.new(
|
319
|
+
nil,
|
320
|
+
{ linebreak: value.first.linebreak }
|
321
|
+
)
|
322
|
+
|
323
|
+
update(
|
324
|
+
replace_order_with_value(
|
325
|
+
Array(@parameter_two),
|
326
|
+
[linebreak],
|
327
|
+
"mspace"
|
328
|
+
)
|
329
|
+
)
|
330
|
+
else
|
331
|
+
@parameter_two&.delete("mspace")
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
def mpadded_value=(value)
|
336
|
+
update_temp_order(value, "mpadded")
|
337
|
+
end
|
338
|
+
|
339
|
+
def mfraction_value=(value)
|
340
|
+
update_temp_order(value, "mfraction")
|
341
|
+
end
|
342
|
+
|
343
|
+
def mmultiscripts_value=(value)
|
344
|
+
update_temp_order(value, "mmultiscripts")
|
345
|
+
end
|
346
|
+
|
347
|
+
def mphantom_value=(value)
|
348
|
+
update_temp_order(value, "mphantom")
|
349
|
+
end
|
350
|
+
|
148
351
|
protected
|
149
352
|
|
353
|
+
def update_temp_order(value, order_name)
|
354
|
+
return if value.nil? || value.empty?
|
355
|
+
|
356
|
+
update(
|
357
|
+
replace_order_with_value(
|
358
|
+
Array(@parameter_two),
|
359
|
+
update_temp_mathml_values(value),
|
360
|
+
order_name
|
361
|
+
)
|
362
|
+
)
|
363
|
+
end
|
364
|
+
|
365
|
+
def remove_order(order)
|
366
|
+
@parameter_two.delete_if { |val| val.is_a?(String) && val == order }
|
367
|
+
end
|
368
|
+
|
369
|
+
def insert(values)
|
370
|
+
update(Array(@parameter_two) + values)
|
371
|
+
end
|
372
|
+
|
373
|
+
def update(object)
|
374
|
+
@parameter_two = Array(object)
|
375
|
+
end
|
376
|
+
|
150
377
|
def open_paren(dpr, options:)
|
151
378
|
first_value = symbol_or_paren(parameter_one, lang: :omml, options: options)
|
152
379
|
return dpr if first_value.nil?
|
@@ -253,11 +480,11 @@ module Plurimath
|
|
253
480
|
end
|
254
481
|
|
255
482
|
def intent_value(value, options:)
|
256
|
-
return
|
483
|
+
return :binomial_coefficient if binomial_coefficient?(value)
|
257
484
|
|
258
485
|
open_paren = symbol_or_paren(parameter_one, lang: :latex, options: options)
|
259
486
|
close_paren = symbol_or_paren(parameter_three, lang: :latex, options: options)
|
260
|
-
return
|
487
|
+
return :fenced unless interval_intent?(value, open_paren, close_paren)
|
261
488
|
|
262
489
|
interval_intent(value, open_paren, close_paren)
|
263
490
|
end
|
@@ -270,15 +497,15 @@ module Plurimath
|
|
270
497
|
def interval_intent(value, open_paren, close_paren)
|
271
498
|
case open_paren
|
272
499
|
when "("
|
273
|
-
|
500
|
+
:open_closed_interval if close_paren == ']'
|
274
501
|
when "["
|
275
|
-
return
|
502
|
+
return :closed_interval if close_paren == ']'
|
276
503
|
|
277
|
-
|
504
|
+
:closed_open_interval if (close_paren == '[' || close_paren == ')')
|
278
505
|
when "]"
|
279
|
-
return
|
506
|
+
return :open_closed_interval if close_paren == ']'
|
280
507
|
|
281
|
-
|
508
|
+
:open_interval if close_paren == '['
|
282
509
|
end
|
283
510
|
end
|
284
511
|
|
@@ -347,6 +574,10 @@ module Plurimath
|
|
347
574
|
node["intent"]&.start_with?(":partial-derivative") &&
|
348
575
|
!node.locate("*/@arg").include?("f")
|
349
576
|
end
|
577
|
+
|
578
|
+
def parens_nil?
|
579
|
+
@parameter_one.nil? && @parameter_three.nil?
|
580
|
+
end
|
350
581
|
end
|
351
582
|
end
|
352
583
|
end
|
@@ -1,12 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "binary_function"
|
4
|
+
require_relative "../../mathml/utility"
|
4
5
|
|
5
6
|
module Plurimath
|
6
7
|
module Math
|
7
8
|
module Function
|
8
9
|
class Frac < BinaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
attr_accessor :options
|
13
|
+
|
10
14
|
FUNCTION = {
|
11
15
|
name: "fraction",
|
12
16
|
first_value: "numerator",
|
@@ -41,7 +45,7 @@ module Plurimath
|
|
41
45
|
frac_tag.set_attr(self.options.reject { |opt| opt == :choose }) if tag_name == "mfrac" && self.options
|
42
46
|
Utility.update_nodes(frac_tag, mathml_value)
|
43
47
|
update_derivative(frac_tag, mathml_value[0], mathml_value[1]) if intent
|
44
|
-
intentify(frac_tag, intent, func_name: :frac)
|
48
|
+
intentify(frac_tag, intent, func_name: :frac, options: intent_names)
|
45
49
|
end
|
46
50
|
|
47
51
|
def to_latex(options:)
|
@@ -98,6 +102,13 @@ module Plurimath
|
|
98
102
|
"#{first_value}⒞#{second_value}"
|
99
103
|
end
|
100
104
|
|
105
|
+
def intent_names
|
106
|
+
{
|
107
|
+
derivative: ":derivative",
|
108
|
+
partial_derivative: ":partial-derivative",
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
101
112
|
protected
|
102
113
|
|
103
114
|
def fpr_element
|
@@ -36,7 +36,7 @@ module Plurimath
|
|
36
36
|
parameter_two&.to_mathml_without_math_tag(intent, options: options),
|
37
37
|
],
|
38
38
|
)
|
39
|
-
intentify(inf_tag, intent, func_name: :function, intent_name: :
|
39
|
+
intentify(inf_tag, intent, func_name: :function, intent_name: intent_names[:name])
|
40
40
|
end
|
41
41
|
|
42
42
|
def to_omml_without_math_tag(display_style, options:)
|
@@ -57,6 +57,10 @@ module Plurimath
|
|
57
57
|
"inf#{sub_value(options: options)}#{sup_value(options: options)}"
|
58
58
|
end
|
59
59
|
|
60
|
+
def intent_names
|
61
|
+
{ name: ":function" }
|
62
|
+
end
|
63
|
+
|
60
64
|
protected
|
61
65
|
|
62
66
|
def sup_value(options:)
|
@@ -62,7 +62,7 @@ module Plurimath
|
|
62
62
|
wrap_mrow(parameter_three&.to_mathml_without_math_tag(intent, options: options), intent),
|
63
63
|
].flatten.compact,
|
64
64
|
)
|
65
|
-
intentify(mrow, intent, func_name: :naryand, intent_name: :
|
65
|
+
intentify(mrow, intent, func_name: :naryand, intent_name: intent_names[:name])
|
66
66
|
end
|
67
67
|
|
68
68
|
def to_omml_without_math_tag(display_style, options:)
|
@@ -116,6 +116,10 @@ module Plurimath
|
|
116
116
|
true
|
117
117
|
end
|
118
118
|
|
119
|
+
def intent_names
|
120
|
+
{ name: ":integral" }
|
121
|
+
end
|
122
|
+
|
119
123
|
protected
|
120
124
|
|
121
125
|
def sup_value(options:)
|
@@ -17,15 +17,19 @@ module Plurimath
|
|
17
17
|
"ⓘ#{first_value}"
|
18
18
|
end
|
19
19
|
|
20
|
+
def intent_names
|
21
|
+
{ name: ":derivative" }
|
22
|
+
end
|
23
|
+
|
20
24
|
private
|
21
25
|
|
22
26
|
def encoded_intent(tag)
|
23
|
-
if parameter_two.value ==
|
27
|
+
if parameter_two.value == intent_names[:name] && encodable?
|
24
28
|
field = parameter_one.value
|
25
29
|
unicode = encode(field[0].parameter_one.value)
|
26
30
|
unfenced_str = fence_value(tag.nodes[1].nodes[1..-2]) if tag.nodes[1]["intent"] == ":fenced"
|
27
31
|
fenced_str = "(#{unfenced_str})" unless unfenced_str.empty?
|
28
|
-
":
|
32
|
+
"#{intent_names[:name]}(1,#{unicode}#{fenced_str},#{unfenced_str})"
|
29
33
|
else
|
30
34
|
Utility.html_entity_to_unicode(parameter_two.value)
|
31
35
|
end
|
@@ -42,7 +42,7 @@ module Plurimath
|
|
42
42
|
parameter_two&.to_mathml_without_math_tag(intent, options: options),
|
43
43
|
],
|
44
44
|
)
|
45
|
-
intentify(lim_tag, intent, func_name: :function, intent_name: :
|
45
|
+
intentify(lim_tag, intent, func_name: :function, intent_name: intent_names[:name])
|
46
46
|
end
|
47
47
|
|
48
48
|
def to_omml_without_math_tag(display_style, options:)
|
@@ -64,6 +64,10 @@ module Plurimath
|
|
64
64
|
self.parameter_two = nil
|
65
65
|
end
|
66
66
|
end
|
67
|
+
|
68
|
+
def intent_names
|
69
|
+
{ name: ":function" }
|
70
|
+
end
|
67
71
|
end
|
68
72
|
end
|
69
73
|
end
|
@@ -17,7 +17,7 @@ module Plurimath
|
|
17
17
|
def ==(object)
|
18
18
|
object.class == self.class &&
|
19
19
|
object.parameter_one == parameter_one &&
|
20
|
-
object.linebreak == linebreak
|
20
|
+
object.linebreak? == linebreak?
|
21
21
|
end
|
22
22
|
|
23
23
|
def to_asciimath(options:)
|
@@ -91,7 +91,7 @@ module Plurimath
|
|
91
91
|
true
|
92
92
|
end
|
93
93
|
|
94
|
-
def linebreak
|
94
|
+
def linebreak?
|
95
95
|
true
|
96
96
|
end
|
97
97
|
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "unary_function"
|
4
|
+
require_relative "../../mathml/utility"
|
4
5
|
|
5
6
|
module Plurimath
|
6
7
|
module Math
|
7
8
|
module Function
|
8
9
|
class Longdiv < UnaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
def to_asciimath(options:)
|
10
13
|
asciimath_value(options: options)
|
11
14
|
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "binary_function"
|
4
|
+
require_relative "../../mathml/utility"
|
4
5
|
|
5
6
|
module Plurimath
|
6
7
|
module Math
|
7
8
|
module Function
|
8
9
|
class Menclose < BinaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
FUNCTION = {
|
10
13
|
name: "enclosure",
|
11
14
|
first_value: "enclosure type",
|
@@ -1,14 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "unary_function"
|
4
|
+
require_relative "../../mathml/utility"
|
4
5
|
|
5
6
|
module Plurimath
|
6
7
|
module Math
|
7
8
|
module Function
|
8
9
|
class Merror < UnaryFunction
|
9
|
-
|
10
|
+
include Mathml::Utility
|
10
11
|
|
11
|
-
def
|
12
|
+
def to_asciimath(**); end
|
13
|
+
|
14
|
+
def to_latex(**); end
|
12
15
|
|
13
16
|
def to_mathml_without_math_tag(intent, options:)
|
14
17
|
merror = Utility.ox_element("merror")
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "unary_function"
|
4
|
+
require_relative "../../mathml/utility"
|
4
5
|
|
5
6
|
module Plurimath
|
6
7
|
module Math
|
7
8
|
module Function
|
8
9
|
class Mglyph < UnaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
def initialize(parameter_one = {})
|
10
13
|
super(parameter_one)
|
11
14
|
end
|
@@ -34,8 +37,32 @@ module Plurimath
|
|
34
37
|
parameter_one[:alt] if parameter_one
|
35
38
|
end
|
36
39
|
|
40
|
+
def alt; end
|
41
|
+
|
42
|
+
def src; end
|
43
|
+
|
44
|
+
def index; end
|
45
|
+
|
46
|
+
def src=(value)
|
47
|
+
set_option(:src, value)
|
48
|
+
end
|
49
|
+
|
50
|
+
def alt=(value)
|
51
|
+
set_option(:alt, value)
|
52
|
+
end
|
53
|
+
|
54
|
+
def index=(value)
|
55
|
+
set_option(:index, value)
|
56
|
+
end
|
57
|
+
|
37
58
|
protected
|
38
59
|
|
60
|
+
def set_option(option, value)
|
61
|
+
return if value.nil?
|
62
|
+
|
63
|
+
parameter_one[option] = value
|
64
|
+
end
|
65
|
+
|
39
66
|
def glyph_user_index(index)
|
40
67
|
return "" unless index > 0
|
41
68
|
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "binary_function"
|
4
|
+
require_relative "../../mathml/utility"
|
4
5
|
|
5
6
|
module Plurimath
|
6
7
|
module Math
|
7
8
|
module Function
|
8
9
|
class Mlabeledtr < BinaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
def to_mathml_without_math_tag(intent, options:)
|
10
13
|
table = ox_element("mtable")
|
11
14
|
mlabeledtr = ox_element(class_name)
|
@@ -18,6 +21,22 @@ module Plurimath
|
|
18
21
|
"#{parameter_one&.to_unicodemath(options: options)}##{parameter_two&.value}"
|
19
22
|
end
|
20
23
|
|
24
|
+
def id=(value)
|
25
|
+
return if value.nil?
|
26
|
+
|
27
|
+
@parameter_two = Text.new(value)
|
28
|
+
end
|
29
|
+
|
30
|
+
def mtd_value=(value)
|
31
|
+
return if value.nil? || value.empty?
|
32
|
+
|
33
|
+
self.parameter_one = replace_order_with_value(
|
34
|
+
clear_temp_order,
|
35
|
+
update_temp_mathml_values(value),
|
36
|
+
"mtd"
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
21
40
|
protected
|
22
41
|
|
23
42
|
def labeledtr_td(tr, value)
|
@@ -1,12 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "unary_function"
|
4
|
+
require_relative "../../mathml/utility"
|
4
5
|
|
5
6
|
module Plurimath
|
6
7
|
module Math
|
7
8
|
module Function
|
8
9
|
class Mpadded < UnaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
attr_accessor :options
|
13
|
+
|
10
14
|
ZERO_TAGS = {
|
11
15
|
height: "zeroAsc",
|
12
16
|
depth: "zeroDesc",
|
@@ -58,11 +62,34 @@ module Plurimath
|
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
65
|
+
def voffset; end
|
66
|
+
|
67
|
+
def voffset=(value); end
|
68
|
+
|
69
|
+
def height=(value)
|
70
|
+
set_option(:height, value)
|
71
|
+
end
|
72
|
+
|
73
|
+
def depth=(value)
|
74
|
+
set_option(:depth, value)
|
75
|
+
end
|
76
|
+
|
77
|
+
def width=(value)
|
78
|
+
set_option(:width, value)
|
79
|
+
end
|
80
|
+
|
61
81
|
protected
|
62
82
|
|
83
|
+
def set_option(option, value)
|
84
|
+
return if value.nil?
|
85
|
+
|
86
|
+
@options ||= {}
|
87
|
+
@options[option] = value
|
88
|
+
end
|
89
|
+
|
63
90
|
def phant_pr
|
64
91
|
attributes = { "m:val": "on" }
|
65
|
-
options
|
92
|
+
options&.map do |atr, value|
|
66
93
|
ox_element(ZERO_TAGS[atr], attributes: attributes) if attr_value_zero?(value)
|
67
94
|
end
|
68
95
|
end
|