metanorma-standoc 2.9.1 → 2.9.2
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/metanorma/standoc/cleanup_bibitem.rb +14 -10
- data/lib/metanorma/standoc/cleanup_ref.rb +1 -1
- data/lib/metanorma/standoc/cleanup_text.rb +1 -1
- data/lib/metanorma/standoc/ref_queue.rb +4 -4
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afbcf21ea1b8e99868178616c755a4dcef811f631326c65f6835ad491d1f2835
|
4
|
+
data.tar.gz: 9d3499adf6025521d2683f4456e64b1cd27dd63722c231de8fab7aa47fe79973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46a8beb31cb6230dccdcdb36352dd05e705a3114d0b1b6e04b46b1a445aa1fe30249426c81be8a441f615c95fe633cc078bd70c030616cdc25ff4c50eb45ab76
|
7
|
+
data.tar.gz: 300aeca29fa514e88535c4f60577f9a6e83446f195b76e7e15029ae912d0beb06c0f6f028b098e4662ab53fbf83fc8e675a920ef7c3269f1e501afa835ba127f
|
@@ -36,7 +36,7 @@ module Metanorma
|
|
36
36
|
|
37
37
|
def extract_notes_from_biblio(refs)
|
38
38
|
refs.xpath("./bibitem").each do |r|
|
39
|
-
r.xpath("./note[@appended]").
|
39
|
+
r.xpath("./note[@appended]").reverse_each do |n|
|
40
40
|
n.delete("appended")
|
41
41
|
r.next = n
|
42
42
|
end
|
@@ -147,34 +147,38 @@ module Metanorma
|
|
147
147
|
|
148
148
|
def save_attachment(path, bib)
|
149
149
|
init_attachments
|
150
|
+
path = File.join(@localdir, path)
|
150
151
|
valid_attachment?(path, bib) or return ""
|
151
152
|
f = File.basename(path)
|
152
153
|
File.exist?(File.join(@attachmentsdir, f)) and
|
153
154
|
f += "_#{UUIDTools::UUID.random_create}"
|
154
|
-
|
155
|
-
FileUtils.cp(path,
|
156
|
-
datauri_attachment(
|
157
|
-
|
155
|
+
out_fld = File.join(@attachmentsdir, f)
|
156
|
+
FileUtils.cp(path, out_fld)
|
157
|
+
datauri_attachment(out_fld, bib.document)
|
158
|
+
File.join(@attachmentsfld, f)
|
158
159
|
end
|
159
160
|
|
160
161
|
def datauri_attachment(path, doc)
|
161
162
|
@datauriattachment or return
|
162
|
-
|
163
|
+
m = add_misc_container(doc)
|
163
164
|
f = File.basename(path)
|
164
|
-
d = Vectory::Utils
|
165
|
-
|
165
|
+
d = Vectory::Utils::datauri(path, @localdir)
|
166
|
+
m << "<attachment name='#{f}'/>"
|
167
|
+
m.last_element_child << d
|
166
168
|
end
|
167
169
|
|
168
170
|
def valid_attachment?(path, bib)
|
169
171
|
File.exist?(path) and return true
|
170
|
-
|
172
|
+
p = Pathname.new(path).cleanpath
|
173
|
+
@log.add("Bibliography", bib, "Attachment #{p} does not exist",
|
171
174
|
severity: 0)
|
172
175
|
false
|
173
176
|
end
|
174
177
|
|
175
178
|
def init_attachments
|
176
179
|
@attachmentsdir and return
|
177
|
-
@
|
180
|
+
@attachmentsfld = "_#{@filename}_attachments"
|
181
|
+
@attachmentsdir = File.join(@output_dir, @attachmentsfld)
|
178
182
|
FileUtils.rm_rf(@attachmentsdir)
|
179
183
|
FileUtils.mkdir_p(@attachmentsdir)
|
180
184
|
end
|
@@ -17,7 +17,7 @@ module Metanorma
|
|
17
17
|
bib = sort_biblio(refs.xpath("./bibitem"))
|
18
18
|
insert = refs.at("./bibitem")&.previous_element
|
19
19
|
refs.xpath("./bibitem").each(&:remove)
|
20
|
-
bib.
|
20
|
+
bib.reverse_each do |b|
|
21
21
|
(insert and insert.next = b.to_xml) or
|
22
22
|
refs.children.first.add_previous_sibling b.to_xml
|
23
23
|
end
|
@@ -35,7 +35,7 @@ module Metanorma
|
|
35
35
|
|
36
36
|
IGNORE_QUOTES_ELEMENTS =
|
37
37
|
%w(pre tt sourcecode stem asciimath figure bibdata passthrough
|
38
|
-
identifier
|
38
|
+
identifier metanorma-extension).freeze
|
39
39
|
|
40
40
|
def uninterrupt_quotes_around_xml_skip(elem)
|
41
41
|
!(/\A['"]/.match?(elem.text) &&
|
@@ -40,7 +40,7 @@ module Metanorma
|
|
40
40
|
def reference_queue(results, size)
|
41
41
|
(1..size).each.with_object([]) do |_, m|
|
42
42
|
ref, i, doc = results.pop
|
43
|
-
m[i.to_i] = { ref:
|
43
|
+
m[i.to_i] = { ref: }
|
44
44
|
if doc.is_a?(RelatonBib::RequestError)
|
45
45
|
@log.add("Bibliography", nil, "Could not retrieve #{ref[:code]}: " \
|
46
46
|
"no access to online site", severity: 1)
|
@@ -69,7 +69,7 @@ module Metanorma
|
|
69
69
|
|
70
70
|
def merge_publishers(base, add)
|
71
71
|
ins = base.at("//contributor[last()]") || base.children[-1]
|
72
|
-
add.xpath("//contributor[role/@type = 'publisher']").
|
72
|
+
add.xpath("//contributor[role/@type = 'publisher']").reverse_each do |p|
|
73
73
|
ins.next = p
|
74
74
|
end
|
75
75
|
end
|
@@ -80,14 +80,14 @@ module Metanorma
|
|
80
80
|
v.at("//docidentifier[@primary = 'true']") or
|
81
81
|
v.at("//docidentifier")["primary"] = true
|
82
82
|
end
|
83
|
-
add.xpath("//docidentifier").
|
83
|
+
add.xpath("//docidentifier").reverse_each do |p|
|
84
84
|
ins.next = p
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
88
|
def merge_urls(base, add)
|
89
89
|
ins = base.at("./uri[last()]") || base.at("./title[last()]")
|
90
|
-
add.xpath("./uri").
|
90
|
+
add.xpath("./uri").reverse_each do |p|
|
91
91
|
ins.next = p
|
92
92
|
end
|
93
93
|
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -59,5 +59,6 @@ Gem::Specification.new do |spec|
|
|
59
59
|
spec.add_development_dependency "timecop", "~> 0.9"
|
60
60
|
spec.add_development_dependency "vcr", "~> 6.1.0"
|
61
61
|
spec.add_development_dependency "webmock"
|
62
|
+
spec.add_development_dependency "xml-c14n"
|
62
63
|
# spec.metadata["rubygems_mfa_required"] = "true"
|
63
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-standoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.2
|
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-
|
11
|
+
date: 2024-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -416,6 +416,20 @@ dependencies:
|
|
416
416
|
- - ">="
|
417
417
|
- !ruby/object:Gem::Version
|
418
418
|
version: '0'
|
419
|
+
- !ruby/object:Gem::Dependency
|
420
|
+
name: xml-c14n
|
421
|
+
requirement: !ruby/object:Gem::Requirement
|
422
|
+
requirements:
|
423
|
+
- - ">="
|
424
|
+
- !ruby/object:Gem::Version
|
425
|
+
version: '0'
|
426
|
+
type: :development
|
427
|
+
prerelease: false
|
428
|
+
version_requirements: !ruby/object:Gem::Requirement
|
429
|
+
requirements:
|
430
|
+
- - ">="
|
431
|
+
- !ruby/object:Gem::Version
|
432
|
+
version: '0'
|
419
433
|
description: |
|
420
434
|
metanorma-standoc realises standards following the Metanorma standoc model
|
421
435
|
|