metanorma 1.2.7 → 1.2.8

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: 6c6df255e2338335a6f670965e34d61d3d808a3d9a1a69c78ef9af1f9a2f306f
4
- data.tar.gz: b5c485bdcd52c100d141b80c1ceb5a0f2a66b0eb45fa2a7efd56e3b57653596d
3
+ metadata.gz: 72a5ff12b5b2793f4d8b8ced7b5cdc747a7b59cb938300f1e288150787d82951
4
+ data.tar.gz: 2a8f1a0fda7ceed680324833c18ab595d9de381aab36f3a5848040743029dfc8
5
5
  SHA512:
6
- metadata.gz: 638bede7f3dffde3a6169e51a684fa10efec05975273ab6dc1495e95f074b21b0cc7cefaf168cb6a0ebe0d8c903dcf37ebbc4c023a6c1149cc42d16f517e67fd
7
- data.tar.gz: 727a3a66032ed783b5b099a035589666818d71a67e9f88366cf888fd3879c40ff5872533d39ef1e7b31dc8d15289274aea866637233b88c60e0f244b92d79f17
6
+ metadata.gz: d8ad8063e83a0d51494cb9d69f552676b27ac2022c9d477af6e12902bc2a9c7ceddc07d51965c594ab3ddf92839da6071d8a407836774e26c676b2fd3c9d584d
7
+ data.tar.gz: 18b394b6fd082a3072d543b120656ee181a68ce4c1a4cf3f0551f53719e07a96ec1b2140d61fac86e328370464e024df38872a0d85bc0b95aee588bb3e844982
data/.gitignore CHANGED
@@ -20,3 +20,5 @@
20
20
  Gemfile.lock
21
21
  relaton/
22
22
  .vscode/
23
+
24
+ .rubocop-https--*
data/.rubocop.yml CHANGED
@@ -1,6 +1,14 @@
1
1
  # This project follows the Ribose OSS style guide.
2
2
  # https://github.com/riboseinc/oss-guides
3
3
  # All project-specific additions and overrides should be specified in this file.
4
-
5
4
  inherit_from:
6
5
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
+
7
+ # local repo-specific modifications
8
+
9
+ AllCops:
10
+ DisplayCopNames: false
11
+ StyleGuideCopsOnly: false
12
+ TargetRubyVersion: 2.4
13
+ Rails:
14
+ Enabled: true
@@ -1,6 +1,7 @@
1
1
  require "fileutils"
2
2
  require "nokogiri"
3
3
  require "htmlentities"
4
+ require "yaml"
4
5
 
5
6
  require "fontist"
6
7
  require "fontist/manifest/install"
@@ -251,6 +252,10 @@ module Metanorma
251
252
  isodoc_options[:datauriimage] = true if options[:datauriimage]
252
253
  file_extension = @processor.output_formats[ext]
253
254
  outfilename = f.sub(/\.[^.]+$/, ".#{file_extension}")
255
+ if ext == :pdf
256
+ font_locations = fontist_font_locations(options)
257
+ isodoc_options[:mn2pdf] = { font_manifest_file: font_locations.path } if font_locations
258
+ end
254
259
  if ext == :rxl
255
260
  options[:relaton] = outfilename
256
261
  relaton_export(isodoc, options)
@@ -264,6 +269,9 @@ module Metanorma
264
269
  puts e.backtrace.join("\n")
265
270
  end
266
271
  end
272
+ if ext == :pdf
273
+ # font_locations.unlink
274
+ end
267
275
  wrap_html(options, file_extension, outfilename)
268
276
  end
269
277
  end
@@ -275,7 +283,7 @@ module Metanorma
275
283
  return
276
284
  end
277
285
 
278
- if !@processor.respond_to?(:fonts_manifest) || @processor.fonts_manifest.nil?
286
+ if missing_fontist_manifest?
279
287
  Util.log("[fontist] Skip font installation because font_manifest is missing", :debug)
280
288
  return
281
289
  end
