metanorma 1.2.5 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,65 +61,35 @@ module Metanorma
61
61
  end
62
62
 
63
63
  def extract_options(file)
64
- headerextract = file.sub(/\n\n.*$/m, "\n")
65
-
66
- /\n:script: (?<script>[^\n]+)\n/ =~ headerextract
67
- /\n:body-font: (?<bodyfont>[^\n]+)\n/ =~ headerextract
68
- /\n:header-font: (?<headerfont>[^\n]+)\n/ =~ headerextract
69
- /\n:monospace-font: (?<monospacefont>[^\n]+)\n/ =~ headerextract
70
- /\n:title-font: (?<titlefont>[^\n]+)\n/ =~ headerextract
71
- /\n:i18nyaml: (?<i18nyaml>[^\n]+)\n/ =~ headerextract
72
- /\n:htmlstylesheet: (?<htmlstylesheet>[^\n]+)\n/ =~ headerextract
73
- /\n:htmlcoverpage: (?<htmlcoverpage>[^\n]+)\n/ =~ headerextract
74
- /\n:htmlintropage: (?<htmlintropage>[^\n]+)\n/ =~ headerextract
75
- /\n:scripts: (?<scripts>[^\n]+)\n/ =~ headerextract
76
- /\n:scripts-pdf: (?<scripts_pdf>[^\n]+)\n/ =~ headerextract
77
- /\n:wordstylesheet: (?<wordstylesheet>[^\n]+)\n/ =~ headerextract
78
- /\n:standardstylesheet: (?<standardstylesheet>[^\n]+)\n/ =~ headerextract
79
- /\n:header: (?<header>[^\n]+)\n/ =~ headerextract
80
- /\n:wordcoverpage: (?<wordcoverpage>[^\n]+)\n/ =~ headerextract
81
- /\n:wordintropage: (?<wordintropage>[^\n]+)\n/ =~ headerextract
82
- /\n:ulstyle: (?<ulstyle>[^\n]+)\n/ =~ headerextract
83
- /\n:olstyle: (?<olstyle>[^\n]+)\n/ =~ headerextract
84
- /\n:data-uri-image: (?<datauriimage>[^\n]+)\n/ =~ headerextract
85
- /\n:htmltoclevels: (?<htmltoclevels>[^\n]+)\n/ =~ headerextract
86
- /\n:doctoclevels: (?<doctoclevels>[^\n]+)\n/ =~ headerextract
87
- /\n:(?<hierarchical_assets>hierarchical-assets:[^\n]*)\n/ =~ headerextract
88
- /\n:(?<use_xinclude>use-xinclude:[^\n]*)\n/ =~ headerextract
89
- /\n:(?<break_up_urls_in_tables>break-up-urls-in-tables:[^\n]*)\n/ =~ headerextract
64
+ header = file.sub(/\n\n.*$/m, "\n")
65
+ ret = %w(htmlstylesheet htmlcoverpage htmlintropage scripts
66
+ scripts-pdf wordstylesheet
67
+ standardstylesheet header wordcoverpage wordintropage i18nyaml
68
+ ulstyle olstyle htmlstylesheet-override
69
+ htmltoclevels doctoclevels sectionsplit
70
+ body-font header-font monospace-font title-font
71
+ wordstylesheet-override).each_with_object({}) do |w, acc|
72
+ m = /\n:#{w}: ([^\n]+)\n/.match(header) or next
73
+ acc[w.gsub(/-/, "").sub(/override$/, "_override")
74
+ .sub(/pdf$/, "_pdf").to_sym] = m[1]
75
+ end
76
+ /\n:data-uri-image: (?<datauriimage>[^\n]+)\n/ =~ header
77
+ /\n:(?<hierarchical_assets>hierarchical-assets:[^\n]*)\n/ =~ header
78
+ /\n:(?<use_xinclude>use-xinclude:[^\n]*)\n/ =~ header
79
+ /\n:(?<break_up>break-up-urls-in-tables:[^\n]*)\n/ =~ header
90
80
 
91
81
  defined?(hierarchical_assets) and
92
82
  hierarchical_assets = empty_attr(hierarchical_assets, "hierarchical-assets")
93
83
  defined?(use_xinclude) and
94
84
  use_xinclude = empty_attr(use_xinclude, "use-xinclude")
95
- defined?(break_up_urls_in_tables) and
96
- break_up_urls_in_tables = empty_attr(break_up_urls_in_tables, "break-up-urls-in-tables")
97
- {
98
- script: defined?(script) ? script : nil,
99
- bodyfont: defined?(bodyfont) ? bodyfont : nil,
100
- headerfont: defined?(headerfont) ? headerfont : nil,
101
- monospacefont: defined?(monospacefont) ? monospacefont : nil,
102
- titlefont: defined?(titlefont) ? titlefont : nil,
103
- i18nyaml: defined?(i18nyaml) ? i18nyaml : nil,
104
- htmlstylesheet: defined?(htmlstylesheet) ? htmlstylesheet : nil,
105
- htmlcoverpage: defined?(htmlcoverpage) ? htmlcoverpage : nil,
106
- htmlintropage: defined?(htmlintropage) ? htmlintropage : nil,
107
- scripts: defined?(scripts) ? scripts : nil,
108
- scripts_pdf: defined?(scripts_pdf) ? scripts_pdf : nil,
109
- wordstylesheet: defined?(wordstylesheet) ? wordstylesheet : nil,
110
- standardstylesheet: defined?(standardstylesheet) ? standardstylesheet : nil,
111
- header: defined?(header) ? header : nil,
112
- wordcoverpage: defined?(wordcoverpage) ? wordcoverpage : nil,
113
- wordintropage: defined?(wordintropage) ? wordintropage : nil,
114
- ulstyle: defined?(ulstyle) ? ulstyle : nil,
115
- olstyle: defined?(olstyle) ? olstyle : nil,
85
+ defined?(break_up) and
86
+ break_up = empty_attr(break_up, "break-up-urls-in-tables")
87
+ ret.merge({
116
88
  datauriimage: defined?(datauriimage) ? datauriimage != "false" : nil,
117
- htmltoclevels: defined?(htmltoclevels) ? htmltoclevels : nil,
118
- doctoclevels: defined?(doctoclevels) ? doctoclevels : nil,
119
89
  hierarchical_assets: defined?(hierarchical_assets) ? hierarchical_assets : nil,
120
90
  use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
121
- break_up_urls_in_tables: defined?(break_up_urls_in_tables) ? break_up_urls_in_tables : nil,
122
- }.reject { |_, val| val.nil? }
91
+ break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
92
+ }).reject { |_, val| val.nil? }
123
93
  end
124
94
 
125
95
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.2.5"
2
+ VERSION = "1.3.0".freeze
3
3
  end
data/metanorma.gemspec CHANGED
@@ -1,16 +1,15 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "metanorma/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "metanorma"
8
7
  spec.version = Metanorma::VERSION
9
- spec.authors = ['Ribose Inc.']
10
- spec.email = ['open.source@ribose.com']
8
+ spec.authors = ["Ribose Inc."]
9
+ spec.email = ["open.source@ribose.com"]
11
10
 
12
- spec.summary = %q{Metanorma is the standard of standards; the metanorma gem allows you to create any standard document type supported by Metanorma.}
13
- spec.description = %q{Library to process any Metanorma standard.}
11
+ spec.summary = "Metanorma is the standard of standards; the metanorma gem allows you to create any standard document type supported by Metanorma."
12
+ spec.description = "Library to process any Metanorma standard."
14
13
  spec.homepage = "https://github.com/metanorma/metanorma"
15
14
  spec.license = "BSD-2-Clause"
16
15
 
@@ -19,27 +18,28 @@ Gem::Specification.new do |spec|
19
18
  end
20
19
  spec.extra_rdoc_files = %w[README.adoc CHANGELOG.adoc LICENSE.txt]
21
20
  spec.bindir = "bin"
22
- #spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
22
  spec.require_paths = ["lib"]
24
- spec.required_ruby_version = '>= 2.4.0'
23
+ spec.required_ruby_version = ">= 2.4.0"
25
24
 
26
- spec.add_runtime_dependency 'asciidoctor'
27
- spec.add_runtime_dependency 'htmlentities'
28
- spec.add_runtime_dependency 'nokogiri'
29
- spec.add_runtime_dependency 'mn2pdf', "~> 1"
30
- spec.add_runtime_dependency 'metanorma-utils', "~> 1"
31
- spec.add_runtime_dependency 'pry'
32
- spec.add_runtime_dependency 'fontist', '~> 1.8'
25
+ spec.add_runtime_dependency "asciidoctor"
26
+ spec.add_runtime_dependency "fontist", "~> 1.8"
27
+ spec.add_runtime_dependency "htmlentities"
28
+ spec.add_runtime_dependency "metanorma-utils", "~> 1.2.0"
29
+ spec.add_runtime_dependency "mn2pdf", "~> 1"
30
+ spec.add_runtime_dependency "nokogiri"
31
+ spec.add_runtime_dependency "pry"
33
32
 
