Module: Plurimath::Mathml::Utility

Defined Under Namespace

Modules: EmptyDefinedMethods, FormulaTransformation

Constant Summary

Constants included from FormulaTransformation

FormulaTransformation::CONDITIONAL_COMMON_UNARY_FUNCTIONS, FormulaTransformation::SYMBOL_UPDATABLE_FUNCTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EmptyDefinedMethods

#accent, #accentunder, #align, #align=, #alignmentscope, #alignmentscope=, #annotation, #background, #background=, #bevelled, #charalign, #charalign=, #charspacing, #charspacing=, #close, #close=, #color, #color=, #columnalign, #columnalign=, #columnlines, #columnlines=, #columnspacing, #columnspacing=, #columnspan, #columnspan=, #columnwidth, #columnwidth=, #crossout, #crossout=, #decimalpoint, #decimalpoint=, #denomalign, #denomalign=, #depth, #depth=, #dir, #dir=, #displaystyle, #displaystyle=, #edge, #edge=, #equalcolumns, #equalcolumns=, #equalrows, #equalrows=, #fence, #fence=, #fontfamily, #fontfamily=, #fontsize, #fontsize=, #fontstyle, #fontstyle=, #fontweight, #fontweight=, #form, #form=, #frame, #frame=, #framespacing, #framespacing=, #groupalign, #groupalign=, #height, #height=, #id, #indentalign, #indentalign=, #indentalignfirst, #indentalignfirst=, #indentalignlast, #indentalignlast=, #indentshift, #indentshift=, #indentshiftfirst, #indentshiftfirst=, #indentshiftlast, #indentshiftlast=, #indenttarget, #indenttarget=, #infixlinebreakstyle, #infixlinebreakstyle=, #intent, #intent=, #largeop, #largeop=, #leftoverhang, #leftoverhang=, #length, #length=, #linebreak, #linebreakmultchar, #linebreakmultchar=, #linebreakstyle, #lineleading, #lineleading=, #linethickness, #location, #location=, #longdivstyle, #longdivstyle=, #lquote, #lquote=, #lspace, #lspace=, #maligngroup_value, #malignmark, #malignmark=, #malignmark_value, #mathbackground, #mathbackground=, #mathbackgroundcolor, #mathbackgroundcolor=, #mathcolor, #mathcolor=, #mathsize, #mathsize=, #mathvariant, #maxsize, #maxsize=, #mediummathspace, #mediummathspace=, #menclose_value, #merror_value, #mfenced_value, #mfrac_value, #mfraction_value, #mglyph_value, #mi_value, #minlabelspacing, #minlabelspacing=, #minsize, #minsize=, #mlabeledtr_value, #mlongdiv_value, #mmultiscripts_value, #mn_value, #mo_value, #movablelimits, #movablelimits=, #mover_value, #mpadded_value, #mphantom_value, #mprescripts_value, #mprescripts_value=, #mroot_value, #mrow_value, #ms_value, #mscarries_value, #mscarry_value, #msgroup_value, #msline_value, #mslinethickness, #mslinethickness=, #mspace_value, #msqrt_value, #msrow_value, #mstack_value, #mstyle_value, #msub_value, #msubsup_value, #msup_value, #mtable_value, #mtd_value, #mtext_value, #mtr_value, #munder_value, #munderover_value, #none_value, #notation, #numalign, #numalign=, #open, #open=, #position, #position=, #rightoverhang, #rightoverhang=, #rowalign, #rowalign=, #rowlines, #rowlines=, #rowspacing, #rowspacing=, #rowspan, #rowspan=, #rquote, #rquote=, #rspace, #rspace=, #scriptlevel, #scriptlevel=, #scriptminsize, #scriptminsize=, #scriptsizemultiplier, #scriptsizemultiplier=, #selection, #selection=, #semantics_value, #separator, #separator=, #separators, #separators=, #shift, #shift=, #side, #side=, #stackalign, #stackalign=, #stretchy, #stretchy=, #subscriptshift, #subscriptshift=, #superscriptshift, #superscriptshift=, #symmetric, #symmetric=, #thickmathspace, #thickmathspace=, #thinmathspace, #thinmathspace=, #valign, #valign=, #verythickmathspace, #verythickmathspace=, #verythinmathspace, #verythinmathspace=, #veryverythickmathspace, #veryverythickmathspace=, #veryverythinmathspace, #veryverythinmathspace=, #width, #width=

