metanorma 1.4.13 → 1.5.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: 3c44cf4aabedd163aec40f3f025dceeef6bd81673c9e7fa5d128e92b8e8be8fa
4
- data.tar.gz: 90e0a4b625a48f4cc74ac106b4ee4eba143bb2f693849baf11263b49fdeb7dd0
3
+ metadata.gz: 90bf0ce070f2311504682547eb3024210586686123020f92a776fc590fe478a9
4
+ data.tar.gz: 330f7930f8c1bfd3972fff06b59d1a31bdd78893a849d4b01f377051c7137089
5
5
  SHA512:
6
- metadata.gz: 321dc2b17c2634f63ead327f006d728088caaa43389f988d91701f595d748ade012deaaff2ee0654bc6ee868461b8a1c36b9a6d6ad1f1fe5841288f2de9b851c
7
- data.tar.gz: 10228c514def42a877b2189fe52a9517f8824db2d59225a279b08295ee4da20a9f701cb00c992a0df5cc2e01c124ff0fcdf10ece8b6003f2c370e7d8927a09c5
6
+ metadata.gz: 878e9d88ee70e5bfeda7198d596b77d4785f0c4aab345aedf7eabf67d5a28dddfb04df560376376b2137aa20f330986efee59d3f456ccf15d4fbca64ce45d1c8
7
+ data.tar.gz: 69f19f897413b45d7111fcabeba645a2aaffe48900230b18f08eef4977219d009ac91a5952f9c1afb985fb31ccb936f25b169ebc1c29e46256852d358869a6d8
@@ -9,7 +9,7 @@ on:
9
9
  pull_request:
10
10
 
11
11
  jobs:
12
- notify:
13
- uses: metanorma/metanorma-build-scripts/.github/workflows/inkscape-rake.yml@main
12
+ rake:
13
+ uses: metanorma/ci/.github/workflows/inkscape-rake.yml@main
14
14
  secrets:
15
15
  pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
@@ -0,0 +1,27 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: release
4
+
5
+ on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ next_version:
9
+ description: |
10
+ Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
11
+ required: true
12
+ default: 'skip'
13
+ push:
14
+ tags: [ v* ]
15
+
16
+ jobs:
17
+ release:
18
+ uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
19
+ with:
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
24
+ secrets:
25
+ rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
26
+ pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
27
+
@@ -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
@@ -63,14 +63,15 @@ module Metanorma
63
63
  ulstyle olstyle htmlstylesheet-override bare
64
64
  htmltoclevels doctoclevels sectionsplit base-asset-path
65
65
  body-font header-font monospace-font title-font
66
- align-cross-elements wordstylesheet-override
66
+ align-cross-elements wordstylesheet-override ieee-dtd
67
67
  pdf-encrypt pdf-encryption-length pdf-user-password
68
68
  pdf-owner-password pdf-allow-copy-content pdf-allow-edit-content
69
69
  pdf-allow-assemble-document pdf-allow-edit-annotations
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.13".freeze
2
+ VERSION = "1.5.0".freeze
3
3
  end
data/metanorma.gemspec CHANGED
@@ -25,7 +25,8 @@ 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 "metanorma-utils", "~> 1.3.0"
28
+ spec.add_runtime_dependency "isodoc", ">= 2.3.1"
29
+ spec.add_runtime_dependency "metanorma-utils", "~> 1.4.0"
29
30
  spec.add_runtime_dependency "mn2pdf", "~> 1"
30
31
  spec.add_runtime_dependency "nokogiri"
31
32
  spec.add_runtime_dependency "pry"
@@ -36,7 +37,7 @@ Gem::Specification.new do |spec|
36
37
 
37
38
  spec.add_development_dependency "debug"
38
39
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
39
- spec.add_development_dependency "metanorma-iso", "~> 2.1.6"
40
+ spec.add_development_dependency "metanorma-iso"
40
41
  spec.add_development_dependency "mnconvert"
41
42
  spec.add_development_dependency "rake", "~> 13.0"
42
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.13
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-24 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
@@ -52,20 +52,34 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: isodoc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.3.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.3.1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: metanorma-utils
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 1.3.0
75
+ version: 1.4.0
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: 1.3.0
82
+ version: 1.4.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: mn2pdf
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -140,16 +154,16 @@ dependencies:
140
154
  name: metanorma-iso
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - "~>"
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
- version: 2.1.6
159
+ version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - "~>"
164
+ - - ">="
151
165
  - !ruby/object:Gem::Version
152
- version: 2.1.6
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: mnconvert
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -247,6 +261,7 @@ files:
247
261
  - ".github/workflows/dependent_repos.env"
248
262
  - ".github/workflows/notify.yml"
249
263
  - ".github/workflows/rake.yml"
264
+ - ".github/workflows/release.yml"
250
265
  - ".gitignore"
251
266
  - ".hound.yml"
252
267
  - ".rspec"
@@ -291,7 +306,7 @@ homepage: https://github.com/metanorma/metanorma
291
306
  licenses:
292
307
  - BSD-2-Clause
293
308
  metadata: {}
294
- post_install_message:
309
+ post_install_message:
295
310
  rdoc_options: []
296
311
  require_paths:
297
312
  - lib
@@ -306,8 +321,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
321
  - !ruby/object:Gem::Version
307
322
  version: '0'
308
323
  requirements: []
309
- rubygems_version: 3.3.16
310
- signing_key:
324
+ rubygems_version: 3.1.6
325
+ signing_key:
311
326
  specification_version: 4
312
327
  summary: Metanorma is the standard of standards; the metanorma gem allows you to create
313
328
  any standard document type supported by Metanorma.