metanorma-utils 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b68c06e9727423ecdc3e2cbc7dfa9ca5bfd4b6c464a3cb9c6ae4ebbca7310b5
4
- data.tar.gz: 51df585a77e8b774c2d1e18a3450460f1be148ff8e72ecb4f75a8c475b552ef9
3
+ metadata.gz: a30a7e21f3ab7141f041bb44033a0524f059783e58a59ed52d967d3fff7afbb4
4
+ data.tar.gz: e16183e549cb876c845c91b05c26862e6a02c3ab856bef6009aa1215830d997b
5
5
  SHA512:
6
- metadata.gz: 27586706279b7a43322e5f0cfd3207854413451816cbaff2b4a4d349e764a7b2ed4bb6543d48d0df229cba27211e6fc0d76b9214b38bd9cd8f920c1386f5a25a
7
- data.tar.gz: 8345e470781dc4d4e1ecb0b02473852ac2bd9a67a4e45f44cb7a9731d082e64ac2d2729ebd33748dee5e7a4af7a18c72fa9014cef11d8e610d36bf0afa3aa7fc
6
+ metadata.gz: '0339ae03479662e9614f7dc81d05dc5ed6190305e5874bcdde14fad2022248808488960217ecd16c49ad7a538fde46aaf87297dde6d81b3775be37891c738246'
7
+ data.tar.gz: 88c72c000dbef43b82d021b3c58157a13877cefcde662abed8a3a7967683654eae621dbf3c9eee3867ea8aed061252f2562f074168d721f7bd6f7b2b638458dc
data/lib/utils/image.rb CHANGED
@@ -23,7 +23,7 @@ module Metanorma
23
23
  end
24
24
 
25
25
  def save_dataimage(uri)
26
- %r{^data:(image|application)/(?<imgtype>[^;]+);base64,(?<imgdata>.+)$} =~ uri
26
+ %r{^data:(image|application)/(?<imgtype>[^;]+);(charset=[^;]+;)?base64,(?<imgdata>.+)$} =~ uri
27
27
  imgtype.sub!(/\+[a-z0-9]+$/, "") # svg+xml
28
28
  imgtype = "png" unless /^[a-z0-9]+$/.match? imgtype
29
29
  Tempfile.open(["image", ".#{imgtype}"]) do |f|
data/lib/utils/main.rb CHANGED
@@ -107,6 +107,17 @@ module Metanorma
107
107
  end.join(" ")
108
108
  end
109
109
 
110
+ def external_path(path)
111
+ win = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) ||
112
+ (RUBY_PLATFORM =~ /mswin|mingw/))
113
+ if win
114
+ path.gsub!(%{/}, "\\")
115
+ path[/\s/] ? "\"#{path}\"" : path
116
+ else
117
+ path
118
+ end
119
+ end
120
+
110
121
  # not currently used
111
122
  def flatten_rawtext_lines(node, result)
112
123
  node.lines.each do |x|
data/lib/utils/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Utils
3
- VERSION = "1.2.5".freeze
3
+ VERSION = "1.2.6".freeze
4
4
  end
5
5
  end
data/spec/utils_spec.rb CHANGED
@@ -11,6 +11,15 @@ RSpec.describe Metanorma::Utils do
11
11
  expect(Metanorma::Utils.strict_capitalize_first("aBC def gHI")).to eq "ABC def gHI"
12
12
  end
13
13
 
14
+ it "converts OS-specific external path" do
15
+ pwd = if !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) ||
16
+ (RUBY_PLATFORM =~ /mswin|mingw/))
17
+ `echo %cd%`
18
+ else `pwd`
19
+ end
20
+ expect(Metanorma::Utils.external_path(FileUtils.pwd.strip)).to eq pwd.strip
21
+ end
22
+
14
23
  it "normalises anchors" do
15
24
  expect(Metanorma::Utils.to_ncname("/:ab")).to eq "__ab"
16
25
  expect(Metanorma::Utils.to_ncname("Löwe")).to eq "L__xf6_we"
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.2.5
4
+ version: 1.2.6
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-09-07 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor