metanorma-utils 1.5.0 → 1.5.1

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: 33b64b5be38c76e221acfab262018c83cd448fc96ee1423c3d01cba7950a7427
4
- data.tar.gz: 557d07f77f11df468cdab64b9c49067dde93897a30c18ba026a119705b406fe3
3
+ metadata.gz: 37fbf39c85da8b63e44be8849a9ce41a15522c2e6b805cfb5f9de006701f3110
4
+ data.tar.gz: 743944d95ebf66f6489df542172126de21bf71e86f9048518bdaa3b9efb9fe0e
5
5
  SHA512:
6
- metadata.gz: 12f71c44d00c21d7e9184513ca4abb4035cdea9b4dc669256b19e8f2f24d3204a5764701eac78966a3714eceb240731fb53fcf8815d1dc05d44337b797d53093
7
- data.tar.gz: 2c956a89db56bd5afb818ac0078a45f838407b78a39bbba6ef403358f789c3a9dfdba20c65dbb67a57d3ed6c94a3a3098380ae0febbf7045a73d8ba788681d31
6
+ metadata.gz: 54239cf1ac5eddd882ea7426124ee609987376942d79ac08d52fb7827dbde060345da8940aafad22fcc01e2db4a1f3047863759e649d7a9529c57aa2eb60b0de
7
+ data.tar.gz: 4a2d387e3040dcf8f66d88c7f2f131b6bcc1c7fb81acc8d6fa583d46909e5f0dca91de3e8334ece768d6ccb716c7fa9112878aece02fdb54b4e4a9cc1b54a87e
data/lib/utils/log.rb CHANGED
@@ -37,13 +37,23 @@ module Metanorma
37
37
  end
38
38
 
39
39
  def context(node)
40
- return nil if node.is_a? String
41
-
42
- node.respond_to?(:to_xml) and return node.to_xml
40
+ node.is_a? String and return nil
41
+ node.respond_to?(:to_xml) and return human_readable_xml(node)
43
42
  node.respond_to?(:to_s) and return node.to_s
44
43
  nil
45
44
  end
46
45
 
46
+ # try to approximate input, at least for maths
47
+ def human_readable_xml(node)
48
+ ret = node.dup
49
+ ret.xpath(".//*[local-name() = 'stem']").each do |s|
50
+ sub = s.at("./*[local-name() = 'asciimath'] | " \
51
+ "./*[local-name() = 'latexmath']")
52
+ sub and s.replace(sub)
53
+ end
54
+ ret.to_xml
55
+ end
56
+
47
57
  def write(file)
48
58
  File.open(file, "w:UTF-8") do |f|
49
59
  f.puts "#{file} errors"
data/lib/utils/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Utils
3
- VERSION = "1.5.0".freeze
3
+ VERSION = "1.5.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-16 00:00:00.000000000 Z
11
+ date: 2023-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor