metanorma-utils 1.7.4 → 1.7.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/log.rb +21 -9
- data/lib/utils/version.rb +1 -1
- 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: 763172a604af9c8aa2041735e905ba799c1dc2c1d30884d729a745466ee2bd04
|
4
|
+
data.tar.gz: 350815e7f0ed225a291411b467fe234c269ad037fa7d7b5b78db3768115d7029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 844194eb8dcf4e1c95b2911ee2b20a6637bb098c713f46f9e16ca1bad369a70795e8edfc139df9dadbf38127e8685e86e6f23d485781b495de4b822cbb460bfa
|
7
|
+
data.tar.gz: 4b1ec3c894633fa98d31c53b38f3c4d7b0632bf1e3178e427b5f2eb65cb3d6415a76140a05ee1e21185dd0384919a349aed520fb8f56f59d205115e69186c1ea
|
data/lib/utils/log.rb
CHANGED
@@ -11,6 +11,14 @@ module Metanorma
|
|
11
11
|
@mapid = {}
|
12
12
|
end
|
13
13
|
|
14
|
+
def save_to(filename, dir = nil)
|
15
|
+
dir ||= File.dirname(filename)
|
16
|
+
new_fn = filename.sub(/\.err\.html$/, ".html")
|
17
|
+
b = File.join(dir, File.basename(new_fn, ".*"))
|
18
|
+
@filename = "#{b}.err.html"
|
19
|
+
@htmlfilename = "#{b}.html"
|
20
|
+
end
|
21
|
+
|
14
22
|
# severity: 0: abort; 1: serious; 2: not serious; 3: info only
|
15
23
|
def add(category, loc, msg, severity: 2)
|
16
24
|
@novalid and return
|
@@ -121,10 +129,10 @@ module Metanorma
|
|
121
129
|
HTML
|
122
130
|
end
|
123
131
|
|
124
|
-
def write(file)
|
125
|
-
@filename
|
126
|
-
File.open(
|
127
|
-
f.puts log_hdr(
|
132
|
+
def write(file = nil)
|
133
|
+
(!file && @filename) or save_to(file || "metanorma", nil)
|
134
|
+
File.open(@filename, "w:UTF-8") do |f|
|
135
|
+
f.puts log_hdr(@filename)
|
128
136
|
@log.each_key { |key| write_key(f, key) }
|
129
137
|
f.puts "</body></html>\n"
|
130
138
|
end
|
@@ -167,16 +175,20 @@ module Metanorma
|
|
167
175
|
def loc_link(entry)
|
168
176
|
loc = entry[:location]
|
169
177
|
loc.nil? || loc.empty? and loc = "--"
|
170
|
-
|
171
|
-
loc.sub!(/^ID /, "")
|
172
|
-
loc = @mapid[loc] while @mapid[loc]
|
173
|
-
url = "#{@filename}##{loc}"
|
174
|
-
end
|
178
|
+
loc, url = loc_to_url(loc)
|
175
179
|
loc &&= break_up_long_str(loc, 10, 2)
|
176
180
|
url and loc = "<a href='#{url}'>#{loc}</a>"
|
177
181
|
loc
|
178
182
|
end
|
179
183
|
|
184
|
+
def loc_to_url(loc)
|
185
|
+
/^ID /.match?(loc) or return [loc, nil]
|
186
|
+
loc.sub!(/^ID /, "")
|
187
|
+
loc = @mapid[loc] while @mapid[loc]
|
188
|
+
url = "#{@htmlfilename}##{loc}"
|
189
|
+
[loc, url]
|
190
|
+
end
|
191
|
+
|
180
192
|
def break_up_long_str(str, threshold, punct)
|
181
193
|
Metanorma::Utils.break_up_long_str(str, threshold, punct)
|
182
194
|
end
|
data/lib/utils/version.rb
CHANGED
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.7.
|
4
|
+
version: 1.7.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: 2024-03-
|
11
|
+
date: 2024-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|