metanorma 1.4.0 → 1.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cebdc5e3a04db33d1bf3c0042d914f03a1e7c36ae67d625138fb1499679abdcf
4
- data.tar.gz: 82f7a4b816cea046181cfd05da94ca21a52f1c12ac02d9f6f2e89ae1b07e6f60
3
+ metadata.gz: 12776f5bd9badbb53a16aadbc821249bb629660d3a5de20a08903bbf246e29b1
4
+ data.tar.gz: 9800801b680cb5d6097f58b22875c4c9e436914837a47ec56dc0765e14508493
5
5
  SHA512:
6
- metadata.gz: cfa8565f3b0a55f12f0d0e8971d82c8bf619390cfc76860514dda7b1801267d7e04719161048ff7d9b16a71e238df2e24e145198229b5b5930233ae9110933ec
7
- data.tar.gz: 81764ee18d5c1b36f3aacf19c0a4cf4b02cd4fb0a8979fe9d0a6733a93f4f05ddc845be35b25ec38be31d595fd04a019ae6aaf6ca33a97664519550e1abe280b
6
+ metadata.gz: 2ed067f52701b80fb2c246fb09b0227dd763a8e3d333bf3a13109bd44536c77f585e46386c52dd61ce206982525843b27f05b13b21585de679b42343a0bfc2d4
7
+ data.tar.gz: d5adad943950f178745b0288a0f11baf730b3fc84a281f30b3bba082a9d9e58135dc7f29d4ea2d31d912df100b261e8cabea33a0d8732b6dca7f747de5c88e53
@@ -164,10 +164,15 @@ module Metanorma
164
164
  def file_compile(file, filename, identifier)
165
165
  return if @files[identifier][:sectionsplit] == "true"
166
166
 
167
- @compile.compile file.path, { format: :asciidoc, extension_keys: @format }
168
- .merge(compile_options(identifier))
167
+ opts = {
168
+ format: :asciidoc,
169
+ extension_keys: @format,
170
+ output_dir: @outdir,
171
+ }.merge(compile_options(identifier))
172
+
173
+ @compile.compile file, opts
169
174
  @files[identifier][:outputs] = {}
170
- file_compile_formats(file, filename, identifier)
175
+ file_compile_formats(filename, identifier)
171
176
  end
172
177
 
173
178
  def compile_options(identifier)
@@ -182,29 +187,17 @@ module Metanorma
182
187
  ret
183
188
  end
184
189
 
185
- def file_compile_formats(file, filename, identifier)
190
+ def file_compile_formats(filename, identifier)
191
+ file_id = @files[identifier]
186
192
  @format.each do |e|
187
193
  ext = @compile.processor.output_formats[e]
188
194
  fn = File.basename(filename).sub(/(?<=\.)[^.]+$/, ext.to_s)
189
- if /html$/.match?(ext) && @files[identifier][:sectionsplit]
190
- # file_sectionsplit_copy(file, fn, identifier, ext, e)
191
- else
192
- FileUtils.cp file.path.sub(/\.xml$/, ".#{ext}"),
193
- File.join(@outdir, fn)
194
- @files[identifier][:outputs][e] = File.join(@outdir, fn)
195
+ unless /html$/.match?(ext) && file_id[:sectionsplit]
196
+ file_id[:outputs][e] = File.join(@outdir, fn)
195
197
  end
196
198
  end
197
199
  end
198
200
 
199
- def file_sectionsplit_copy(file, base, identifier, ext, format)
200
- dir = file.path.sub(/\.xml$/, ".#{ext}_collection")
201
- files = Dir.glob("#{dir}/*.#{ext}")
202
- FileUtils.cp files, @outdir
203
- cover = File.join(@outdir, base.sub(/\.html$/, ".index.html"))
204
- FileUtils.cp File.join(dir, "index.html"), cover
205
- @files[identifier][:outputs][format] = cover
206
- end
207
-
208
201
  def copy_file_to_dest(fileref)
209
202
  dest = File.join(@outdir, fileref[:out_path])
210
203
  FileUtils.mkdir_p(File.dirname(dest))
@@ -223,12 +216,13 @@ module Metanorma
223
216
  else
224
217
  file, filename = targetfile(x, read: true)
225
218
  warn "\n\n\n\n\nProcess #{filename}: #{DateTime.now.strftime('%H:%M:%S')}"
226
- file = update_xrefs(file, identifier, internal_refs)
227
- Tempfile.open(["collection", ".xml"], encoding: "utf-8") do |f|
228
- f.write(file)
229
- f.close
230
- file_compile(f, filename, identifier)
231
- end
219
+ collection_xml = update_xrefs(file, identifier, internal_refs)
220
+ collection_filename = File.basename(filename, File.extname(filename))
221
+ collection_xml_path = File.join(Dir.tmpdir,
222
+ "#{collection_filename}.xml")
223
+ File.write collection_xml_path, collection_xml, encoding: "UTF-8"
224
+ file_compile(collection_xml_path, filename, identifier)
225
+ FileUtils.rm(collection_xml_path)
232
226
  end
233
227
  end
234
228
  end
@@ -32,7 +32,7 @@ module Metanorma
32
32
  extract(isodoc, options[:extract], options[:extract_type])
33
33
  FontistUtils.install_fonts(@processor, options) unless @fontist_installed
34
34
  @fontist_installed = true
35
- process_extensions(extensions, file, isodoc, options)
35
+ process_extensions(filename, extensions, file, isodoc, options)
36
36
  end
37
37
 
38
38
  def require_libraries(options)
@@ -199,7 +199,7 @@ module Metanorma
199
199
  end
200
200
 
201
201
  # isodoc is Raw Metanorma XML
202
- def process_extensions(extensions, file, isodoc, options)
202
+ def process_extensions(filename, extensions, file, isodoc, options)
203
203
  f = change_output_dir options
204
204
  xml_name = f.sub(/\.[^.]+$/, ".xml")
205
205
  presentationxml_name = f.sub(/\.[^.]+$/, ".presentation.xml")
@@ -210,7 +210,7 @@ module Metanorma
210
210
  if ext == :rxl
211
211
  relaton_export(isodoc, options.merge(relaton: outfilename))
212
212
  elsif options[:passthrough_presentation_xml] && ext == :presentation
213
- FileUtils.cp f, presentationxml_name
213
+ FileUtils.cp filename, presentationxml_name
214
214
  elsif ext == :html && options[:sectionsplit]
215
215
  sectionsplit_convert(xml_name, isodoc, outfilename, isodoc_options)
216
216
  else
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.4.0".freeze
2
+ VERSION = "1.4.1".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.4.0
4
+ version: 1.4.1
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-10-25 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor