plurimath 0.8.18 → 0.8.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 766097c1faa26dc82f8664fca18a302b52920df2fce4ec8395cf2f65d8a7d687
4
- data.tar.gz: 35cf1a6b6a0e87fa5404b3eea87927cd69da535deeebfcd49f8db5ce1aaba8e6
3
+ metadata.gz: c4e85060f4518be4f3e9a5c711949f75cbc9305b139c78b3305c7af8beff7774
4
+ data.tar.gz: 2119f426507bc22d27c98989f1841c584f2691451afd6962637c725c9c1762a7
5
5
  SHA512:
6
- metadata.gz: 7307ab95dc0d60e6fe65c939665e08ec59902527a454427956ee17e6d2c7bc207921e529ae107d51ec0f2a2a0909cd7da260943d277a03755efc34aa01edd2d0
7
- data.tar.gz: 6f050eb9cae6730e911ccae66afe0a4384ab0fade68810fa4fa176e15d5f37eef225f0b11c1409fcd10ed05e75cbf7aa6fdd10a4e18d85ab335dbb947c22d350
6
+ metadata.gz: a6d57d80296f733bf0980788e91c94a6ac0d3b525edc0e2276a3d55120d14cbc2976e9beadcfdd46320fcf4f57690f15d9dbe4313a59a2fd74723c68565546d7
7
+ data.tar.gz: bda92db07c284ac005ef82d255a0c60e85935805d2f8fa66db56b73272c0c90e9daa4c6e99df69cf77cd47678bfadf8b50ae715d2264d4d853848d4514ead7a4
data/Gemfile CHANGED
@@ -11,5 +11,5 @@ gem 'equivalent-xml'
11
11
  gem 'opal-rspec', "~> 1.1.0a"
12
12
  gem 'oga'
13
13
  gem 'ox'
14
- gem "unitsml", "0.2.9"
14
+ gem "unitsml"
15
15
  gem "debug"
@@ -629,11 +629,11 @@ module Plurimath
629
629
  end
630
630
 
631
631
  def unitsml_post_processing(nodes, prev_node)
632
+ insert_index = 0
632
633
  nodes.each.with_index do |node, index|
633
634
  if node[:unitsml]
634
- pre_index = index - 1
635
- pre_node = nodes[pre_index] if pre_index.zero? || pre_index.positive?
636
- prev_node.insert_in_nodes(index, space_element(node)) if valid_previous?(pre_node)
635
+ prev_node.insert_in_nodes(index + insert_index, space_element(node))
636
+ insert_index += 1
637
637
  node.remove_attr("unitsml")
638
638
  end
639
639
  unitsml_post_processing(node.nodes, node) if node.nodes.none?(String)
@@ -648,19 +648,10 @@ module Plurimath
648
648
 
649
649
  def space_element(node)
650
650
  element = (ox_element("mo") << "&#x2062;")
651
- element[:rspace] = "thickmathspace" if text_in_tag?(node.xml_nodes.nodes)
651
+ element[:rspace] = "thickmathspace"
652
652
  element
653
653
  end
654
654
 
655
- def text_in_tag?(nodes)
656
- next_nodes = nodes.first.nodes
657
- if next_nodes.all?(String)
658
- Utility.html_entity_to_unicode(next_nodes.first).match?(/\p{L}|\p{N}/)
659
- else
660
- text_in_tag?(next_nodes)
661
- end
662
- end
663
-
664
655
  def negated_value?
665
656
  value.last.is_a?(Math::Symbols::Symbol) && value.last.value == "&#x338;"
666
657
  end
@@ -670,21 +661,6 @@ module Plurimath
670
661
  value&.map { |v| v.to_unicodemath(options: options) }&.join(join_str)
671
662
  end
672
663
 
673
- def valid_previous?(previous)
674
- return unless previous
675
-
676
- ["mi", "mn"].include?(previous.name) ||
677
- inside_tag?(previous)
678
- end
679
-
680
- def inside_tag?(previous)
681
- previous&.nodes&.any? do |node|
682
- next if node.is_a?(String)
683
-
684
- valid_previous?(node) if node.xml_node?
685
- end
686
- end
687
-
688
664
  def intent_attribute(mathml)
689
665
  return unless mathml || value.length != 2
690
666
  return unless valid_first_parameter?(value.first)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plurimath
4
- VERSION = "0.8.18"
4
+ VERSION = "0.8.19"
5
5
  end
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.8.18
4
+ version: 0.8.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
11
+ date: 2024-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox