metanorma 1.2.8 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,69 +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:htmlstylesheet-override: (?<htmlstylesheet_override>[^\n]+)\n/ =~ headerextract
74
- /\n:htmlcoverpage: (?<htmlcoverpage>[^\n]+)\n/ =~ headerextract
75
- /\n:htmlintropage: (?<htmlintropage>[^\n]+)\n/ =~ headerextract
76
- /\n:scripts: (?<scripts>[^\n]+)\n/ =~ headerextract
77
- /\n:scripts-pdf: (?<scripts_pdf>[^\n]+)\n/ =~ headerextract
78
- /\n:wordstylesheet: (?<wordstylesheet>[^\n]+)\n/ =~ headerextract
79
- /\n:wordstylesheet-override: (?<wordstylesheet_override>[^\n]+)\n/ =~ headerextract
80
- /\n:standardstylesheet: (?<standardstylesheet>[^\n]+)\n/ =~ headerextract
81
- /\n:header: (?<header>[^\n]+)\n/ =~ headerextract
82
- /\n:wordcoverpage: (?<wordcoverpage>[^\n]+)\n/ =~ headerextract
83
- /\n:wordintropage: (?<wordintropage>[^\n]+)\n/ =~ headerextract
84
- /\n:ulstyle: (?<ulstyle>[^\n]+)\n/ =~ headerextract
85
- /\n:olstyle: (?<olstyle>[^\n]+)\n/ =~ headerextract
86
- /\n:data-uri-image: (?<datauriimage>[^\n]+)\n/ =~ headerextract
87
- /\n:htmltoclevels: (?<htmltoclevels>[^\n]+)\n/ =~ headerextract
88
- /\n:doctoclevels: (?<doctoclevels>[^\n]+)\n/ =~ headerextract
89
- /\n:(?<hierarchical_assets>hierarchical-assets:[^\n]*)\n/ =~ headerextract
90
- /\n:(?<use_xinclude>use-xinclude:[^\n]*)\n/ =~ headerextract
91
- /\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
92
80
 
93
81
  defined?(hierarchical_assets) and
94
82
  hierarchical_assets = empty_attr(hierarchical_assets, "hierarchical-assets")
95
83
  defined?(use_xinclude) and
96
84
  use_xinclude = empty_attr(use_xinclude, "use-xinclude")
97
- defined?(break_up_urls_in_tables) and
98
- break_up_urls_in_tables = empty_attr(break_up_urls_in_tables, "break-up-urls-in-tables")
99
- {
100
- script: defined?(script) ? script : nil,
101
- bodyfont: defined?(bodyfont) ? bodyfont : nil,
102
- headerfont: defined?(headerfont) ? headerfont : nil,
103
- monospacefont: defined?(monospacefont) ? monospacefont : nil,
104
- titlefont: defined?(titlefont) ? titlefont : nil,
105
- i18nyaml: defined?(i18nyaml) ? i18nyaml : nil,
106
- htmlstylesheet: defined?(htmlstylesheet) ? htmlstylesheet : nil,
107
- htmlstylesheet_override: defined?(htmlstylesheet_override) ? htmlstylesheet_override : nil,
108
- htmlcoverpage: defined?(htmlcoverpage) ? htmlcoverpage : nil,
109
- htmlintropage: defined?(htmlintropage) ? htmlintropage : nil,
110
- scripts: defined?(scripts) ? scripts : nil,
111
- scripts_pdf: defined?(scripts_pdf) ? scripts_pdf : nil,
112
- wordstylesheet: defined?(wordstylesheet) ? wordstylesheet : nil,
113
- wordstylesheet_override: defined?(wordstylesheet_override) ? wordstylesheet_override : nil,
114
- standardstylesheet: defined?(standardstylesheet) ? standardstylesheet : nil,
115
- header: defined?(header) ? header : nil,
116
- wordcoverpage: defined?(wordcoverpage) ? wordcoverpage : nil,
117
- wordintropage: defined?(wordintropage) ? wordintropage : nil,
118
- ulstyle: defined?(ulstyle) ? ulstyle : nil,
119
- 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({
120
88
  datauriimage: defined?(datauriimage) ? datauriimage != "false" : nil,
121
- htmltoclevels: defined?(htmltoclevels) ? htmltoclevels : nil,
122
- doctoclevels: defined?(doctoclevels) ? doctoclevels : nil,
123
89
  hierarchical_assets: defined?(hierarchical_assets) ? hierarchical_assets : nil,
124
90
  use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
125
- break_up_urls_in_tables: defined?(break_up_urls_in_tables) ? break_up_urls_in_tables : nil,
126
- }.reject { |_, val| val.nil? }
91
+ break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
92
+ }).reject { |_, val| val.nil? }
127
93
  end
128
94
 
129
95
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.2.8"
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,28 +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.1.0"
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
 
37
+ spec.add_development_dependency "byebug", "~> 10.0"
38
+ spec.add_development_dependency "equivalent-xml", "~> 0.6"
39
+ spec.add_development_dependency "metanorma-iso", "~> 1.8.0"
38
40
  spec.add_development_dependency "rake", "~> 13.0"
39
41
  spec.add_development_dependency "rspec", "~> 3.0"
40
- spec.add_development_dependency "byebug", "~> 10.0"
41
42
  spec.add_development_dependency "rspec-command", "~> 1.0"
42
- spec.add_development_dependency "equivalent-xml", "~> 0.6"
43
- spec.add_development_dependency "metanorma-iso", "~> 1.7.0"
44
- spec.add_development_dependency "sassc", "~> 2.4.0"
45
43
  spec.add_development_dependency "rubocop", "~> 1.5.2"
44
+ spec.add_development_dependency "sassc", "~> 2.4.0"
46
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.8
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-03-29 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,35 +53,35 @@ 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
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.1.0
75
+ version: '1'
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.1.0
82
+ version: '1'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pry
84
+ name: nokogiri
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,131 +95,131 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: fontist
98
+ name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '1.8'
103
+ version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '1.8'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rake
112
+ name: byebug
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '13.0'
117
+ version: '10.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '13.0'
124
+ version: '10.0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rspec
126
+ name: equivalent-xml
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '3.0'
131
+ version: '0.6'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '3.0'
138
+ version: '0.6'
139
139
  - !ruby/object:Gem::Dependency
140
- name: byebug
140
+ name: metanorma-iso
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '10.0'
145
+ version: 1.8.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '10.0'
152
+ version: 1.8.0
153
153
  - !ruby/object:Gem::Dependency
154
- name: rspec-command
154
+ name: rake
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.0'
159
+ version: '13.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: '1.0'
166
+ version: '13.0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: equivalent-xml
168
+ name: rspec
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '0.6'
173
+ version: '3.0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '0.6'
180
+ version: '3.0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: metanorma-iso
182
+ name: rspec-command
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 1.7.0
187
+ version: '1.0'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 1.7.0
194
+ version: '1.0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: sassc
196
+ name: rubocop
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 2.4.0
201
+ version: 1.5.2
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 2.4.0
208
+ version: 1.5.2
209
209
  - !ruby/object:Gem::Dependency
210
- name: rubocop
210
+ name: sassc
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 1.5.2
215
+ version: 2.4.0
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 1.5.2
222
+ version: 2.4.0
223
223
  description: Library to process any Metanorma standard.
224
224
  email:
225
225
  - open.source@ribose.com
@@ -252,12 +252,15 @@ files:
252
252
  - lib/metanorma/asciidoctor_extensions.rb
253
253
  - lib/metanorma/asciidoctor_extensions/glob_include_processor.rb
254
254
  - lib/metanorma/collection.rb
255
+ - lib/metanorma/collection_fileparse.rb
255
256
  - lib/metanorma/collection_fileprocess.rb
256
257
  - lib/metanorma/collection_manifest.rb
257
258
  - lib/metanorma/collection_renderer.rb
258
259
  - lib/metanorma/compile.rb
260
+ - lib/metanorma/compile_validate.rb
259
261
  - lib/metanorma/config.rb
260
262
  - lib/metanorma/document.rb
263
+ - lib/metanorma/fontist_utils.rb
261
264
  - lib/metanorma/input.rb
262
265
  - lib/metanorma/input/asciidoc.rb
263
266
  - lib/metanorma/input/base.rb