metanorma 1.3.12 → 1.4.0

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: 6e0318ba6a8281b9d412916b46fa57cc2de00a2738dd7703425c3f3736d92ae8
4
- data.tar.gz: 03d43c3e079517e202ba7e6d48f67ba792741db08ad026392169d19ffdc5a5d5
3
+ metadata.gz: cebdc5e3a04db33d1bf3c0042d914f03a1e7c36ae67d625138fb1499679abdcf
4
+ data.tar.gz: 82f7a4b816cea046181cfd05da94ca21a52f1c12ac02d9f6f2e89ae1b07e6f60
5
5
  SHA512:
6
- metadata.gz: 3cc705935cee37831ad02b8ca85f556f9d2ec8cec8c341a045f34d96621b20e79455533a22262004b363d6f10a1523505cea14bc489fa1d47d9406870e1acc7f
7
- data.tar.gz: a9d55375a16afb0ed0ee9e392dc2cc134f9a0e424fbadbb8f7b9f5fe940d944867c9d5e32e39f79fcf6d594381a7f2c90a9d70502b5108668c181e628e32f83e
6
+ metadata.gz: cfa8565f3b0a55f12f0d0e8971d82c8bf619390cfc76860514dda7b1801267d7e04719161048ff7d9b16a71e238df2e24e145198229b5b5930233ae9110933ec
7
+ data.tar.gz: 81764ee18d5c1b36f3aacf19c0a4cf4b02cd4fb0a8979fe9d0a6733a93f4f05ddc845be35b25ec38be31d595fd04a019ae6aaf6ca33a97664519550e1abe280b
@@ -104,13 +104,15 @@ module Metanorma
104
104
 
105
105
  class PdfOptionsNode
106
106
  def initialize(doctype, options)
107
- doc_proc = Metanorma::Registry.instance.find_processor(doctype)
108
- @font_locations = FontistUtils.fontist_font_locations(doc_proc, options)
107
+ docproc = Metanorma::Registry.instance.find_processor(doctype)
108
+ if FontistUtils.has_fonts_manifest?(docproc, options)
109
+ @fonts_manifest = FontistUtils.location_manifest(docproc)
110
+ end
109
111
  end
110
112
 
111
113
  def attr(key)
112
- if key == "mn2pdf-font-manifest-file" && @font_locations
113
- @font_locations.path
114
+ if key == "fonts-manifest" && @font_locations
115
+ @fonts_manifest
114
116
  end
115
117
  end
116
118
  end
@@ -214,9 +214,11 @@ 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
217
+ if ext == :pdf && FontistUtils.has_fonts_manifest?(@processor,
218
+ options)
219
+ isodoc_options[:mn2pdf] = {
220
+ font_manifest: FontistUtils.location_manifest(@processor),
221
+ }
220
222
  end
221
223
  begin
222
224
  if @processor.use_presentation_xml(ext)
@@ -16,9 +16,9 @@ module Metanorma
16
16
  Util.log("[fontist] Skip font installation because" \
17
17
  " --no-install-fonts argument passed", :debug)
18
18
  return false
19
- elsif missing_fontist_manifest?(processor)
19
+ elsif !has_fonts_manifest?(processor)
20
20
  Util.log("[fontist] Skip font installation because "\
21
- "font_manifest is missing", :debug)
21
+ "fonts_manifest is missing", :debug)
22
22
  return false
23
23
  end
24
24
  true
@@ -27,26 +27,42 @@ module Metanorma
27
27
  def install_fonts_safe(manifest, agree, continue, no_progress)
28
28
  fontist_install(manifest, agree, no_progress)
29
29
  rescue Fontist::Errors::LicensingError
30
+ license_error_log(continue)
31
+ rescue Fontist::Errors::FontError => e
32
+ log_level = continue ? :warning : :fatal
33
+ Util.log("[fontist] '#{e.font}' font is not supported. " \
34
+ "Please report this issue at github.com/metanorma/metanorma" \
35
+ "/issues to report this issue.", log_level)
36
+ rescue Fontist::Errors::FormulaIndexNotFoundError
37
+ fintist_update_repo(manifest, agree, continue, no_progress)
38
+ end
39
+
40
+ def fontist_install(manifest, agree, no_progress)
41
+ Fontist::Manifest::Install.from_hash(
42
+ manifest,
43
+ confirmation: agree ? "yes" : "no",
44
+ no_progress: no_progress,
45
+ )
46
+ end
47
+
48
+ def license_error_log(continue)
30
49
  if continue
