metanorma-standoc 2.9.1 → 2.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08c688771192b46a0cabe0ec82dc8b88902a49577b4af1fafb8c3efc00192a6d'
4
- data.tar.gz: 27b915f4d6ba5ebe4c8a16cf1c02a26f9cf37af524d6d3bdbc145ce360280df7
3
+ metadata.gz: afbcf21ea1b8e99868178616c755a4dcef811f631326c65f6835ad491d1f2835
4
+ data.tar.gz: 9d3499adf6025521d2683f4456e64b1cd27dd63722c231de8fab7aa47fe79973
5
5
  SHA512:
6
- metadata.gz: e0717e6c250f4ae7b649ce1943abf0665dad4abdf1b9b20021681e64a141967c34d53a3ed4de04b8112a4cc8ea8df79f4afd46ea96aa28622d2b6d0314f349a0
7
- data.tar.gz: 41d8468137fd2b538597dd8379b1364f189c0d500cba23b691513754a84eb3423aa8eb46794258cdad7e21c799f518b305f46240817d4858dcb24d8848050a80
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]").reverse.each do |n|
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
- ret = File.join(@attachmentsdir, f)
155
- FileUtils.cp(path, ret)
156
- datauri_attachment(ret, bib.document)
157
- ret
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
- n = add_misc_container(doc)
163
+ m = add_misc_container(doc)
163
164
  f = File.basename(path)
164
- d = Vectory::Utils.datauri(path)
165
- n << "<attachment name='#{f}'>#{d}</attachment>"
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
- @log.add("Bibliography", bib, "Attachment #{path} does not exist",
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
- @attachmentsdir = File.join(@output_dir, "_#{@filename}_attachments")
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.reverse.each do |b|
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 presentation-metadata semantic-metadata).freeze
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: 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']").reverse.each do |p|
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").reverse.each do |p|
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").reverse.each do |p|
90
+ add.xpath("./uri").reverse_each do |p|
91
91
  ins.next = p
92
92
  end
93
93
  end
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.9.1".freeze
22
+ VERSION = "2.9.2".freeze
23
23
  end
24
24
  end
@@ -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.1
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-07-22 00:00:00.000000000 Z
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