plurimath 0.11.19 → 0.11.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '038e5d829d6925d7a510cd1d086222667316c31fea155ae0d073c3bdd8f2c206'
4
- data.tar.gz: 40ddb7889316f102cc0c95f52cb135af2670d3bfb66530832b9cee1abd909948
3
+ metadata.gz: a69d981641405f80fcf37a554402f4a17002bbcfe0dd6789d10592e25c46f4cc
4
+ data.tar.gz: 645a5f67e012c228f576d4fc1a8cc8329c3023a25c67ed421edafc8a2e64031f
5
5
  SHA512:
6
- metadata.gz: d7b6b28282a878c0d4101fae6ca24b5b0ef8d344405a3840e519866926cb01af5cc6803058377b6a4c9089e6094ca736224bc5d1e72a418db3eb7cf0129aed7d
7
- data.tar.gz: bdb74cb6adb73ab34912fbdb432c53c775dde1c00e3e4842813eb4a173423e3090b5a1fa0e1ced3119ee470d1c702f8448dfc69d662c33c4103d6767cee40501
6
+ metadata.gz: 85f44ae770d491f2b71200691a31755868183d265b9c7ca90c2f26b519186e91bfec21255c99231adbfa0246e965bc75d455864fcaadd86254097d7ae8a26a9c
7
+ data.tar.gz: 264337d202cd3db9bdf41817ecb20da26f336f24ec9789099387bb2eef489300903ab3b9e7ccb54f4915faa07b979f070f492836af1e60f170d0819b523bab51
@@ -22,5 +22,9 @@ jobs:
22
22
  bundler-cache: true
23
23
  - name: Check the generated regions of the format pages
24
24
  run: bundle exec ruby scripts/docs/format_specs.rb --check
25
+ # The released amath gem does not ship its grammar sources, so check
26
+ # out the amath tag that matches the locked gem version.
27
+ - name: Check out the amath sources for the locked version
28
+ run: git clone --quiet --depth 1 --branch "v$(bundle exec ruby -e 'print Gem.loaded_specs["amath"].version')" https://github.com/plurimath/amath.git "$RUNNER_TEMP/amath"
25
29
  - name: Check the generated regions of the AsciiMath specification
26
- run: bundle exec ruby scripts/docs/asciimath_tables.rb --amath "$(bundle info amath --path)" --check
30
+ run: bundle exec ruby scripts/docs/asciimath_tables.rb --amath "$RUNNER_TEMP/amath" --check
@@ -12,12 +12,19 @@ on:
12
12
  default: 'skip'
13
13
  repository_dispatch:
14
14
  types: [ do-release ]
15
+ # The publish leg: when the release PR (head branch release/v*) merges,
16
+ # metanorma/ci tags the merge commit and publishes (metanorma/ci#515).
17
+ # Ordinary PR closes are skipped inside the reusable workflow.
18
+ pull_request:
19
+ types:
20
+ - closed
15
21
 
16
22
  jobs:
17
23
  release:
18
24
  permissions:
19
25
  contents: write
20
26
  id-token: write
27
+ pull-requests: write
21
28
  uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
22
29
  with:
23
30
  next_version: ${{ github.event.inputs.next_version }}
data/docs/asciimath.adoc CHANGED
@@ -114,19 +114,19 @@ bindings, which amath removes before returning the tree.
114
114
  |===
115
115
  |Item |Value
116
116
 
117
- |amath revision documented |`667b517bb81276bf920f6f9fea940ae342d8c9e3`
118
- |`grammars/asciimath.parg` |`sha256:8fc391577745dec67f31913a54de1060c6856f5514ed3c11300724a462ae8cfb`
117
+ |amath revision documented |`d6b5d100d9bfdf8133a59ab103dd9676c3a3a48d`
118
+ |`grammars/asciimath.parg` |`sha256:08cea18f49353c14f349ea67c91d748dd449538549654ab1be060f33269769ed`
119
119
  |`data/vocabulary.json` |`sha256:768016984baee3ea142b69f0f31f4b9e9255ddedea078d6c7fb1728dc718695c`
120
120
  |vocabulary format |`amath-vocabulary/v2`
121
121
  |vocabulary registry edition |`1`
122
122
  |vocabulary oracle (Plurimath revision) |`ae20be111a26fdd988c58be0bfb2b7f6fe6e352f`
123
- |artifact checksum (`artifacts/asciimath.json`) |`sha256:38d3d04d938de7a1989dd7779e725c1c19d6f6fb38a3a65feb4bcc5c8395f369`
124
- |artifact compiler (Parsanol) |`1.3.134`
123
+ |artifact checksum (`artifacts/asciimath.json`) |`sha256:ecfc0c6e99ab262d7290d9098550e60cb5c568a3dfb6bc8c0da20a13904fda62`
124
+ |artifact compiler (Parsanol) |`1.5.1.0`
125
125
  |artifact entries |`dot comma arabic`
126
- |runtime amath gem |`0.2.0`
127
- |runtime artifact checksum |`sha256:38d3d04d938de7a1989dd7779e725c1c19d6f6fb38a3a65feb4bcc5c8395f369`
128
- |runtime grammar source hash |`sha256:8fc391577745dec67f31913a54de1060c6856f5514ed3c11300724a462ae8cfb`
129
- |runtime artifact compiler (Parsanol) |`1.3.134`
126
+ |runtime amath gem |`0.2.1`
127
+ |runtime artifact checksum |`sha256:ecfc0c6e99ab262d7290d9098550e60cb5c568a3dfb6bc8c0da20a13904fda62`
128
+ |runtime grammar source hash |`sha256:08cea18f49353c14f349ea67c91d748dd449538549654ab1be060f33269769ed`
129
+ |runtime artifact compiler (Parsanol) |`1.5.1.0`
130
130
  |uncertainty rules, runtime vs documented revision |`byte-identical`
131
131
  |===
132
132
  // END GENERATED provenance
@@ -388,13 +388,13 @@ unc_scaled_pair = unc_open unc_measured_pair unc_close unc_shared_exponent
388
388
  unc_measured_interval = unc_value unc_sep (unc_number) as lower unc_sep (unc_number) as upper
389
389
  unc_scaled_interval = unc_open unc_measured_interval unc_close unc_shared_exponent
390
390
  unc_standard = unc_scaled_pair / unc_value (unc_sep (unc_number) as magnitude / "(" (1*digit) as concise_digits ")" [unc_shared_exponent])
391
- uncertainty = (uncertainty_std / uncertainty_exp / uncertainty_cov) as uncertainty
391
+ uncertainty = ("\"" (uncertainty_std / uncertainty_exp / uncertainty_cov) "\"") as uncertainty
392
392
  uncertainty_std = ("ustd") as uncertainty_class unc_open unc_standard [unc_unit] unc_close
393
393
  uncertainty_exp = ("uexp") as uncertainty_class unc_open (unc_scaled_pair / unc_measured_pair) unc_sep (unc_number) as coverage_factor [unc_sep (unc_number) as coverage_probability] [unc_unit] unc_close
394
394
  uncertainty_cov = ("ucov") as uncertainty_class unc_open (unc_scaled_interval / unc_measured_interval) unc_sep (unc_number) as coverage_probability [unc_sep ("shortest" / "symmetric") as interval_kind] [unc_unit] unc_close
395
395
  ----
396
396
 
397
- Checksum of the excerpt (lines joined by line feeds): `sha256:5b0145491639cb5e5d10e9ac0a9df6d8ae3a2dd3a360d4f4fc8ad2a80a128027`.
397
+ Checksum of the excerpt (lines joined by line feeds): `sha256:5b17c046cf627999d40783b7c8af3296bd0dfcd3d7143ea18f1ca14d1fb35eda`.
398
398
  // END GENERATED uncertainty-grammar
399
399
 
400
400
  The forms they accept:
data/docs/latex.adoc CHANGED
@@ -243,7 +243,7 @@ Plurimath::Math.parse("ustd(1.230, 0.004)", :asciimath).to_latex
243
243
 
244
244
  [source]
245
245
  ----
246
- 1.230(0.004)
246
+ u s t d ( 1.230 , 0.004 )
247
247
  ----
248
248
  // END GENERATED example uncertainty-standard
249
249
 
@@ -255,7 +255,7 @@ Plurimath::Math.parse("ucov(1.024, 0.983, 1.088, 0.95, shortest)", :asciimath).t
255
255
 
256
256
  [source]
257
257
  ----
258
- 1.024,\ [0.983, 1.088],\ p = 0.95
258
+ u c o v ( 1.024 , 0.983 , 1.088 , 0.95 , s h o r t e s t )
259
259
  ----
260
260
  // END GENERATED example uncertainty-interval
261
261
 
@@ -308,7 +308,7 @@ raises Plurimath::Math::ParseError
308
308
  == Conformance
309
309
 
310
310
  // BEGIN GENERATED conformance
311
- Shared testsuite at `51d64ea4006f29df085445e469e74190aa6758c5` (the `submodules/plurimath-testsuite` commit):
311
+ Shared testsuite at `9767c37a8d7bb21a0694780ecfcbc4f1fbd9eb39` (the `submodules/plurimath-testsuite` commit):
312
312
 
313
313
  [cols="3,1,3"]
314
314
  |===
data/docs/mathml.adoc CHANGED
@@ -511,13 +511,16 @@ Plurimath::Math.parse("ustd(1.230, 0.004)", :asciimath).to_mathml
511
511
  ----
512
512
  <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
513
513
  <mstyle displaystyle="true">
514
- <mrow intent="standard-uncertainty(1.230,0.004)">
514
+ <mi>u</mi>
515
+ <mi>s</mi>
516
+ <mi>t</mi>
517
+ <mi>d</mi>
518
+ <mrow>
519
+ <mo>(</mo>
515
520
  <mn>1.230</mn>
516
- <mrow>
517
- <mo>(</mo>
518
- <mn>0.004</mn>
519
- <mo>)</mo>
520
- </mrow>
521
+ <mo>,</mo>
522
+ <mn>0.004</mn>
523
+ <mo>)</mo>
521
524
  </mrow>
522
525
  </mstyle>
523
526
  </math>
@@ -588,7 +591,7 @@ raises Plurimath::Math::ParseOptionError
588
591
  == Conformance
589
592
 
590
593
  // BEGIN GENERATED conformance
591
- Shared testsuite at `51d64ea4006f29df085445e469e74190aa6758c5` (the `submodules/plurimath-testsuite` commit):
594
+ Shared testsuite at `9767c37a8d7bb21a0694780ecfcbc4f1fbd9eb39` (the `submodules/plurimath-testsuite` commit):
592
595
 
593
596
  [cols="3,1,3"]
594
597
  |===
data/docs/omml.adoc CHANGED
@@ -475,41 +475,36 @@ Plurimath::Math.parse("ustd(1.230, 0.004)", :asciimath).to_omml
475
475
  ----
476
476
  <m:oMathPara xmlns:m="..." ...>
477
477
  <m:oMath>
478
- <m:box>
478
+ <m:r>
479
+ <m:t>u</m:t>
480
+ </m:r>
481
+ <m:r>
482
+ <m:t>s</m:t>
483
+ </m:r>
484
+ <m:r>
485
+ <m:t>t</m:t>
486
+ </m:r>
487
+ <m:r>
488
+ <m:t>d</m:t>
489
+ </m:r>
490
+ <m:d>
491
+ <m:dPr>
492
+ <m:begChr m:val="("/>
493
+ <m:sepChr m:val=""/>
494
+ <m:endChr m:val=")"/>
495
+ </m:dPr>
479
496
  <m:e>
