metanorma 1.4.14 → 1.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1dac5b5e07f1da6269c97d7b1b0e0f5854f83eb1f91337395228b7b7f3354bc4
4
- data.tar.gz: 848eb435ee3b51e989fc94e99c757e6ce920ff42a4ab137b7f6f5e765b4effc1
3
+ metadata.gz: 90bf0ce070f2311504682547eb3024210586686123020f92a776fc590fe478a9
4
+ data.tar.gz: 330f7930f8c1bfd3972fff06b59d1a31bdd78893a849d4b01f377051c7137089
5
5
  SHA512:
6
- metadata.gz: 8364f0a11089ca85aa958a141c992922dd6366443e6d053197860ce14403961b9cb4069aba120ce4054242ebf5a9e40bf1d786fb9c4659dee89ea8ab4b57f22c
7
- data.tar.gz: 578e518e52ed9d3404e576e957f0f523010dd2b0dcbd2376760185b92bbdd9aacac8bc2adb962425c3c3dc0ccd7fac528b377277d02b4f63c777696f77fd43b4
6
+ metadata.gz: 878e9d88ee70e5bfeda7198d596b77d4785f0c4aab345aedf7eabf67d5a28dddfb04df560376376b2137aa20f330986efee59d3f456ccf15d4fbca64ce45d1c8
7
+ data.tar.gz: 69f19f897413b45d7111fcabeba645a2aaffe48900230b18f08eef4977219d009ac91a5952f9c1afb985fb31ccb936f25b169ebc1c29e46256852d358869a6d8
@@ -18,6 +18,9 @@ jobs:
18
18
  uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
19
19
  with:
20
20
  next_version: ${{ github.event.inputs.next_version }}
21
+ release_command: rake release
22
+ bundler_cache: false
23
+ post_install: gem install bundler rake rspec
21
24
  secrets:
22
25
  rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
23
26
  pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
@@ -8,7 +8,8 @@ module Metanorma
8
8
  # UUIDs, so that their IDs can at least be registered to be tracked
9
9
  # as existing.
10
10
  def read_anchors(xml)
11
- xrefs = @isodoc.xref_init(@lang, @script, @isodoc, @isodoc.i18n, {})
11
+ xrefs = @isodoc.xref_init(@lang, @script, @isodoc, @isodoc.i18n,
12
+ { locale: @locale })
12
13
  xrefs.parse xml
13
14
  xrefs.get.each_with_object({}) do |(k, v), ret|
14
15
  read_anchors1(k, v, ret)
@@ -25,8 +25,9 @@ module Metanorma
25
25
  def initialize(collection, folder, options = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
26
26
  check_options options
27
27
  @xml = Nokogiri::XML collection.to_xml # @xml is the collection manifest
28
- @lang = @xml&.at(ns("//bibdata/language"))&.text || "en"
29
- @script = @xml&.at(ns("//bibdata/script"))&.text || "Latn"
28
+ @lang = @xml.at(ns("//bibdata/language"))&.text || "en"
29
+ @script = @xml.at(ns("//bibdata/script"))&.text || "Latn"
30
+ @locale = @xml.at(ns("//bibdata/locale"))&.text
30
31
  @doctype = doctype
31
32
  require "metanorma-#{@doctype}"
32
33
 
@@ -47,8 +48,7 @@ module Metanorma
47
48
  # list of files in the collection
48
49
  @files = read_files folder
49
50
  isodoc_populate(@isodoc)
50
- FileUtils.rm_rf @outdir
51
- FileUtils.mkdir_p @outdir
51
+ create_non_existing_directory(@outdir)
52
52
  end
53
53
 
54
54
  def dir_name_cleanse(name)
@@ -96,7 +96,7 @@ module Metanorma
96
96
  def concatenate1(out, ext)
97
97
  out.directives << "documents-inline"
98
98
  out.documents.each_key do |id|
99
- next if @files[id][:attachment] || @files[id][:outputs].nil?
99
+ @files[id][:attachment] || @files[id][:outputs].nil? and next
100
100
 
101
101
  out.documents[id] =
102
102
  Metanorma::Document.raw_file(@files[id][:outputs][ext])
@@ -134,8 +134,8 @@ module Metanorma
134
134
  def isodoc
135
135
  x = Asciidoctor.load nil, backend: @doctype.to_sym
136
136
  isodoc = x.converter.html_converter(Dummy.new)
137
- isodoc.i18n_init(@lang, @script) # read in internationalisation
138
- isodoc.metadata_init(@lang, @script, isodoc.i18n)
137
+ isodoc.i18n_init(@lang, @script, @locale) # read in internationalisation
138
+ isodoc.metadata_init(@lang, @script, @locale, isodoc.i18n)
139
139
  isodoc.info(@xml, nil)
140
140
  isodoc
141
141
  end
@@ -146,7 +146,7 @@ module Metanorma
146
146
  nav = indexfile(@xml.at(ns("//manifest")))
147
147
  i18n = isodoc.i18n
148
148
  i18n.set("navigation", nav)
149
- isodoc.metadata_init(@lang, @script, i18n)
149
+ isodoc.metadata_init(@lang, @script, @locale, i18n)
150
150
  # populate the @meta class of isodoc with the various metadata fields
151
151
  # native to the flavour; used to populate Liquid
152
152
  isodoc.info(@xml, nil)
@@ -240,6 +240,12 @@ module Metanorma
240
240
 
241
241
  private
242
242
 
243
+ def create_non_existing_directory(output_directory)
244
+ if !File.exist?(output_directory)
245
+ FileUtils.mkdir_p(output_directory)
246
+ end
247
+ end
248
+
243
249
  def format_sort(formats)
244
250
  ret = []
245
251
  formats.include?(:xml) and ret << :xml
@@ -29,31 +29,32 @@ module Metanorma
29
29
  Util.log("[metanorma] Info: Loading `#{flavor}` gem "\
30
30
  "for standard type `#{stdtype}`.", :info)
31
31
  end
32
- require_flavor(flavor, stdtype)
32
+ require_flavor(flavor)
33
33
  unless @registry.supported_backends.include? stdtype
34
- Util.log("[metanorma] Error: The `#{flavor}` gem "\
35
- "still doesn't support `#{stdtype}`. Exiting.", :fatal)
34
+ Util.log("[metanorma] Error: The `#{flavor}` gem does not "\
35
+ "support the standard type #{stdtype}. Exiting.", :fatal)
36
36
  end
37
37
  end
38
38
 
39
- def require_flavor(flavor, stdtype)
39
+ def require_flavor(flavor)
40
40
  require flavor
41
41
  Util.log("[metanorma] Info: gem `#{flavor}` loaded.", :info)
42
- rescue Gem::ConflictError
43
- Util.log("[metanorma] Error: Couldn't resolve dependencies for "\
44
- "`metanorma-#{stdtype}`, Please add it to your Gemfile "\
45
- "and run bundle install first", :fatal)
46
- rescue LoadError
42
+ rescue LoadError => e
43
+ error_log = "#{Date.today}-error.log"
44
+ File.write(error_log, e)
45
+
47
46
  msg = <<~MSG
48
- [metanorma] Error: loading gem `#{flavor}` failed. Exiting.
47
+ Error: #{e.message}
48
+ Metanorma has encountered an exception.
49
+
50
+ If this problem persists, please report this issue at the following link:
51
+
52
+ * https://github.com/metanorma/metanorma/issues/new
49
53
 
50
- Troubleshooting:
51
- 1. If you are using metanorma via bundler/ruby, make sure that your
52
- Gemfile contains a line:
53
- gem "metanorma-#{stdtype}"
54
+ Please attach the #{error_log} file.
55
+ Your valuable feedback is very much appreciated!
54
56
 
55
- 2. If you are using brew/choco/snap packages, please report an issue
56
- to https://github.com/metanorma/packed-mn/issues/new"
57
+ - The Metanorma team
57
58
  MSG
58
59
  Util.log(msg, :fatal)
59
60
  end
@@ -70,7 +70,8 @@ module Metanorma
70
70
  pdf-allow-print pdf-allow-print-hq pdf-allow-fill-in-forms
71
71
  toc-figures toc-tables toc-recommendations fonts
72
72
  font-license-agreement pdf-allow-access-content
73
- pdf-encrypt-metadata iso-word-template document-scheme).freeze
73
+ pdf-encrypt-metadata iso-word-template document-scheme
74
+ localize-number).freeze
74
75
 
75
76
  def extract_options(file)
76
77
  header = file.sub(/\n\n.*$/m, "\n")
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.4.14".freeze
2
+ VERSION = "1.5.0".freeze
3
3
  end
data/metanorma.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_runtime_dependency "asciidoctor"
26
26
  spec.add_runtime_dependency "fontist", ">= 1.14.3"
27
27
  spec.add_runtime_dependency "htmlentities"
28
- spec.add_runtime_dependency "isodoc", ">= 2.2.3.1"
28
+ spec.add_runtime_dependency "isodoc", ">= 2.3.1"
29
29
  spec.add_runtime_dependency "metanorma-utils", "~> 1.4.0"
30
30
  spec.add_runtime_dependency "mn2pdf", "~> 1"
31
31
  spec.add_runtime_dependency "nokogiri"
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_development_dependency "debug"
39
39
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
40
- spec.add_development_dependency "metanorma-iso", "~> 2.1.7"
40
+ spec.add_development_dependency "metanorma-iso"
41
41
  spec.add_development_dependency "mnconvert"
42
42
  spec.add_development_dependency "rake", "~> 13.0"
43
43
  spec.add_development_dependency "rspec", "~> 3.0"
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.4.14
4
+ version: 1.5.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: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 2.2.3.1
61
+ version: 2.3.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 2.2.3.1
68
+ version: 2.3.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: metanorma-utils
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +154,16 @@ dependencies:
154
154
  name: metanorma-iso
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 2.1.7
159
+ version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 2.1.7
166
+ version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: mnconvert
169
169
  requirement: !ruby/object:Gem::Requirement