metanorma 1.2.6 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +11 -18
- data/.gitignore +2 -0
- data/.hound.yml +3 -1
- data/.rubocop.yml +8 -4
- data/Rakefile +1 -1
- data/lib/metanorma/asciidoctor_extensions/glob_include_processor.rb +4 -6
- data/lib/metanorma/collection.rb +13 -6
- data/lib/metanorma/collection_fileparse.rb +243 -0
- data/lib/metanorma/collection_fileprocess.rb +60 -220
- data/lib/metanorma/collection_manifest.rb +7 -4
- data/lib/metanorma/collection_renderer.rb +20 -4
- data/lib/metanorma/compile.rb +34 -117
- data/lib/metanorma/compile_validate.rb +45 -0
- data/lib/metanorma/config.rb +1 -1
- data/lib/metanorma/document.rb +24 -10
- data/lib/metanorma/fontist_utils.rb +108 -0
- data/lib/metanorma/input.rb +0 -1
- data/lib/metanorma/input/asciidoc.rb +21 -51
- data/lib/metanorma/output.rb +0 -2
- data/lib/metanorma/output/utils.rb +2 -1
- data/lib/metanorma/version.rb +1 -1
- data/metanorma.gemspec +22 -22
- metadata +51 -34
data/lib/metanorma/input.rb
CHANGED
@@ -61,65 +61,35 @@ module Metanorma
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def extract_options(file)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
/\n:
|
77
|
-
/\n:
|
78
|
-
/\n:
|
79
|
-
/\n:
|
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?(
|
96
|
-
|
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?(
|
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
|
data/lib/metanorma/output.rb
CHANGED
@@ -7,7 +7,8 @@ module Metanorma
|
|
7
7
|
def file_path(url_path)
|
8
8
|
file_url = url_path
|
9
9
|
file_url = "file://#{url_path}" if Pathname.new(file_url).absolute?
|
10
|
-
|
10
|
+
%r{^file://}.match?(file_url) or
|
11
|
+
file_url = "file://#{Dir.pwd}/#{url_path}"
|
11
12
|
file_url
|
12
13
|
end
|
13
14
|
end
|
data/lib/metanorma/version.rb
CHANGED
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 = [
|
10
|
-
spec.email = [
|
8
|
+
spec.authors = ["Ribose Inc."]
|
9
|
+
spec.email = ["open.source@ribose.com"]
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
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 =
|
23
|
+
spec.required_ruby_version = ">= 2.4.0"
|
25
24
|
|
26
|
-
spec.add_runtime_dependency
|
27
|
-
spec.add_runtime_dependency
|
28
|
-
spec.add_runtime_dependency
|
29
|
-
spec.add_runtime_dependency
|
30
|
-
spec.add_runtime_dependency
|
31
|
-
spec.add_runtime_dependency
|
32
|
-
spec.add_runtime_dependency
|
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.
|
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
|
4
|
+
version: 1.3.2
|
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-
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fontist
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: htmlentities
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +53,19 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: metanorma-utils
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 1.2.0
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 1.2.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: mn2pdf
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +81,19 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '1'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: nokogiri
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: '0'
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
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:
|
112
|
+
name: byebug
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
104
|
-
type: :
|
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: '
|
124
|
+
version: '10.0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: equivalent-xml
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
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: '
|
138
|
+
version: '0.6'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
140
|
+
name: metanorma-iso
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
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:
|
152
|
+
version: 1.8.0
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: rake
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
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: '
|
166
|
+
version: '13.0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
|
-
name: rspec
|
168
|
+
name: rspec
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
171
|
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
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: '
|
180
|
+
version: '3.0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
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
|
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
|
194
|
+
version: '1.0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
196
|
+
name: rubocop
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
199
|
- - "~>"
|
186
200
|
- !ruby/object:Gem::Version
|
187
|
-
version: 1.
|
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.
|
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
|