31
50
  Util.log(
32
51
  "[fontist] Processing will continue without fonts installed",
33
- :debug
52
+ :debug,
34
53
  )
35
54
  else
36
55
  Util.log("[fontist] Aborting without proper fonts installed," \
37
56
  " make sure that you have set option --agree-to-terms",
38
57
  :fatal)
39
58
  end
40
- rescue Fontist::Errors::FontError => e
41
- log_level = continue ? :warning : :fatal
42
- Util.log("[fontist] '#{e.font}' font is not supported. " \
43
- "Please report this issue at github.com/metanorma/metanorma" \
44
- "/issues to report this issue.", log_level)
45
- rescue Fontist::Errors::FormulaIndexNotFoundError
59
+ end
60
+
61
+ def fintist_update_repo(manifest, agree, continue, no_progress)
46
62
  if @@updated_formulas_repo
47
63
  Util.log(
48
64
  "[fontist] Bug: formula index not found after 'fontist update'",
49
- :fatal
65
+ :fatal,
50
66
  )
51
67
  end
52
68
  Util.log("[fontist] Missing formula index. Fetching it...", :debug)
@@ -54,28 +70,6 @@ module Metanorma
54
70
  @@updated_formulas_repo = true
55
71
  install_fonts_safe(manifest, agree, continue, no_progress)
56
72
  end
57
-
58
- def fontist_install(manifest, agree, no_progress)
59
- Fontist::Manifest::Install.from_hash(
60
- manifest,
61
- confirmation: agree ? "yes" : "no",
62
- no_progress: no_progress
63
- )
64
- end
65
-
66
- def dump_fontist_manifest_locations(manifest)
67
- location_manifest = Fontist::Manifest::Locations.from_hash(
68
- manifest
69
- )
70
- location_manifest_file = Tempfile.new(["fontist_locations", ".yml"])
71
- location_manifest_file.write location_manifest.to_yaml
72
- location_manifest_file.flush
73
- location_manifest_file
74
- end
75
-
76
- def missing_fontist_manifest?(processor)
77
- !processor.respond_to?(:fonts_manifest) || processor.fonts_manifest.nil?
78
- end
79
73
  end
80
74
 
81
75
  def self.install_fonts(processor, options)
@@ -89,20 +83,18 @@ module Metanorma
89
83
  manifest,
90
84
  agree_to_terms,
91
85
  can_without_fonts,
92
- no_progress
86
+ no_progress,
93
87
  )
94
88
  end
95
89
 
96
- def self.fontist_font_locations(processor, options)
97
- if missing_fontist_manifest?(processor) || options[:no_install_fonts]
98
- return nil
99
- end
100
-
101
- dump_fontist_manifest_locations(processor.fonts_manifest)
102
- rescue Fontist::Errors::FormulaIndexNotFoundError
103
- raise unless options[:continue_without_fonts]
90
+ def self.has_fonts_manifest?(processor, options = {})
91
+ !options[:no_install_fonts] \
92
+ && processor.respond_to?(:fonts_manifest) \
93
+ && !processor.fonts_manifest.nil?
94
+ end
104
95
 
105
- nil
96
+ def self.location_manifest(processor)
97
+ Fontist::Manifest::Locations.from_hash(processor.fonts_manifest)
106
98
  end
107
99
  end
108
100
  end
@@ -84,7 +84,7 @@ module Metanorma
84
84
  defined?(break_up) and
85
85
  break_up = empty_attr(break_up, "break-up-urls-in-tables")
86
86
  ret.merge(
87
- datauriimage: defined?(datauriimage) ? datauriimage != "false" : nil,
87
+ datauriimage: defined?(datauriimage) ? datauriimage != "false" : true,
88
88
  suppressasciimathdup: defined?(suppress_asciimath_dup) ? suppress_asciimath_dup != "false" : nil,
89
89
  hierarchical_assets: defined?(hier_assets) ? hier_assets : nil,
90
90
  use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.3.12".freeze
2
+ VERSION = "1.4.0".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.12
4
+ version: 1.4.0
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-07 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -303,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  - !ruby/object:Gem::Version
304
304
  version: '0'
305
305
  requirements: []
306
- rubygems_version: 3.1.4
306
+ rubygems_version: 3.2.22
307
307
  signing_key:
308
308
  specification_version: 4
309
309
  summary: Metanorma is the standard of standards; the metanorma gem allows you to create