34
- # get relaton-cli to avoid circular reference with metanorma-standoc
35
- #spec.add_dependency "relaton-cli"
36
- #spec.add_dependency "metanorma-standoc"
33
+ # get relaton-cli to avoid circular reference with metanorma-standoc
34
+ # spec.add_dependency "relaton-cli"
35
+ # spec.add_dependency "metanorma-standoc"
37
36
 
38
- spec.add_development_dependency "rake", "~> 12.0"
39
- spec.add_development_dependency "rspec", "~> 3.0"
40
37
  spec.add_development_dependency "byebug", "~> 10.0"
41
- spec.add_development_dependency "rspec-command", "~> 1.0"
42
38
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
43
- spec.add_development_dependency "metanorma-iso", "~> 1.7.0"
39
+ spec.add_development_dependency "metanorma-iso", "~> 1.8.0"
40
+ spec.add_development_dependency "rake", "~> 13.0"
41
+ spec.add_development_dependency "rspec", "~> 3.0"
42
+ spec.add_development_dependency "rspec-command", "~> 1.0"
43
+ spec.add_development_dependency "rubocop", "~> 1.5.2"
44
44
  spec.add_development_dependency "sassc", "~> 2.4.0"
45
45
  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.5
4
+ version: 1.3.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: 2021-01-25 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -25,21 +25,21 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: htmlentities
28
+ name: fontist
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.8'
41
41
  - !ruby/object:Gem::Dependency
42
- name: nokogiri
42
+ name: htmlentities
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,21 +53,21 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: mn2pdf
56
+ name: metanorma-utils
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1'
61
+ version: 1.2.0
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: '1'
68
+ version: 1.2.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: metanorma-utils
70
+ name: mn2pdf
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: pry
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -95,103 +109,103 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: fontist
112
+ name: byebug
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '1.8'
104
- type: :runtime
117
+ version: '10.0'
118
+ type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '1.8'
124
+ version: '10.0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: rake
126
+ name: equivalent-xml
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: '12.0'
131
+ version: '0.6'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: '12.0'
138
+ version: '0.6'
125
139
  - !ruby/object:Gem::Dependency
126
- name: rspec
140
+ name: metanorma-iso
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '3.0'
145
+ version: 1.8.0
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '3.0'
152
+ version: 1.8.0
139
153
  - !ruby/object:Gem::Dependency
140
- name: byebug
154
+ name: rake
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '10.0'
159
+ version: '13.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: '10.0'
166
+ version: '13.0'
153
167
  - !ruby/object:Gem::Dependency
154
- name: rspec-command
168
+ name: rspec
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: '1.0'
173
+ version: '3.0'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: '1.0'
180
+ version: '3.0'
167
181
  - !ruby/object:Gem::Dependency
168
- name: equivalent-xml
182
+ name: rspec-command
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: '0.6'
187
+ version: '1.0'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: '0.6'
194
+ version: '1.0'
181
195
  - !ruby/object:Gem::Dependency
182
- name: metanorma-iso
196
+ name: rubocop
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: 1.7.0
201
+ version: 1.5.2
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: 1.7.0
208
+ version: 1.5.2
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: sassc
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -238,12 +252,15 @@ files:
238
252
  - lib/metanorma/asciidoctor_extensions.rb
239
253
  - lib/metanorma/asciidoctor_extensions/glob_include_processor.rb
240
254
  - lib/metanorma/collection.rb
255
+ - lib/metanorma/collection_fileparse.rb
241
256
  - lib/metanorma/collection_fileprocess.rb
242
257
  - lib/metanorma/collection_manifest.rb
243
258
  - lib/metanorma/collection_renderer.rb
244
259
  - lib/metanorma/compile.rb
260
+ - lib/metanorma/compile_validate.rb
245
261
  - lib/metanorma/config.rb
246
262
  - lib/metanorma/document.rb
263
+ - lib/metanorma/fontist_utils.rb
247
264
  - lib/metanorma/input.rb
248
265
  - lib/metanorma/input/asciidoc.rb
249
266
  - lib/metanorma/input/base.rb
@@ -276,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
293
  - !ruby/object:Gem::Version
277
294
  version: '0'
278
295
  requirements: []
279
- rubygems_version: 3.0.3
296
+ rubygems_version: 3.1.4
280
297
  signing_key:
281
298
  specification_version: 4
282
299
  summary: Metanorma is the standard of standards; the metanorma gem allows you to create