@@ -285,17 +293,21 @@ module Metanorma
285
293
  manifest = @processor.fonts_manifest
286
294
  agree_to_terms = options[:agree_to_terms] || false
287
295
  continue_without_fonts = options[:continue_without_fonts] || false
296
+ no_progress = options[:no_progress] || false
288
297
 
289
- install_fonts_safe(manifest, agree_to_terms, continue_without_fonts)
298
+ install_fonts_safe(manifest, agree_to_terms, continue_without_fonts, no_progress)
290
299
  end
291
300
 
292
301
  private
293
302
 
294
- def install_fonts_safe(manifest, agree, continue)
295
- fontist_install(manifest, agree)
303
+ def install_fonts_safe(manifest, agree, continue, no_progress)
304
+ fontist_install(manifest, agree, no_progress)
296
305
  rescue Fontist::Errors::LicensingError
297
306
  if continue
298
- Util.log("[fontist] Processing will continue without fonts installed", :debug)
307
+ Util.log(
308
+ "[fontist] Processing will continue without fonts installed",
309
+ :debug
310
+ )
299
311
  else
300
312
  Util.log("[fontist] Aborting without proper fonts installed," \
301
313
  " make sure that you have set option --agree-to-terms", :fatal)
@@ -303,21 +315,52 @@ module Metanorma
303
315
  rescue Fontist::Errors::FontError => e
304
316
  log_level = continue ? :warning : :fatal
305
317
  Util.log("[fontist] '#{e.font}' font is not supported. " \
306
- "Please report this issue at github.com/metanorma/metanorma-#{@processor.short}/issues" \
307
- " to report this issue.", log_level)
318
+ "Please report this issue at github.com/metanorma/metanorma-"\
319
+ "#{@processor.short}/issues to report this issue.", log_level)
308
320
  rescue Fontist::Errors::FormulaIndexNotFoundError
309
- Util.log("[fontist] Bug: formula index not found after 'fontist update'", :fatal) if @updated_formulas_repo
321
+ if @updated_formulas_repo
322
+ Util.log(
323
+ "[fontist] Bug: formula index not found after 'fontist update'",
324
+ :fatal
325
+ )
326
+ end
310
327
  Util.log("[fontist] Missing formula index. Fetching it...", :debug)
311
328
  Fontist::Formula.update_formulas_repo
312
329
  @updated_formulas_repo = true
313
- install_fonts_safe(manifest, agree, continue)
330
+ install_fonts_safe(manifest, agree, continue, no_progress)
314
331
  end
315
332
 
316
- def fontist_install(manifest, agree)
333
+ def fontist_install(manifest, agree, no_progress)
317
334
  Fontist::Manifest::Install.from_hash(
318
335
  manifest,
319
- confirmation: agree ? "yes" : "no"
336
+ confirmation: agree ? "yes" : "no",
337
+ no_progress: no_progress
338
+ )
339
+ end
340
+
341
+ def fontist_font_locations(options)
342
+ return nil if missing_fontist_manifest? || options[:no_install_fonts]
343
+
344
+ dump_fontist_manifest_locations(@processor.fonts_manifest)
345
+ rescue Fontist::Errors::FormulaIndexNotFoundError
346
+ raise unless options[:continue_without_fonts]
347
+
348
+ nil
349
+ end
350
+
351
+ def dump_fontist_manifest_locations(manifest)
352
+ location_manifest = Fontist::Manifest::Locations.from_hash(
353
+ manifest
320
354
  )
355
+ location_manifest_file = Tempfile.new(["fontist_locations", ".yml"])
356
+ location_manifest_file.write location_manifest.to_yaml
357
+ location_manifest_file.flush
358
+
359
+ location_manifest_file
360
+ end
361
+
362
+ def missing_fontist_manifest?
363
+ !@processor.respond_to?(:fonts_manifest) || @processor.fonts_manifest.nil?
321
364
  end
322
365
 
323
366
  # @param options [Hash]
@@ -70,11 +70,13 @@ module Metanorma
70
70
  /\n:title-font: (?<titlefont>[^\n]+)\n/ =~ headerextract
71
71
  /\n:i18nyaml: (?<i18nyaml>[^\n]+)\n/ =~ headerextract
72
72
  /\n:htmlstylesheet: (?<htmlstylesheet>[^\n]+)\n/ =~ headerextract
73
+ /\n:htmlstylesheet-override: (?<htmlstylesheet_override>[^\n]+)\n/ =~ headerextract
73
74
  /\n:htmlcoverpage: (?<htmlcoverpage>[^\n]+)\n/ =~ headerextract
74
75
  /\n:htmlintropage: (?<htmlintropage>[^\n]+)\n/ =~ headerextract
75
76
  /\n:scripts: (?<scripts>[^\n]+)\n/ =~ headerextract
76
77
  /\n:scripts-pdf: (?<scripts_pdf>[^\n]+)\n/ =~ headerextract
77
78
  /\n:wordstylesheet: (?<wordstylesheet>[^\n]+)\n/ =~ headerextract
79
+ /\n:wordstylesheet-override: (?<wordstylesheet_override>[^\n]+)\n/ =~ headerextract
78
80
  /\n:standardstylesheet: (?<standardstylesheet>[^\n]+)\n/ =~ headerextract
79
81
  /\n:header: (?<header>[^\n]+)\n/ =~ headerextract
80
82
  /\n:wordcoverpage: (?<wordcoverpage>[^\n]+)\n/ =~ headerextract
@@ -102,11 +104,13 @@ module Metanorma
102
104
  titlefont: defined?(titlefont) ? titlefont : nil,
103
105
  i18nyaml: defined?(i18nyaml) ? i18nyaml : nil,
104
106
  htmlstylesheet: defined?(htmlstylesheet) ? htmlstylesheet : nil,
107
+ htmlstylesheet_override: defined?(htmlstylesheet_override) ? htmlstylesheet_override : nil,
105
108
  htmlcoverpage: defined?(htmlcoverpage) ? htmlcoverpage : nil,
106
109
  htmlintropage: defined?(htmlintropage) ? htmlintropage : nil,
107
110
  scripts: defined?(scripts) ? scripts : nil,
108
111
  scripts_pdf: defined?(scripts_pdf) ? scripts_pdf : nil,
109
112
  wordstylesheet: defined?(wordstylesheet) ? wordstylesheet : nil,
113
+ wordstylesheet_override: defined?(wordstylesheet_override) ? wordstylesheet_override : nil,
110
114
  standardstylesheet: defined?(standardstylesheet) ? standardstylesheet : nil,
111
115
  header: defined?(header) ? header : nil,
112
116
  wordcoverpage: defined?(wordcoverpage) ? wordcoverpage : nil,
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
data/metanorma.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_runtime_dependency 'htmlentities'
28
28
  spec.add_runtime_dependency 'nokogiri'
29
29
  spec.add_runtime_dependency 'mn2pdf', "~> 1"
30
- spec.add_runtime_dependency 'metanorma-utils', "~> 1.0.3"
30
+ spec.add_runtime_dependency 'metanorma-utils', "~> 1.1.0"
31
31
  spec.add_runtime_dependency 'pry'
32
32
  spec.add_runtime_dependency 'fontist', '~> 1.8'
33
33
 
@@ -42,4 +42,5 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
43
43
  spec.add_development_dependency "metanorma-iso", "~> 1.7.0"
44
44
  spec.add_development_dependency "sassc", "~> 2.4.0"
45
+ spec.add_development_dependency "rubocop", "~> 1.5.2"
45
46
  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.2.7
4
+ version: 1.2.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: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.3
75
+ version: 1.1.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.3
82
+ version: 1.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: 2.4.0
209
+ - !ruby/object:Gem::Dependency
210
+ name: rubocop
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 1.5.2
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 1.5.2
209
223
  description: Library to process any Metanorma standard.
210
224
  email:
211
225
  - open.source@ribose.com