480
- <m:phant>
481
- <m:phantPr>
482
- <m:show m:val="off"/>
483
- <m:zeroWid m:val="on"/>
484
- <m:zeroAsc m:val="on"/>
485
- <m:zeroDesc m:val="on"/>
486
- </m:phantPr>
487
- <m:e>
488
- <m:r>
489
- <m:rPr>
490
- <m:sty m:val="p"/>
491
- </m:rPr>
492
- <m:t>standard-uncertainty(1.230,0.004)</m:t>
493
- </m:r>
494
- </m:e>
495
- </m:phant>
496
497
  <m:r>
497
498
  <m:t>1.230</m:t>
498
499
  </m:r>
499
- <m:d>
500
- <m:dPr>
501
- <m:begChr m:val="("/>
502
- <m:sepChr m:val=""/>
503
- <m:endChr m:val=")"/>
504
- </m:dPr>
505
- <m:e>
506
- <m:r>
507
- <m:t>0.004</m:t>
508
- </m:r>
509
- </m:e>
510
- </m:d>
500
+ <m:r>
501
+ <m:t>,</m:t>
502
+ </m:r>
503
+ <m:r>
504
+ <m:t>0.004</m:t>
505
+ </m:r>
511
506
  </m:e>
512
- </m:box>
507
+ </m:d>
513
508
  </m:oMath>
514
509
  </m:oMathPara>
515
510
  ----
@@ -560,7 +555,7 @@ meets a node it does not support. The original error is not kept as the
560
555
  == Conformance
561
556
 
562
557
  // BEGIN GENERATED conformance
563
- Shared testsuite at `51d64ea4006f29df085445e469e74190aa6758c5` (the `submodules/plurimath-testsuite` commit):
558
+ Shared testsuite at `9767c37a8d7bb21a0694780ecfcbc4f1fbd9eb39` (the `submodules/plurimath-testsuite` commit):
564
559
 
565
560
  [cols="3,1,3"]
566
561
  |===
@@ -347,7 +347,7 @@ Plurimath::Math.parse("ustd(1.230, 0.004)", :asciimath).to_unicodemath
347
347
 
348
348
  [source]
349
349
  ----
350
- ⓘ("standard-uncertainty(1.230,0.004)"1.230(0.004))
350
+ u s t d (1.230 , 0.004)
351
351
  ----
352
352
  // END GENERATED example uncertainty
353
353
 
@@ -363,7 +363,7 @@ Plurimath::Math.parse("ustd(-1.230, 0.004)", :asciimath).to_unicodemath
363
363
 
364
364
  [source]
365
365
  ----
366
- ⓘ("standard-uncertainty(-1.230,0.004)"〖-1.230〗(0.004))
366
+ u s t d (− 1.230 , 0.004)
367
367
  ----
368
368
  // END GENERATED example uncertainty-negative
369
369
 
@@ -380,7 +380,7 @@ Plurimath::Math.parse(%q(ustd(1.2, 0.1, "unitsml(kg)")), :asciimath).to_unicodem
380
380
 
381
381
  [source]
382
382
  ----
383
- ⓘ("standard-uncertainty(1.2,0.1,$unit)"1.2(0.1)ⓐ(unit \mup"kg"))
383
+ u s t d (1.2 , 0.1 , \mup"kg")
384
384
  ----
385
385
  // END GENERATED example uncertainty-unit
386
386
 