Instance Attribute Details

#temp_mathml_orderObject

Returns the value of attribute temp_mathml_order.



12
13
14
# File 'lib/plurimath/mathml/utility.rb', line 12

def temp_mathml_order
  @temp_mathml_order
end

Instance Method Details

#accent=(value) ⇒ Object



34
35
36
37
38
# File 'lib/plurimath/mathml/utility.rb', line 34

def accent=(value)
  return if value.nil? || value.empty?

  @options = Hash(@options).merge(accent: true)
end

#accentunder=(value) ⇒ Object



40
41
42
43
44
# File 'lib/plurimath/mathml/utility.rb', line 40

def accentunder=(value)
  return if value.nil? || value.empty?

  @options = Hash(@options).merge(accentunder: true)
end

#bevelled=(value) ⇒ Object



46
47
48
49
50
# File 'lib/plurimath/mathml/utility.rb', line 46

def bevelled=(value)
  return if value.nil? || value.empty?

  @options = (@options || {}).merge(bevelled: value)
end

#clear_temp_orderObject



18
19
20
# File 'lib/plurimath/mathml/utility.rb', line 18

def clear_temp_order
  @temp_mathml_order.shift(@temp_mathml_order.count)
end

#element_order=(value) ⇒ Object



14
15
16
# File 'lib/plurimath/mathml/utility.rb', line 14

def element_order=(value)
  @temp_mathml_order = Array(validated_order(value))
end

#linebreak=(value) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/plurimath/mathml/utility.rb', line 52

def linebreak=(value)
  return if value.nil? || value.empty?

  @temp_mathml_order << Plurimath::Math::Function::Linebreak.new(
    nil,
    { linebreak: value },
  )
end

#linebreakstyle=(value) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/plurimath/mathml/utility.rb', line 61

def linebreakstyle=(value)
  return if value.nil? || value.empty?

  linebreak_object = @temp_mathml_order.find do |object|
    object.is_a?(Math::Function::Linebreak)
  end
  linebreak_object.attributes[:linebreakstyle] = value if linebreak_object
end

#linethickness=(value) ⇒ Object



70
71
72
73
74
# File 'lib/plurimath/mathml/utility.rb', line 70

def linethickness=(value)
  return if value.nil? || value.empty?

  @options = (@options || {}).merge(linethickness: value)
end

#maligngroup_value=(_) ⇒ Object



318
319
320
# File 'lib/plurimath/mathml/utility.rb', line 318

def maligngroup_value=(_)
  @temp_mathml_order&.delete("maligngroup")
end

#malignmark_value=(_) ⇒ Object



322
323
324
# File 'lib/plurimath/mathml/utility.rb', line 322

def malignmark_value=(_)
  @temp_mathml_order&.delete("malignmark")
end

#mathvariant=(value) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/plurimath/mathml/utility.rb', line 22

def mathvariant=(value)
  return if value.nil? || value.empty?
  return unless Plurimath::Utility::FONT_STYLES.key?(value.to_sym)

  @temp_mathml_order = [
    Plurimath::Utility::FONT_STYLES[value.to_sym].new(
      nil,
      value,
    ),
  ]
end

#menclose_value=(value) ⇒ Object



312
313
314
315
316
# File 'lib/plurimath/mathml/utility.rb', line 312

def menclose_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "menclose")
end

#merror_value=(value) ⇒ Object



290
291
292
293
294
# File 'lib/plurimath/mathml/utility.rb', line 290

def merror_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "merror")
end

#mfenced_value=(value) ⇒ Object



228
229
230
231
232
# File 'lib/plurimath/mathml/utility.rb', line 228

def mfenced_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mfenced")
end

#mfrac_value=(value) ⇒ Object



166
167
168
169
170
# File 'lib/plurimath/mathml/utility.rb', line 166

def mfrac_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mfrac")
end

#mfraction_value=(value) ⇒ Object



332
333
334
335
336
# File 'lib/plurimath/mathml/utility.rb', line 332

def mfraction_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mfraction")
end

#mglyph_value=(value) ⇒ Object



356
357
358
359
360
# File 'lib/plurimath/mathml/utility.rb', line 356

def mglyph_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mglyph")
end

#mi_value=(value) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/plurimath/mathml/utility.rb', line 82

def mi_value=(value)
  return if value.nil? || value.empty?

  update_temp(
    replace_order_with_value(
      @temp_mathml_order,
      validate_symbols(value),
      "mi",
    ),
  )
end

#mlabeledtr_value=(value) ⇒ Object



338
339
340
341
342
# File 'lib/plurimath/mathml/utility.rb', line 338

def mlabeledtr_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mlabeledtr")
end

#mlongdiv_value=(value) ⇒ Object



296
297
298
299
300
# File 'lib/plurimath/mathml/utility.rb', line 296

def mlongdiv_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mlongdiv")
end

#mmultiscripts_value=(value) ⇒ Object



344
345
346
347
348
# File 'lib/plurimath/mathml/utility.rb', line 344

def mmultiscripts_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mmultiscripts")
end

#mn_value=(value) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/plurimath/mathml/utility.rb', line 106

def mn_value=(value)
  return if value.nil? || value.empty?

  update_temp(
    replace_order_with_value(
      @temp_mathml_order,
      value,
      "mn",
    ),
  )
end

#mo_value=(value) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/plurimath/mathml/utility.rb', line 94

def mo_value=(value)
  return if value.nil? || value.empty?

  update_temp(
    replace_order_with_value(
      @temp_mathml_order,
      validate_symbols(value),
      "mo",
    ),
  )
end

#mover_value=(value) ⇒ Object



190
191
192
193
194
# File 'lib/plurimath/mathml/utility.rb', line 190

def mover_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mover")
end

#mpadded_value=(value) ⇒ Object



326
327
328
329
330
# File 'lib/plurimath/mathml/utility.rb', line 326

def mpadded_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mpadded")
end

#mphantom_value=(value) ⇒ Object



350
351
352
353
354
# File 'lib/plurimath/mathml/utility.rb', line 350

def mphantom_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mphantom")
end

#mroot_value=(value) ⇒ Object



234
235
236
237
238
# File 'lib/plurimath/mathml/utility.rb', line 234

def mroot_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mroot")
end

#mrow_value=(value) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/plurimath/mathml/utility.rb', line 142

def mrow_value=(value)
  return if value.nil? || value.empty?

  update_temp(
    replace_order_with_value(
      @temp_mathml_order,
      filter_values(value, array_to_instance: true),
      "mrow",
    ),
  )
end

#ms_value=(value) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
# File 'lib/plurimath/mathml/utility.rb', line 118

def ms_value=(value)
  return if value.nil? || value.empty?

  update_temp(
    replace_order_with_value(
      @temp_mathml_order,
      Array(value),
      "ms",
    ),
  )
end

#mscarries_value=(value) ⇒ Object



246
247
248
249
250
# File 'lib/plurimath/mathml/utility.rb', line 246

def mscarries_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mscarries")
end

#mscarry_value=(value) ⇒ Object



306
307
308
309
310
# File 'lib/plurimath/mathml/utility.rb', line 306

