metanorma-utils 1.0.6 → 1.0.7

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: 1a46112cc35941403c557671059d0f31be446e84cf5a91d6fc9cc3e16e6b5b00
4
- data.tar.gz: 7704505b81224537aabb3679a753a5ee4a5b02832034f7265a467232dbfb26e7
3
+ metadata.gz: 1608e885c3ac31aee00ba254d5f5c84088781a8ce5e8bc34d0a0fa8bf86c879a
4
+ data.tar.gz: 79454a1aae9b7f3511d8c6b593e62faead745ab9b05e2f36f7d06610c991eb33
5
5
  SHA512:
6
- metadata.gz: 7be04b8ee6662d7b82f0c6a5d29026a371607ccc1e5259781a66d6bd10980be3a37eab4f5a5d44aaa6c228f6dcb35b1801842c17362d46b9ab501d3e94888363
7
- data.tar.gz: 912b02b4e6d6b5a2f9b3338b4868f03cfc36c3a96f9d9cb25b7f07a4a02acb5b2d73f857fa19b238a364da8ae1c30d0e37ca609281c69bd14cb9f502b70aa1c5
6
+ metadata.gz: 3f96993c89b0d752fd71f2775d05b012580760165fe55cc50b4b86e621d2c093eed5aa151d87597ce8f745cedb0388cc9370729d0d25f1331aaed439c11b862f
7
+ data.tar.gz: 0e681cd4f98ba4fdebf683cb410bab222668e872460034b4b03182ba953b14b0b39c3b5ef473c12e4d6ac0ac41f092d6e683210099bb0c0aab665fe240d70c97
data/lib/utils/main.rb CHANGED
@@ -175,12 +175,15 @@ module Metanorma
175
175
  result.reject(&:empty?)
176
176
  end
177
177
 
178
- # FIXME: nested uri path error(
179
- # sources/plantuml/plantuml20200524-90467-1iqek5i.png ->
180
- # sources/sources/plantuml/plantuml20200524-90467-1iqek5i.png)
178
+ # sources/plantuml/plantuml20200524-90467-1iqek5i.png already includes localdir
181
179
  def datauri(uri, localdir = ".")
182
180
  return uri if /^data:/.match(uri)
183
- path = %r{^([A-Z]:)?/}.match?(uri) ? uri : File.join(localdir, uri)
181
+ path = %r{^([A-Z]:)?/}.match?(uri) ? uri :
182
+ File.exist?(uri) ? uri : File.join(localdir, uri)
183
+ unless File.exist?(path)
184
+ warn "image at #{path} not found"
185
+ return uri
186
+ end
184
187
  types = MIME::Types.type_for(path)
185
188
  type = types ? types.first.to_s : 'text/plain; charset="utf-8"'
186
189
  bin = File.open(path, 'rb', &:read)
data/lib/utils/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Utils
3
- VERSION = "1.0.6".freeze
3
+ VERSION = "1.0.7".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.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sterile