metanorma-utils 1.4.2 → 1.4.3

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: fd1e58ea4dadd1ad26ad1b254805c2c831914a1177b0e75ea166117a3c1a4e99
4
- data.tar.gz: 1479bd090933fc9e861f3b9aba780fa18fe863ddfa923ddcee7caa148956f754
3
+ metadata.gz: 38d5284e3547876d1ad2385d81d10dc9defa3e3669412c30b311fa2dd89857c4
4
+ data.tar.gz: e4bf71c720f096a107f2f22e075bb7391d2bdd844e020eb304ac4dc3c0323f29
5
5
  SHA512:
6
- metadata.gz: c4578a2d2450368c92cec783b297ab5c5ba921e3644dc6078b6df66af58b0a74f56e6e800d2d01322f8af6b95ebf3c2834076528308845aaca612ed851108990
7
- data.tar.gz: 343f2b25137e40335e56ce82f00297294f6f33a956d7bec3ccb76ad012d31a8594d78a31143919060d05fe6edfa2a3a39f06183548e2b9a671cb3f97a310d6c8
6
+ metadata.gz: 0a992b7f1f3980ee4e57b74cd272b743acd197061e382089edd8fd948e629f5e182f0d66b38848a1efe7c2195c2da5d0dcd790ada393fc3a1bca31dc11fb2a61
7
+ data.tar.gz: d085748cc3ac46d3a85861c2533e9d361ece9b4cd4c7f2f18b860e9d19e09abb5c353e612bfadd7a897a59ac1690a77eb8fb611d286194f471b372df7952a53a
data/lib/utils/image.rb CHANGED
@@ -168,7 +168,7 @@ module Metanorma
168
168
  end
169
169
 
170
170
  def url?(url)
171
- %r{^([A-Z]:)?/}.match?(url)
171
+ %r{^[A-Z]{2,}://}i.match?(url)
172
172
  end
173
173
 
174
174
  def decode_datauri(uri)
data/lib/utils/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Utils
3
- VERSION = "1.4.2".freeze
3
+ VERSION = "1.4.3".freeze
4
4
  end
5
5
  end
data/spec/img_spec.rb CHANGED
@@ -2,6 +2,24 @@ require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
4
  RSpec.describe Metanorma::Utils do
5
+ it "recognises data uris" do
6
+ expect(Metanorma::Utils.datauri?("data:img/gif,base64,ABBC"))
7
+ .to eq true
8
+ expect(Metanorma::Utils.datauri?("data1:img/gif,base64,ABBC"))
9
+ .to eq false
10
+ end
11
+
12
+ it "recognises uris" do
13
+ expect(Metanorma::Utils.url?("mailto://ABC"))
14
+ .to eq true
15
+ expect(Metanorma::Utils.url?("http://ABC"))
16
+ .to eq true
17
+ expect(Metanorma::Utils.url?("D:/ABC"))
18
+ .to eq false
19
+ expect(Metanorma::Utils.url?("/ABC"))
20
+ .to eq false
21
+ end
22
+
5
23
  it "rewrites SVGs" do
6
24
  FileUtils.cp("spec/fixtures/action_schemaexpg1.svg",
7
25
  "action_schemaexpg1.svg")
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.2
4
+ version: 1.4.3
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-07 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor