metanorma 1.6.6 → 1.6.8
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 +4 -4
- data/Gemfile +4 -1
- data/lib/metanorma/collection_render_utils.rb +2 -2
- data/lib/metanorma/compile_options.rb +16 -17
- data/lib/metanorma/fontist_utils.rb +15 -6
- data/lib/metanorma/processor.rb +1 -1
- data/lib/metanorma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62515490978dfce5108f674bf4dbee7efde188185fc16b081270dd3ea1d288cc
|
4
|
+
data.tar.gz: 6b72aac716ff0aa8faf39aed01b59b75fd068f866096aef735f89767ce6f92ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e9b1a354d205379931f34f89c3af5cb869671c4d124ef15f09a7ccc1aaca3603c2d832ec57fb1be99a074905642a03b0d5820847285ff01d80cf92daa438350
|
7
|
+
data.tar.gz: cfbec2def4806aaad3ab088086928e042b3e55278871710b1b1be4cd4223ee6cc0693d0557117d82686afe1cbfa46dca209f112fba602d356e0dc106e4091420
|
data/Gemfile
CHANGED
@@ -4,9 +4,12 @@ Encoding.default_internal = Encoding::UTF_8
|
|
4
4
|
source "https://rubygems.org"
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
6
6
|
|
7
|
-
|
7
|
+
group :development, :test do
|
8
|
+
gem "rspec"
|
9
|
+
end
|
8
10
|
|
9
11
|
if File.exist? "Gemfile.devel"
|
10
12
|
eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
|
11
13
|
end
|
12
14
|
|
15
|
+
gemspec
|
@@ -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.
|
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,34 +61,33 @@ 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
|
80
67
|
|
81
68
|
def get_isodoc_options(file, options, ext)
|
82
69
|
ret = @processor.extract_options(file)
|
70
|
+
copy_isodoc_options_attrs(options, ret)
|
71
|
+
font_manifest_mn2pdf(options, ret, ext)
|
72
|
+
ret[:output_formats].select! do |k, _|
|
73
|
+
options[:extension_keys].include?(k)
|
74
|
+
end
|
75
|
+
ret
|
76
|
+
end
|
77
|
+
|
78
|
+
def copy_isodoc_options_attrs(options, ret)
|
83
79
|
ret[:datauriimage] = true if options[:datauriimage]
|
84
80
|
ret[:sourcefilename] = options[:filename]
|
85
81
|
%i(bare sectionsplit no_install_fonts baseassetpath aligncrosselements
|
86
82
|
tocfigures toctables tocrecommendations strict)
|
87
83
|
.each { |x| ret[x] ||= options[x] }
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
ret
|
84
|
+
end
|
85
|
+
|
86
|
+
def font_manifest_mn2pdf(options, ret, ext)
|
87
|
+
custom_fonts = FontistUtils.has_custom_fonts?(@processor, options, ret)
|
88
|
+
ext == :pdf && custom_fonts and
|
89
|
+
ret[:mn2pdf] = { font_manifest: FontistUtils
|
90
|
+
.location_manifest(@processor, ret) }
|
92
91
|
end
|
93
92
|
end
|
94
93
|
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 !
|
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.
|
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(
|
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
|
data/lib/metanorma/processor.rb
CHANGED
data/lib/metanorma/version.rb
CHANGED
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.
|
4
|
+
version: 1.6.8
|
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
|
+
date: 2023-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|