metanorma 1.6.6 → 1.6.7

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: c329757741717214253fd1ca5cf31cfaa1859c2c35647b5586970cb36595f1a3
4
- data.tar.gz: c02920016d7294a37d9459e26d9d4e5c4291bc75a94181c1d139ad7f3a2e5215
3
+ metadata.gz: da01eef341e191e1e5feb7181afa5341ec66ff9b81792aace74bdcfc58a9690e
4
+ data.tar.gz: 36ab1f699a49b800cbeef67950e595f8306980b0406d8d0227d8570bf4581abc
5
5
  SHA512:
6
- metadata.gz: d8fb74a61e67a308fb0523e4512bc4d2e0067d5dadb8cc736114e47781e9b638066a0e438cadeca16a1d210f785eeb544abd526a91483dfd81f6580b9fa051ff
7
- data.tar.gz: de5e33cc1cfd207c6ad912759a5fc9e8cda3f576eaabd3e2c897662d299d298d37d9db052589990f5aa9f18a9ccd675d870212f0a07b987128d42eec198e5007
6
+ metadata.gz: 2c3a0595febda908e72b2e1075e8ac54955c00fbcbedb06a312f19f162c08de69f54ff0db365c76eece70743b0ffea5b68f67cce4e95e2b5c9261236b895e63a
7
+ data.tar.gz: a8065d8df08ade6c95ec184dd0d428c09aab5aadab74b0198280a95e9263c3794135b72139039cd7306168d26c8dc99daee8fc4ef869de4d3413b93c8929869d
@@ -110,8 +110,8 @@ module Metanorma
110
110
  class PdfOptionsNode
111
111
  def initialize(doctype, options)
112
112
  docproc = Metanorma::Registry.instance.find_processor(doctype)
113
- if FontistUtils.has_fonts_manifest?(docproc, options)
114
- @fonts_manifest = FontistUtils.location_manifest(docproc)
113
+ if FontistUtils.has_custom_fonts?(docproc, options, {})
114
+ @fonts_manifest = FontistUtils.location_manifest(docproc, options)
115
115
  end
116
116
  end
117
117
 
@@ -61,19 +61,6 @@ module Metanorma
61
61
  def font_install(opt)
62
62
  FontistUtils.install_fonts(@processor, opt) unless @fontist_installed
63
63
  @fontist_installed = true
64
- !opt[:fonts] ||
65
- opt[:fontlicenseagreement] == "continue-without-fonts" and return
66
- @font_overrides ||= []
67
- font_install_override(opt)
68
- end
69
-
70
- def font_install_override(opt)
71
- confirm = opt[:fontlicenseagreement] == "no-install-fonts" ? "no" : "yes"
72
- CSV.parse_line(opt[:fonts], col_sep: ";").map(&:strip).each do |f|
73
- @font_overrides.include?(f) and next
74
- Fontist::Font.install(f, confirmation: confirm)
75
- @font_overrides << f
76
- end
77
64
  end
78
65
 
79
66
  private
@@ -85,9 +72,10 @@ module Metanorma
85
72
  %i(bare sectionsplit no_install_fonts baseassetpath aligncrosselements
86
73
  tocfigures toctables tocrecommendations strict)
87
74
  .each { |x| ret[x] ||= options[x] }
88
- ext == :pdf && FontistUtils.has_fonts_manifest?(@processor, options) and
75
+ custom_fonts = FontistUtils.has_custom_fonts?(@processor, options, ret)
76
+ ext == :pdf && custom_fonts &&
89
77
  ret[:mn2pdf] =
90
- { font_manifest: FontistUtils.location_manifest(@processor) }
78
+ { font_manifest: FontistUtils.location_manifest(@processor, ret) }
91
79
  ret
92
80
  end
93
81
  end
@@ -16,7 +16,7 @@ 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 !has_fonts_manifest?(processor)
19
+ elsif !has_custom_fonts?(processor, options, options)
20
20
  Util.log("[fontist] Skip font installation because "\
21
21
  "fonts_manifest is missing", :debug)
22
22
  return false
@@ -89,7 +89,8 @@ module Metanorma
89
89
  return unless validate_install_fonts(processor, options)
90
90
 
91
91
  @@updated_formulas_repo = false
92
- manifest = processor.fonts_manifest
92
+ manifest = processor.fonts_manifest.dup
93
+ append_source_fonts(manifest, options)
93
94
  agree_to_terms, can_without_fonts, no_progress = validate_options(options)
94
95
 
95
96
  install_fonts_safe(
@@ -100,14 +101,22 @@ module Metanorma
100
101
  )
101
102
  end
102
103
 
103
- def self.has_fonts_manifest?(processor, options = {})
104
+ def self.has_custom_fonts?(processor, options, source_attributes)
104
105
  !options[:no_install_fonts] \
105
106
  && processor.respond_to?(:fonts_manifest) \
106
- && !processor.fonts_manifest.nil?
107
+ && !processor.fonts_manifest.nil? \
108
+ || source_attributes[:fonts]
107
109
  end
108
110
 
109
- def self.location_manifest(processor)
110
- Fontist::Manifest::Locations.from_hash(processor.fonts_manifest)
111
+ def self.location_manifest(processor, source_attributes)
112
+ Fontist::Manifest::Locations.from_hash(
113
+ append_source_fonts(processor.fonts_manifest.dup, source_attributes),
114
+ )
115
+ end
116
+
117
+ def self.append_source_fonts(manifest, source_attributes)
118
+ source_attributes[:fonts]&.split(";")&.each { |f| manifest[f] = nil }
119
+ manifest
111
120
  end
112
121
  end
113
122
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.6.6".freeze
2
+ VERSION = "1.6.7".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.6.6
4
+ version: 1.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-06 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor