metanorma-utils 1.7.4 → 1.7.5
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 +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: 9ecb0b154a431e671be11e34203984515b6638ac06dc0855840ee8266f20228a
|
4
|
+
data.tar.gz: 7989d425b7275e4c314bbf22d49b68e709ed197735029dde9c88edf87f0ebd43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb4f60d626491b4df43ec3bdea3a02e6ad3c53ce3a4b23298ada95230b77f65c9ce03c3e599292b153e4cbe0e187546a52b4bed46d2fe26e895919932d7f3dd
|
7
|
+
data.tar.gz: d8457936acff8e32052ed0e5959a65757f48d8164f11a74d4c8cb20725d3165a3d7cdab8d330e6678b4869ec46504e61df4c620116b0d1fe6e19c65666e08dae
|
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
|
+
filename.sub!(/\.err\.html$/, ".html")
|
17
|
+
b = File.join(dir, File.basename(filename, ".*"))
|
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.5
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|