def mscarry_value=(value)
  return if value.nil? || value.empty?

  @temp_mathml_order&.delete("mscarry")
end

#msgroup_value=(value) ⇒ Object



240
241
242
243
244
# File 'lib/plurimath/mathml/utility.rb', line 240

def msgroup_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "msgroup")
end

#msline_value=(value) ⇒ Object



252
253
254
255
256
# File 'lib/plurimath/mathml/utility.rb', line 252

def msline_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "msline")
end

#mspace_value=(value) ⇒ Object



264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/plurimath/mathml/utility.rb', line 264

def mspace_value=(value)
  return if value.nil? || value.empty?

  if value.first.linebreak
    linebreak = Math::Function::Linebreak.new(
      nil,
      { linebreak: value.first.linebreak },
    )
    update_temp_order([linebreak], "mspace")
  else
    @temp_mathml_order&.delete("mspace")
  end
end

#msqrt_value=(value) ⇒ Object



222
223
224
225
226
# File 'lib/plurimath/mathml/utility.rb', line 222

def msqrt_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "msqrt")
end

#msrow_value=(value) ⇒ Object



258
259
260
261
262
# File 'lib/plurimath/mathml/utility.rb', line 258

def msrow_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "msrow")
end

#mstack_value=(value) ⇒ Object



284
285
286
287
288
# File 'lib/plurimath/mathml/utility.rb', line 284

def mstack_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "mstack")
end

#mstyle_value=(value) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
# File 'lib/plurimath/mathml/utility.rb', line 154

def mstyle_value=(value)
  return if value.nil? || value.empty?

  update_temp(
    replace_order_with_value(
      @temp_mathml_order,
      Array(value),
      "mstyle",
    ),
  )
end

#msub_value=(value) ⇒ Object



202
203
204
205
206
# File 'lib/plurimath/mathml/utility.rb', line 202

def msub_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "msub")
end

#msubsup_value=(value) ⇒ Object



178
179
180
181
182
# File 'lib/plurimath/mathml/utility.rb', line 178

def msubsup_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "msubsup")
end

#msup_value=(value) ⇒ Object



196
197
198
199
200
# File 'lib/plurimath/mathml/utility.rb', line 196

def msup_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "msup")
end

#mtable_value=(value) ⇒ Object



208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/plurimath/mathml/utility.rb', line 208

def mtable_value=(value)
  return if value.nil? || value.empty?

  if respond_to?(:value)
    self.value = replace_order_with_value(
      self.value,
      update_temp_mathml_values(value),
      "mtable",
    )
  else
    update_temp_order(value, "mtable")
  end
end

#mtext_value=(value) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
# File 'lib/plurimath/mathml/utility.rb', line 130

def mtext_value=(value)
  return if value.nil? || value.empty?

  update_temp(
    replace_order_with_value(
      @temp_mathml_order,
      Array(value),
      "mtext",
    ),
  )
end

#munder_value=(value) ⇒ Object



184
185
186
187
188
# File 'lib/plurimath/mathml/utility.rb', line 184

def munder_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "munder")
end

#munderover_value=(value) ⇒ Object



172
173
174
175
176
# File 'lib/plurimath/mathml/utility.rb', line 172

def munderover_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "munderover")
end

#none_value=(_) ⇒ Object



302
303
304
# File 'lib/plurimath/mathml/utility.rb', line 302

def none_value=(_)
  @temp_mathml_order&.delete("none")
end

#notation=(value) ⇒ Object



76
77
78
79
80
# File 'lib/plurimath/mathml/utility.rb', line 76

def notation=(value)
  return if value.nil? || value.empty?

  @parameter_one = value
end

#semantics_value=(value) ⇒ Object



278
279
280
281
282
# File 'lib/plurimath/mathml/utility.rb', line 278

def semantics_value=(value)
  return if value.nil? || value.empty?

  update_temp_order(value, "semantics")
end