metanorma 1.3.11 → 1.3.12

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: f054752f3bb51d3e1cfe983beaca06c817275d214d5652503a42325d93403a42
4
- data.tar.gz: 212a35305289d4286539dcdb008bf799fac028e87a84aab0a33b8137c73d84d5
3
+ metadata.gz: 6e0318ba6a8281b9d412916b46fa57cc2de00a2738dd7703425c3f3736d92ae8
4
+ data.tar.gz: 03d43c3e079517e202ba7e6d48f67ba792741db08ad026392169d19ffdc5a5d5
5
5
  SHA512:
6
- metadata.gz: c23014599c6a03a04b0dfa4fe93c6b300b0311ff55e552a5f1bd79a2d55220789c94916a9c6b694a044cd9247dcd95d1ab6dde05e0e7d949a29bcaedb07d8807
7
- data.tar.gz: 98da695a8d3cd9b93f244161b8e0874b7851bb6426fd686cabcafe493f8088b0af2923a216b2741d34a2532b8f76adc3ac377af1caa8a639fdd27ba4c1866ef7
6
+ metadata.gz: 3cc705935cee37831ad02b8ca85f556f9d2ec8cec8c341a045f34d96621b20e79455533a22262004b363d6f10a1523505cea14bc489fa1d47d9406870e1acc7f
7
+ data.tar.gz: a9d55375a16afb0ed0ee9e392dc2cc134f9a0e424fbadbb8f7b9f5fe940d944867c9d5e32e39f79fcf6d594381a7f2c90a9d70502b5108668c181e628e32f83e
@@ -44,7 +44,7 @@ module Metanorma
44
44
  newbib = dup_bibitem(docid, bib)
45
45
  bib.replace(newbib)
46
46
  _file, url = targetfile(@files[docid], relative: true, read: false,
47
- doc: !@files[docid][:attachment])
47
+ doc: !@files[docid][:attachment])
48
48
  uri_node = Nokogiri::XML::Node.new "uri", newbib
49
49
  uri_node[:type] = "citation"
50
50
  uri_node.content = url
@@ -53,7 +53,7 @@ module Metanorma
53
53
 
54
54
  def fail_update_bibitem(docid, identifier)
55
55
  error = "[metanorma] Cannot find crossreference to document #{docid} "\
56
- "in document #{identifier}."
56
+ "in document #{identifier}."
57
57
  @log.add("Cross-References", nil, error)
58
58
  Util.log(error, :warning)
59
59
  end
@@ -78,6 +78,7 @@ module Metanorma
78
78
  # @return [String] XML content
79
79
  def update_xrefs(file, identifier, internal_refs)
80
80
  docxml = Nokogiri::XML(file) { |config| config.huge }
81
+ supply_repo_ids(docxml)
81
82
  update_indirect_refs_to_docs(docxml, internal_refs)
82
83
  add_document_suffix(identifier, docxml)
83
84
  update_direct_refs_to_docs(docxml, identifier)
@@ -89,6 +90,18 @@ module Metanorma
89
90
  docxml.to_xml
90
91
  end
91
92
 
93
+ def supply_repo_ids(docxml)
94
+ docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |b|
95
+ next if b&.at(ns("./docidentifier[@type = 'repository']"))
96
+
97
+ b.xpath(ns("./docidentifier")).each do |d|
98
+ next unless @files[d.text]
99
+
100
+ d.next = "<docidentifier type='repository'>current-metanorma-collection/#{d.text}"
101
+ end
102
+ end
103
+ end
104
+
92
105
  def datauri_encode(docxml)
93
106
  docxml.xpath(ns("//image")).each do |i|
94
107
  i["src"] = Metanorma::Utils::datauri(i["src"])
@@ -161,7 +174,7 @@ module Metanorma
161
174
  if @files[docid] then update_anchor_loc(bib, e, docid)
162
175
  else
163
176
  e << "<strong>** Unresolved reference to document #{docid} "\
164
- "from eref</strong>"
177
+ "from eref</strong>"
165
178
  end
166
179
  end
167
180
  end
@@ -188,7 +201,7 @@ module Metanorma
188
201
  ref = ins&.at(ns("./locality/referenceFrom"))&.text
189
202
  anchor = @files[docid][:anchors].dig(type, ref) or return
190
203
  ins << "<locality type='anchor'><referenceFrom>#{anchor.sub(/^_/, '')}"\
191
- "</referenceFrom></locality>"
204
+ "</referenceFrom></locality>"
192
205
  end
193
206
 
194
207
  # gather internal bibitem references
@@ -214,6 +214,10 @@ module Metanorma
214
214
  elsif ext == :html && options[:sectionsplit]
215
215
  sectionsplit_convert(xml_name, isodoc, outfilename, isodoc_options)
216
216
  else
217
+ if ext == :pdf
218
+ floc = FontistUtils.fontist_font_locations(@processor, options)
219
+ isodoc_options[:mn2pdf] = { font_manifest_file: floc.path } if floc
220
+ end
217
221
  begin
218
222
  if @processor.use_presentation_xml(ext)
219
223
  @processor.output(nil, presentationxml_name, outfilename, ext,
@@ -245,13 +249,10 @@ module Metanorma
245
249
  isodoc_options = @processor.extract_options(file)
246
250
  isodoc_options[:datauriimage] = true if options[:datauriimage]
247
251
  isodoc_options[:sourcefilename] = options[:filename]
248
- %i(bare sectionsplit no_install_fonts baseassetpath).each do |x|
252
+ %i(bare sectionsplit no_install_fonts baseassetpath aligncrosselements)
253
+ .each do |x|
249
254
  isodoc_options[x] ||= options[x]
250
255
  end
251
- if ext == :pdf
252
- floc = FontistUtils.fontist_font_locations(@processor, options) and
253
- isodoc_options[:mn2pdf] = { font_manifest_file: floc.path }
254
- end
255
256
  isodoc_options
256
257
  end
257
258
 
@@ -49,7 +49,7 @@ module Metanorma
49
49
  extensions: defined?(extensions) ? extensions : nil,
50
50
  relaton: defined?(relaton) ? relaton : nil,
51
51
  asciimath: asciimath,
52
- }.reject { |_, val| val.nil? }
52
+ }.compact
53
53
  end
54
54
 
55
55
  def empty_attr(attr, name)
@@ -62,7 +62,7 @@ module Metanorma
62
62
  ulstyle olstyle htmlstylesheet-override bare
63
63
  htmltoclevels doctoclevels sectionsplit base-asset-path
64
64
  body-font header-font monospace-font title-font
65
- wordstylesheet-override).freeze
65
+ align-cross-elements wordstylesheet-override).freeze
66
66
 
67
67
  def extract_options(file)
68
68
  header = file.sub(/\n\n.*$/m, "\n")
@@ -89,7 +89,7 @@ module Metanorma
89
89
  hierarchical_assets: defined?(hier_assets) ? hier_assets : nil,
90
90
  use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
91
91
  break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
92
- ).reject { |_, val| val.nil? }
92
+ ).compact
93
93
  end
94
94
  end
95
95
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.3.11".freeze
2
+ VERSION = "1.3.12".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.11
4
+ version: 1.3.12
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-27 00:00:00.000000000 Z
11
+ date: 2021-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor