metanorma-utils 1.4.4.2 → 1.4.5

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: 9e7d4b6d86dedc30058632c7ee8e4ac52f7da75d40ec9f8537410bb2d907ad84
4
- data.tar.gz: e0f0cc16ad9d45ef019beb1bbdffa37c65d01dc5e4a7447b9a0ce919eda0a193
3
+ metadata.gz: cf98f7674d114f222187c3da69bd8c436990eaec0a9a988402afdd8e178fe2e8
4
+ data.tar.gz: fecee536903d05211404268e2408c983c32332aabdfaac56de813d7a7fdc8eef
5
5
  SHA512:
6
- metadata.gz: 98028f963be5cc7261afe75ce8ebbecc08df32b16c7783e8a94263453941b3139549367f6baa0576a187aafa2007b400fc76d7e6905a249216866aa9c075466b
7
- data.tar.gz: f8e5cb9be34dc02eb56e24c6cd7c3b8e477f89eebdb356d130ad903ce5c12f63fdfcae934ebb859570d01f5ae8b3dda156c96b3e88b290a83540135ef6c1477d
6
+ metadata.gz: e2f07346a598463eeb74fabb69e930ce7bb343a72e574303d3a22517532d421bb2df84733bcebd846bfce69b20d9cb1ee798d917dadcfe44f46920606a9b64c8
7
+ data.tar.gz: 8cb5b3a0b22c94d6945002d2735e4babc9809056bd14e26b396ec3d03391d5867829e21fad78955cca7c62cb876c56adb9d896feb53957c9c3da74dcd400bfa3
@@ -18,6 +18,9 @@ jobs:
18
18
  uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
19
19
  with:
20
20
  next_version: ${{ github.event.inputs.next_version }}
21
+ release_command: rake release
22
+ bundler_cache: false
23
+ post_install: gem install bundler rake rspec
21
24
  secrets:
22
25
  rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
23
26
  pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
data/lib/utils/main.rb CHANGED
@@ -3,6 +3,7 @@ require "tempfile"
3
3
  require "sterile"
4
4
  require "htmlentities"
5
5
  require "nokogiri"
6
+ require "csv"
6
7
 
7
8
  module Metanorma
8
9
  module Utils
data/lib/utils/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Utils
3
- VERSION = "1.4.4.2".freeze
3
+ VERSION = "1.4.5".freeze
4
4
  end
5
5
  end
data/lib/utils/xml.rb CHANGED
@@ -6,12 +6,19 @@ require "nokogiri"
6
6
 
7
7
  module Metanorma
8
8
  module Utils
9
- NAMECHAR = "\u0000-\u002c\u002f\u003a-\u0040\\u005b-\u005e"\
10
- "\u0060\u007b-\u00b6\u00b8-\u00bf\u00d7\u00f7\u037e"\
11
- "\u2000-\u200b"\
9
+ NAMECHAR = "\u0000-\u002c\u002f\u003a-\u0040\\u005b-\u005e" \
10
+ "\u0060\u007b-\u00b6\u00b8-\u00bf\u00d7\u00f7\u037e" \
11
+ "\u2000-\u200b" \
12
12
  "\u200e-\u203e\u2041-\u206f\u2190-\u2bff\u2ff0-\u3000".freeze
13
- NAMESTARTCHAR = "\\u002d\u002e\u0030-\u0039\u00b7\u0300-\u036f"\
13
+ NAMESTARTCHAR = "\\u002d\u002e\u0030-\u0039\u00b7\u0300-\u036f" \
14
14
  "\u203f-\u2040".freeze
15
+ NOKOHEAD = <<~HERE.freeze
16
+ <!DOCTYPE html SYSTEM
17
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
18
+ <html xmlns="http://www.w3.org/1999/xhtml">
19
+ <head> <title></title> <meta charset="UTF-8" /> </head>
20
+ <body> </body> </html>
21
+ HERE
15
22
 
16
23
  class << self
17
24
  def to_ncname(tag, asciionly: true)
@@ -31,14 +38,6 @@ module Metanorma
31
38
  node.nil? || node.id.nil? || node.id.empty? ? "_#{uuid}" : node.id
32
39
  end
33
40
 
34
- NOKOHEAD = <<~HERE.freeze
35
- <!DOCTYPE html SYSTEM
36
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
37
- <html xmlns="http://www.w3.org/1999/xhtml">
38
- <head> <title></title> <meta charset="UTF-8" /> </head>
39
- <body> </body> </html>
40
- HERE
41
-
42
41
  # block for processing XML document fragments as XHTML,
43
42
  # to allow for HTMLentities
44
43
  # Unescape special chars used in Asciidoctor substitution processing
@@ -55,12 +54,36 @@ module Metanorma
55
54
  end
56
55
  end
57
56
 
57
+ def noko_html(&block)
58
+ doc = ::Nokogiri::XML.parse(NOKOHEAD)
59
+ fragment = doc.fragment("")
60
+ ::Nokogiri::XML::Builder.with fragment, &block
61
+ fragment.to_xml(encoding: "US-ASCII").lines.map do |l|
62
+ l.gsub(/\s*\n/, "")
63
+ end
64
+ end
65
+
66
+ def to_xhtml_fragment(xml)
67
+ doc = ::Nokogiri::XML.parse(NOKOHEAD)
68
+ doc.fragment(xml)
69
+ end
70
+
58
71
  def ns(xpath)
59
72
  xpath.gsub(%r{/([a-zA-z])}, "/xmlns:\\1")
60
73
  .gsub(%r{::([a-zA-z])}, "::xmlns:\\1")
61
74
  .gsub(%r{\[([a-zA-z][a-z0-9A-Z@/-]* ?=)}, "[xmlns:\\1")
62
75
  .gsub(%r{\[([a-zA-z][a-z0-9A-Z@/-]*[/\[\]])}, "[xmlns:\\1")
63
76
  end
77
+
78
+ def numeric_escapes(xml)
79
+ c = HTMLEntities.new
80
+ xml.split(/(&[^ \r\n\t#;]+;)/).map do |t|
81
+ if /^(&[^ \t\r\n#;]+;)/.match?(t)
82
+ c.encode(c.decode(t), :hexadecimal)
83
+ else t
84
+ end
85
+ end.join
86
+ end
64
87
  end
65
88
  end
66
89
  end
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency "asciidoctor", ">= 2"
28
28
  spec.add_dependency "concurrent-ruby"
29
+ spec.add_dependency "csv"
29
30
  spec.add_dependency "htmlentities", "~> 4.3.4"
30
31
  spec.add_dependency "marcel", "~> 1.0.0"
31
32
  spec.add_dependency "mime-types"
@@ -37,7 +38,6 @@ Gem::Specification.new do |spec|
37
38
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
38
39
  spec.add_development_dependency "guard", "~> 2.14"
39
40
  spec.add_development_dependency "guard-rspec", "~> 4.7"
40
- spec.add_development_dependency "metanorma-standoc", "~> 2.0"
41
41
  spec.add_development_dependency "rake", "~> 13.0"
42
42
  spec.add_development_dependency "rspec", "~> 3.6"
43
43
  spec.add_development_dependency "rubocop", "~> 1.5.2"
data/spec/img_spec.rb CHANGED
@@ -2,16 +2,15 @@ require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
4
  RSpec.describe Metanorma::Utils do
5
-
6
5
  context "recognises data uris" do
7
6
  it "where the content is an existing file at a relative path" do
8
7
  expect(Metanorma::Utils.datauri("spec/fixtures/rice_image1.png"))
9
- .to eq Metanorma::Utils.encode_datauri('spec/fixtures/rice_image1.png')
8
+ .to eq Metanorma::Utils.encode_datauri("spec/fixtures/rice_image1.png")
10
9
  end
11
10
 
12
11
  it "where the content is an existing file at an absolute path" do
13
12
  expect(Metanorma::Utils.datauri(File.expand_path("spec/fixtures/rice_image1.png")))
14
- .to eq Metanorma::Utils.encode_datauri('spec/fixtures/rice_image1.png')
13
+ .to eq Metanorma::Utils.encode_datauri("spec/fixtures/rice_image1.png")
15
14
  end
16
15
 
17
16
  it "where the content is a relative file path pointing to a bogus file" do
@@ -339,10 +338,12 @@ RSpec.describe Metanorma::Utils do
339
338
  it "generates data uris" do
340
339
  expect(Metanorma::Utils.datauri("data:xyz")).to eq "data:xyz"
341
340
  expect(Metanorma::Utils.datauri("spec/fixtures/rice_image1.png")).to be_equivalent_to "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAABmJLR0QA/wD/AP+gvaeTAAAEzUlEQVR4nO3dz4tVZRzH8fedacogMCjHoiBop1RaOzF/QAv7QUIYZdCq/oQo+hdC10FRbVtVBC0r09y0iZAmoVwWRRaMBZlKnhZ3UlEwnVFnhvt6wQPnnnOeh8/m8r0P9zznKQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAS/wLBh+fQNux/v8AAAAASUVORK5CYII="
342
- expect(Metanorma::Utils.datauri("rice_image1.png",
341
+ expect(Metanorma::Utils.datauri("rice_image1.png",
343
342
  "spec/fixtures")).to be_equivalent_to "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAABmJLR0QA/wD/AP+gvaeTAAAEzUlEQVR4nO3dz4tVZRzH8fedacogMCjHoiBop1RaOzF/QAv7QUIYZdCq/oQo+hdC10FRbVtVBC0r09y0iZAmoVwWRRaMBZlKnhZ3UlEwnVFnhvt6wQPnnnOeh8/m8r0P9zznKQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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ruALBMdlUb9q6/+uJRtf32en62qo2Nn86CiaOAMKmerXr5rsUP8NLd5w6fWXIaWIUUECbV1qqti5h9/Gfb+b7blpwGViEFhEl177qZumUJ34A1U3XHTFX3XKNMsKooIAAsigLCpPrx+Jk6tYRnp/4+W7+fqeqna5QJVhUFhEl1uOrwicUPcGj+/OGS08AqpIAwqT6oevfnxQ/w3i/nDj9achpYhSwkZFJNV0dGtfGLzeN1HVfjwHw9Nl5IOFc9lIWETCAzECbVP9XrQ7VnruHYySvv+MPJem6uYRh/fC3FgwnlbaJMsu+r2/4629b3f23YsrbRfWsu3+HgfO06cu49WPuqN29ATgBWoOnGhWCYqmHvbMNnmxpObT//OvdT2xs+3TS+dsHeIG/kBxgA1ZNdsKFUF2wo1aUbSj2+bCkBWJGmGheHtxoXij8W2tzCuV353xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAS/wLBh+fQNux/v8AAAAASUVORK5CYII=")&.first&.to_s).to eq "image/png"
345
- expect(Metanorma::Utils.datauri("spec/fixtures/rice_image0.png")).to be_equivalent_to "spec/fixtures/rice_image0.png"
346
- expect{Metanorma::Utils.datauri("spec/fixtures/rice_image0.png")}.to output(%r{Image specified at `spec/fixtures/rice_image0\.png` does not exist\.}).to_stderr
344
+ expect(Metanorma::Utils.datauri("spec/fixtures/rice_image0.png")).to be_equivalent_to "spec/fixtures/rice_image0.png"
345
+ expect do
346
+ Metanorma::Utils.datauri("spec/fixtures/rice_image0.png")
347
+ end.to output(%r{Image specified at `spec/fixtures/rice_image0\.png` does not exist\.}).to_stderr
347
348
  end
348
349
  end
data/spec/utils_spec.rb CHANGED
@@ -23,11 +23,10 @@ RSpec.describe Metanorma::Utils do
23
23
  end
24
24
 
25
25
  it "applies Asciidoctor substitutions" do
26
- require "metanorma-standoc"
27
- expect(Metanorma::Utils.asciidoc_sub("A -- B"))
26
+ expect(Metanorma::Utils.asciidoc_sub("A -- B", "html"))
28
27
  .to eq "A&#8201;&#8212;&#8201;B"
29
- expect(Metanorma::Utils.asciidoc_sub("*A* stem:[x]"))
30
- .to eq "<strong>A</strong> <stem type=\"AsciiMath\">x</stem>"
28
+ expect(Metanorma::Utils.asciidoc_sub("*A* stem:[x]", "html"))
29
+ .to eq "<strong>A</strong> \\$x\\$"
31
30
  end
32
31
 
33
32
  it "finds file path of docfile" do
data/spec/xml_spec.rb CHANGED
@@ -34,6 +34,12 @@ RSpec.describe Metanorma::Utils do
34
34
  expect(out).to be_equivalent_to <<~OUTPUT
35
35
  &lt;A&gt; –
36
36
  OUTPUT
37
+ out = Metanorma::Utils.noko_html do |xml|
38
+ xml << doc.blocks.first.content
39
+ end.join
40
+ expect(out).to be_equivalent_to <<~OUTPUT
41
+ &lt;A&gt; –
42
+ OUTPUT
37
43
  end
38
44
 
39
45
  it "wraps an Asciidoctor node in paragraph" do
@@ -69,7 +75,14 @@ RSpec.describe Metanorma::Utils do
69
75
 
70
76
  it "applies namespace to xpath" do
71
77
  expect(Metanorma::Utils.ns("//ab/Bb/c1-d[ancestor::c][d = 'x'][e/f]"))
72
- .to be_equivalent_to("//xmlns:ab/xmlns:Bb/xmlns:c1-d[ancestor::xmlns:c]"\
78
+ .to be_equivalent_to("//xmlns:ab/xmlns:Bb/xmlns:c1-d[ancestor::xmlns:c]" \
73
79
  "[xmlns:d = 'x'][xmlns:e/xmlns:f]")
74
80
  end
81
+
82
+ it "converts HTML escapes to hex" do
83
+ expect(Metanorma::Utils.numeric_escapes("A&eacute;B"))
84
+ .to be_equivalent_to "A&#xe9;B"
85
+ expect(Metanorma::Utils.numeric_escapes("A<X>&eacute;</X>B"))
86
+ .to be_equivalent_to "A<X>&#xe9;</X>B"
87
+ end
75
88
  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.4.4.2
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-25 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: csv
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: htmlentities
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -178,20 +192,6 @@ dependencies:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
194
  version: '4.7'
181
- - !ruby/object:Gem::Dependency
182
- name: metanorma-standoc
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - "~>"
186
- - !ruby/object:Gem::Version
187
- version: '2.0'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - "~>"
193
- - !ruby/object:Gem::Version
194
- version: '2.0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rake
197
197
  requirement: !ruby/object:Gem::Requirement