@@ -392,7 +392,7 @@ Plurimath::Math.parse("ⓘ(\"standard-uncertainty(1.2,0.1,$unit)\"1.2(0.1)ⓐ(un
392
392
 
393
393
  [source]
394
394
  ----
395
- ustd(1.2, 0.1, "unitsml(kg)")
395
+ "ustd(1.2, 0.1, "unitsml(kg)")"
396
396
  ----
397
397
  // END GENERATED example uncertainty-unit-readback
398
398
 
@@ -421,7 +421,7 @@ as a `ParseError`.
421
421
  == Conformance
422
422
 
423
423
  // BEGIN GENERATED conformance
424
- Shared testsuite at `51d64ea4006f29df085445e469e74190aa6758c5` (the `submodules/plurimath-testsuite` commit):
424
+ Shared testsuite at `9767c37a8d7bb21a0694780ecfcbc4f1fbd9eb39` (the `submodules/plurimath-testsuite` commit):
425
425
 
426
426
  [cols="3,1,3"]
427
427
  |===
data/docs/unitsml.adoc CHANGED
@@ -387,7 +387,7 @@ In AsciiMath the same errors make the whole formula fail to parse.
387
387
  == Conformance
388
388
 
389
389
  // BEGIN GENERATED conformance
390
- Shared testsuite at `51d64ea4006f29df085445e469e74190aa6758c5` (the `submodules/plurimath-testsuite` commit):
390
+ Shared testsuite at `9767c37a8d7bb21a0694780ecfcbc4f1fbd9eb39` (the `submodules/plurimath-testsuite` commit):
391
391
 
392
392
  [cols="3,1,3"]
393
393
  |===
@@ -520,12 +520,23 @@ options:)
520
520
  style.nodes.first["unitsml"] == "true"
521
521
  end
522
522
 
523
+ # Elements whose children are positional arguments (base, script,
524
+ # numerator, ...). A spacer added as a sibling here would add an
525
+ # argument and break the MathML grammar, so it goes inside the unit.
526
+ FIXED_ARITY_ELEMENTS = %w[
527
+ msub msup msubsup mfrac mroot munder mover munderover mmultiscripts
528
+ ].freeze
529
+
523
530
  def unitsml_processing(nodes, prev_node)
524
531
  insert_index = 0
525
532
  nodes.each.with_index do |node, index|
526
533
  if node[:unitsml]
527
- prev_node.insert_in_nodes(index + insert_index, space_element)
528
- insert_index += 1
534
+ if FIXED_ARITY_ELEMENTS.include?(prev_node.name)
535
+ node.insert_in_nodes(0, space_element) if node.name == "mrow"
536
+ else
537
+ prev_node.insert_in_nodes(index + insert_index, space_element)
538
+ insert_index += 1
539
+ end
529
540
  node.remove_attr("unitsml")
530
541
  end
531
542
  unitsml_processing(node.nodes, node) if node.nodes.none?(String)
@@ -75,8 +75,12 @@ options:)
75
75
  new_arr
76
76
  end
77
77
 
78
+ # The color is one value. AsciiMath reads color(red) as the
79
+ # symbols r, e and d, which write back space-separated; drop the
80
+ # spaces as #to_asciimath and the MathML attribute already do.
78
81
  def to_unicodemath(options:)
79
- "#{color_symbol}(#{parameter_one.to_unicodemath(options: options)}&#{parameter_two.to_unicodemath(options: options)})"
82
+ color = parameter_one.to_unicodemath(options: options)&.gsub(/\s/, "")
83
+ "#{color_symbol}(#{color}&#{parameter_two.to_unicodemath(options: options)})"
80
84
  end
81
85
 
82
86
  protected
@@ -79,6 +79,10 @@ module Plurimath
79
79
 
80
80
  def to_unicodemath(options:)
81
81
  return unicodemath_fraction if self.options&.dig(:unicodemath_fraction)
82
+ # Render each part once: the ⊘ form does not use the parenthesized
83
+ # parts, and computing them first doubled the work at every
84
+ # nesting level.
85
+ return unicodemath_displaystyle(options) if unicodemath_displaystyle?
82
86
 
83
87
  if parameter_one
84
88
  first_value = unicodemath_parens(parameter_one,
@@ -91,7 +95,6 @@ module Plurimath
91
95
  return "#{first_value}/#{second_value}" unless self.options
92
96
 
93
97
  return "#{first_value}¦#{second_value}" if self.options&.key?(:linethickness)
94
- return "#{parameter_one.to_unicodemath(options: options)}⊘#{parameter_two.to_unicodemath(options: options)}" if self.options&.key?(:displaystyle)
95
98
 
96
99
  "#{first_value}∕#{second_value}" if self.options&.key?(:ldiv)
97
100
  end
@@ -143,6 +146,17 @@ module Plurimath
143
146
 
144
147
  protected
145
148
 
149
+ def unicodemath_displaystyle?
150
+ return false unless options
151
+ return false if options.key?(:linethickness)
152
+
153
+ options.key?(:displaystyle)
154
+ end
155
+
156
+ def unicodemath_displaystyle(options)
157
+ "#{parameter_one.to_unicodemath(options: options)}⊘#{parameter_two.to_unicodemath(options: options)}"
158
+ end
159
+
146
160
  def fpr_element
147
161
  fpr_element = XmlHelper.ox_element("fPr", namespace: "m")
148
162
  if options
@@ -99,6 +99,11 @@ module Plurimath
99
99
  end
100
100
 
101
101
  def to_omml_without_math_tag(_, **)
102
+ # Office Math represents thick spacing with U+2004. Keep this
103
+ # explicit request separate from ordinary invisible multiplication.
104
+ if value == "&#x2062;" && @options&.[](:rspace) == "thickmathspace"
105
+ return "&#x2004;"
106
+ end
102
107
  # TODO: remove this condition once to word rendering issue is resolved, plurimath/plurimath/pull/328
103
108
  return if value == "&#x2062;"
104
109
 
@@ -115,7 +120,7 @@ module Plurimath
115
120
 
116
121
  def insert_t_tag(_, options:)
117
122
  # TODO: remove this condition once to word rendering issue is resolved, plurimath/plurimath/pull/328
118
- return if value == "&#x2062;"
123
+ return if value == "&#x2062;" && !to_omml_without_math_tag(nil)
119
124
 
120
125
  [XmlHelper.ox_element("r", namespace: "m") << t_tag(options: options)]
121
126
  end
@@ -192,7 +197,11 @@ module Plurimath
192
197
  end
193
198
 
194
199
  def t_tag(options:)
195
- output = value || to_omml_without_math_tag(nil, options: options)
200
+ output = if value == "&#x2062;"
201
+ to_omml_without_math_tag(nil, options: options)
202
+ else
203
+ value || to_omml_without_math_tag(nil, options: options)
204
+ end
196
205
  return t_element unless output
197
206
 
198
207
  t_element << output
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plurimath
4
- VERSION = "0.11.19"
4
+ VERSION = "0.11.20"
5
5
  end
@@ -50,8 +50,8 @@ require "plurimath"
50
50
  module AsciimathCorpusReplay
51
51
  class Error < StandardError; end
52
52
 
53
- # plurimath-testsuite 0acf8b1be7602595b97b7f18cf3357451f5a9601
54
- TESTSUITE_COMMIT = "0acf8b1be7602595b97b7f18cf3357451f5a9601"
53
+ # plurimath-testsuite 9767c37a8d7bb21a0694780ecfcbc4f1fbd9eb39
54
+ TESTSUITE_COMMIT = "9767c37a8d7bb21a0694780ecfcbc4f1fbd9eb39"
55
55
  PROVENANCE_SHA256 =
56
56
  "4f7f379f3994eba5c33c5117c0084b7e0cc9b51a860474813a87de68a5c67130"
57
57
  PROVENANCE_SCHEMA = "plurimath-corpus/provenance/3"
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.19
4
+ version: 0.11.20
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-16 00:00:00.000000000 Z
11
+ date: 2026-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amath