From 8921777f8aadd634f03625d2e721e0d4a8b4a113 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Tue, 24 Dec 2024 23:47:30 +0200 Subject: [PATCH 1/2] remove AsciiMath2UnitsML dependency: https://github.com/metanorma/metanorma-standoc/issues/947 --- lib/metanorma/standoc/cleanup_maths.rb | 5 ++--- lib/metanorma/standoc/validate_term.rb | 4 +++- metanorma-standoc.gemspec | 4 ++-- spec/metanorma/cleanup_math_spec.rb | 13 +------------ 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lib/metanorma/standoc/cleanup_maths.rb b/lib/metanorma/standoc/cleanup_maths.rb index 637c0f30..dbf494f4 100644 --- a/lib/metanorma/standoc/cleanup_maths.rb +++ b/lib/metanorma/standoc/cleanup_maths.rb @@ -1,4 +1,3 @@ -require "asciimath2unitsml" require_relative "cleanup_mathvariant" module Metanorma @@ -180,11 +179,11 @@ def mathml_number_format(stem) end def mathml_cleanup(xmldoc) - a2u = Asciimath2UnitsML::Conv.new(asciimath2unitsml_options) + #a2u = Asciimath2UnitsML::Conv.new(asciimath2unitsml_options) xmldoc.xpath("//stem[@type = 'MathML'][not(@validate = 'false')]") .each do |x| mathml_xml_cleanup(x) - a2u.MathML2UnitsML(x) + #a2u.MathML2UnitsML(x) mathml_mathvariant(x) end xmldoc.xpath("//stem[@type = 'MathML']") diff --git a/lib/metanorma/standoc/validate_term.rb b/lib/metanorma/standoc/validate_term.rb index 7d16087e..877984c6 100644 --- a/lib/metanorma/standoc/validate_term.rb +++ b/lib/metanorma/standoc/validate_term.rb @@ -1,3 +1,5 @@ +require "iev" + module Metanorma module Standoc module Validate @@ -7,7 +9,7 @@ module Validate def init_iev @no_isobib and return nil @iev and return @iev - @iev = Iev::Db.new(@iev_globalname, @iev_localname) unless @no_isobib + @iev = ::IEV::Db.new(@iev_globalname, @iev_localname) unless @no_isobib @iev end diff --git a/metanorma-standoc.gemspec b/metanorma-standoc.gemspec index 0dd1abff..0c439a21 100644 --- a/metanorma-standoc.gemspec +++ b/metanorma-standoc.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |spec| spec.add_dependency "addressable", "~> 2.8.0" spec.add_dependency "asciidoctor", "~> 2.0.0" spec.add_dependency "crass", "~> 1.0.0" - spec.add_dependency "iev", "~> 0.3.0" + spec.add_dependency "iev", ">= 0.3.4" spec.add_dependency "isodoc", "~> 2.12.4" spec.add_dependency "metanorma", ">= 1.6.0" spec.add_dependency "metanorma-plugin-datastruct", "~> 0.3.0" @@ -40,7 +40,7 @@ Gem::Specification.new do |spec| spec.add_dependency "metanorma-utils", "~> 1.10.0" spec.add_dependency "ruby-jing" # relaton-cli not just relaton, to avoid circular reference in metanorma - spec.add_dependency "asciimath2unitsml", "~> 0.4.0" + #spec.add_dependency "asciimath2unitsml", "~> 0.4.0" spec.add_dependency "concurrent-ruby" spec.add_dependency "pngcheck" spec.add_dependency "relaton-cli", "~> 1.20.0" diff --git a/spec/metanorma/cleanup_math_spec.rb b/spec/metanorma/cleanup_math_spec.rb index 4cf7d149..c419d705 100644 --- a/spec/metanorma/cleanup_math_spec.rb +++ b/spec/metanorma/cleanup_math_spec.rb @@ -578,18 +578,7 @@ stem:[1 "unitsml(cd)"] - [stem] - ++++ - - - 7 - unitsml(m*kg^-2) - + - 8 - unitsml(m*kg^-3) - - - ++++ + stem:[7 "unitsml(m*kg^-2)" + 8 "unitsml(m*kg^-3)"] INPUT output = <<~OUTPUT #{BLANK_HDR.sub('', <<~EXT From 9fa28e60d49dbece2c0019771b258981cd877d1f Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Tue, 7 Jan 2025 00:46:41 +0200 Subject: [PATCH 2/2] iev --- lib/metanorma/standoc/validate_term.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/metanorma/standoc/validate_term.rb b/lib/metanorma/standoc/validate_term.rb index 877984c6..b14f52e7 100644 --- a/lib/metanorma/standoc/validate_term.rb +++ b/lib/metanorma/standoc/validate_term.rb @@ -9,7 +9,7 @@ module Validate def init_iev @no_isobib and return nil @iev and return @iev - @iev = ::IEV::Db.new(@iev_globalname, @iev_localname) unless @no_isobib + @iev = ::Iev::Db.new(@iev_globalname, @iev_localname) unless @no_isobib @iev end