metanorma-utils 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/utils/image.rb +1 -1
- data/lib/utils/main.rb +11 -0
- data/lib/utils/version.rb +1 -1
- data/spec/utils_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a30a7e21f3ab7141f041bb44033a0524f059783e58a59ed52d967d3fff7afbb4
|
4
|
+
data.tar.gz: e16183e549cb876c845c91b05c26862e6a02c3ab856bef6009aa1215830d997b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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-
|
11
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|