metanorma 1.7.1 → 1.7.3

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: 938d6b4607a840c13dd8f5b05450ea4e8efd143688f239f53b16edfbb2bd27fc
4
- data.tar.gz: 79638777304542242c9984cf27d413b5933456ef3929e102d6e5e21608bbe294
3
+ metadata.gz: c5b5382892120774eb414751a3e9e3d196f73263e904566a3e2a30593480dbb1
4
+ data.tar.gz: 5e4fe2bac57854742838bdd57168dec395c5e8fd120f5d5b1b06e98ce2df8ad8
5
5
  SHA512:
6
- metadata.gz: 6e37cd82612055440e758dbdcae0e96271b2adf6ae533e9310e76fe74ea3c31bdc554f23524e8fad5cf2a2e75ac71ee35ee40ef681c00ad7ed4c4aa984b91212
7
- data.tar.gz: 844e4ceed1de6d70d9f23f225b916a0f75c753c9ec94c0d8135792e8ec1659b47a557e868ec3151038b27683c03ba8a6cebaad3f601998f6c7d2269e7e9cc222
6
+ metadata.gz: 31eca9aa8f63edb4be1feea653d288ac41c57c805253bc08af0d2b8686a5a85be136e29dbc4aeed179d89dd2c28714752713f6ed7c7b8e28478692e15c1f90bf
7
+ data.tar.gz: 2e84726aed63b99235576ea12ac5ba41cb05e943b0d70d5ebfec027529184e579b39f538bed63f058f83cdc6dda6a7dcb197d2f16b222d0e36825e71a1884797
@@ -52,7 +52,7 @@ module Metanorma
52
52
  # rubocop:enable Metrics/AbcSize,Metrics/MethodLength
53
53
  def clean_exit
54
54
  @log.write(File.join(File.dirname(@file),
55
- "#{File.basename(@file, '.*')}.err"))
55
+ "#{File.basename(@file, '.*')}.err.html"))
56
56
  end
57
57
 
58
58
  # @return [String] XML
@@ -22,18 +22,31 @@ module Metanorma
22
22
  @errors = []
23
23
  @isodoc = IsoDoc::Convert.new({})
24
24
  @fontist_installed = false
25
+ @log = Metanorma::Utils::Log.new
25
26
  end
26
27
 
27
28
  def compile(filename, options = {})
28
- require_libraries(options)
29
- options = options_extract(filename, options)
30
- validate_options(options)
29
+ options_process(filename, options)
31
30
  @processor = @registry.find_processor(options[:type].to_sym)
32
31
  extensions = get_extensions(options) or return nil
33
32
  (file, isodoc = process_input(filename, options)) or return nil
34
33
  relaton_export(isodoc, options)
35
34
  extract(isodoc, options[:extract], options[:extract_type])
36
35
  process_exts(filename, extensions, file, isodoc, options)
36
+ clean_exit(options)
37
+ end
38
+
39
+ def options_process(filename, options)
40
+ require_libraries(options)
41
+ options = options_extract(filename, options)
42
+ validate_options(options)
43
+ @log.save_to(filename, options[:output_dir])
44
+ options[:log] = @log
45
+ end
46
+
47
+ def clean_exit(options)
48
+ options[:novalid] and return
49
+ @log.write
37
50
  end
38
51
 
39
52
  def process_input(filename, options)
@@ -30,29 +30,27 @@ module Metanorma
30
30
  options[:format] ||= :asciidoc
31
31
  options[:filename] = filename
32
32
  options[:fontlicenseagreement] ||= "no-install-fonts"
33
+ options[:novalid] = o[:novalid] if o[:novalid]
33
34
  options
34
35
  end
35
36
 
36
37
  def get_extensions(options)
37
- options[:extension_keys] ||=
38
- @processor.output_formats.reduce([]) { |memo, (k, _)| memo << k }
39
- extensions = extract_extensions(options)
40
- if !extensions.include?(:presentation) && extensions.any? do |e|
38
+ ext = extract_extensions(options)
39
+ !ext.include?(:presentation) && ext.any? do |e|
41
40
  @processor.use_presentation_xml(e)
42
- end
43
- extensions << :presentation
44
- end
45
- extensions
41
+ end and ext << :presentation
42
+ !ext.include?(:rxl) && options[:site_generate] and
43
+ ext << :rxl
44
+ ext
46
45
  end
47
46
 
48
47
  def extract_extensions(options)
48
+ options[:extension_keys] ||=
49
+ @processor.output_formats.reduce([]) { |memo, (k, _)| memo << k }
49
50
  options[:extension_keys].reduce([]) do |memo, e|
50
51
  if @processor.output_formats[e] then memo << e
51
52
  else
52
- message = "[metanorma] Error: #{e} format is not supported " \
53
- "for this standard."
54
- @errors << message
55
- Util.log(message, :error)
53
+ unsupported_format_error(e)
56
54
  memo
57
55
  end
58
56
  end
@@ -65,6 +63,13 @@ module Metanorma
65
63
 
66
64
  private
67
65
 
66
+ def unsupported_format_error(ext)
67
+ message = "[metanorma] Error: #{ext} format is not supported " \
68
+ "for this standard."
69
+ @errors << message
70
+ Util.log(message, :error)
71
+ end
72
+
68
73
  def get_isodoc_options(file, options, ext)
69
74
  ret = @processor.extract_options(file)
70
75
  copy_isodoc_options_attrs(options, ret)
@@ -5,11 +5,11 @@ module Metanorma
5
5
  class Asciidoc < Base
6
6
  def process(file, filename, type, options = {})
7
7
  require "asciidoctor"
8
- out_opts = {
9
- to_file: false, safe: :safe, backend: type, header_footer: true,
10
- attributes: ["nodoc", "stem", "docfile=#{filename}",
11
- "output_dir=#{options[:output_dir]}"]
12
- }
8
+ out_opts = { to_file: false, safe: :safe, backend: type,
9
+ header_footer: true, log: options[:log],
10
+ novalid: options[:novalid],
11
+ attributes: ["nodoc", "stem", "docfile=#{filename}",
12
+ "output_dir=#{options[:output_dir]}"] }
13
13
  unless asciidoctor_validate(file, filename, out_opts)
14
14
  warn "Cannot continue compiling Asciidoctor document"
15
15
  abort
@@ -24,7 +24,7 @@ module Metanorma
24
24
  $stderr = StringIO.new
25
25
  ::Asciidoctor.load(file, options)
26
26
  %r{(\n|^)asciidoctor: ERROR: ['"]?#{Regexp.escape(filename ||
27
- "<empty>")}['"]?: line \d+: include file not found: }
27
+ '<empty>')}['"]?: line \d+: include file not found: }
28
28
  .match($stderr.string) and err = $stderr.string
29
29
  ensure
30
30
  $stderr = previous_stderr
@@ -39,15 +39,16 @@ module Metanorma
39
39
  /\n:mn-output-extensions:\s+(?<extensions>[^\n]+)\n/ =~ headerextract
40
40
  /\n:mn-relaton-output-file:\s+(?<relaton>[^\n]+)\n/ =~ headerextract
41
41
  /\n(?<asciimath>:mn-keep-asciimath:[^\n]*)\n/ =~ headerextract
42
+ /\n(?<novalid>:novalid:[^\n]*)\n/ =~ headerextract
42
43
  asciimath = if defined?(asciimath)
43
- (!asciimath.nil? && asciimath != ":mn-keep-asciimath: false")
44
+ !asciimath.nil? && asciimath != ":mn-keep-asciimath: false"
44
45
  end
45
46
  asciimath = nil if asciimath == false
46
47
  {
47
48
  type: defined?(type) ? type&.strip : nil,
48
49
  extensions: defined?(extensions) ? extensions&.strip : nil,
49
50
  relaton: defined?(relaton) ? relaton&.strip : nil,
50
- asciimath: asciimath,
51
+ asciimath: asciimath, novalid: !novalid.nil? || nil
51
52
  }.compact
52
53
  end
53
54
 
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.7.1".freeze
2
+ VERSION = "1.7.3".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.7.1
4
+ version: 1.7.3
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-02-19 00:00:00.000000000 Z
11
+ date: 2024-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor