metanorma 1.3.4 → 1.3.8
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 +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/.rubocop.yml +1 -1
- data/Gemfile +2 -2
- data/lib/metanorma.rb +0 -1
- data/lib/metanorma/collection.rb +7 -1
- data/lib/metanorma/collection_fileparse.rb +65 -47
- data/lib/metanorma/collection_fileprocess.rb +123 -23
- data/lib/metanorma/collection_manifest.rb +36 -11
- data/lib/metanorma/collection_renderer.rb +50 -14
- data/lib/metanorma/compile.rb +81 -63
- data/lib/metanorma/document.rb +12 -5
- data/lib/metanorma/input/asciidoc.rb +2 -2
- data/lib/metanorma/processor.rb +3 -6
- data/lib/metanorma/sectionsplit.rb +270 -0
- data/lib/metanorma/util.rb +43 -2
- data/lib/metanorma/version.rb +1 -1
- data/metanorma.gemspec +4 -3
- metadata +22 -12
- data/lib/metanorma/output.rb +0 -8
- data/lib/metanorma/output/base.rb +0 -13
- data/lib/metanorma/output/pdf.rb +0 -32
- data/lib/metanorma/output/utils.rb +0 -17
- data/lib/metanorma/output/xslfo.rb +0 -21
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.3.
|
4
|
+
version: 1.3.8
|
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-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.9.0
|
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:
|
40
|
+
version: 1.9.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: htmlentities
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.9.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: 1.
|
152
|
+
version: 1.9.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rake
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +220,20 @@ dependencies:
|
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 2.4.0
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: mnconvert
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
223
237
|
description: Library to process any Metanorma standard.
|
224
238
|
email:
|
225
239
|
- open.source@ribose.com
|
@@ -264,13 +278,9 @@ files:
|
|
264
278
|
- lib/metanorma/input.rb
|
265
279
|
- lib/metanorma/input/asciidoc.rb
|
266
280
|
- lib/metanorma/input/base.rb
|
267
|
-
- lib/metanorma/output.rb
|
268
|
-
- lib/metanorma/output/base.rb
|
269
|
-
- lib/metanorma/output/pdf.rb
|
270
|
-
- lib/metanorma/output/utils.rb
|
271
|
-
- lib/metanorma/output/xslfo.rb
|
272
281
|
- lib/metanorma/processor.rb
|
273
282
|
- lib/metanorma/registry.rb
|
283
|
+
- lib/metanorma/sectionsplit.rb
|
274
284
|
- lib/metanorma/util.rb
|
275
285
|
- lib/metanorma/version.rb
|
276
286
|
- metanorma.gemspec
|
@@ -286,7 +296,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
286
296
|
requirements:
|
287
297
|
- - ">="
|
288
298
|
- !ruby/object:Gem::Version
|
289
|
-
version: 2.
|
299
|
+
version: 2.5.0
|
290
300
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
291
301
|
requirements:
|
292
302
|
- - ">="
|
data/lib/metanorma/output.rb
DELETED
data/lib/metanorma/output/pdf.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require "open3"
|
2
|
-
require_relative "./utils.rb"
|
3
|
-
require "pathname"
|
4
|
-
require "shellwords"
|
5
|
-
|
6
|
-
module Metanorma
|
7
|
-
module Output
|
8
|
-
class Pdf < Base
|
9
|
-
|
10
|
-
def convert(url_path, output_path)
|
11
|
-
file_url = Utils::file_path(url_path)
|
12
|
-
pdfjs = File.join(File.dirname(__FILE__), "../../../bin/metanorma-pdf.js")
|
13
|
-
|
14
|
-
node_path = ENV["NODE_PATH"] || `npm root --quiet -g`.strip
|
15
|
-
node_cmd = ["node", pdfjs, file_url, output_path].map { |arg| shellescape(arg) }.join(" ")
|
16
|
-
|
17
|
-
_, error_str, status = Open3.capture3({ "NODE_PATH" => node_path }, node_cmd)
|
18
|
-
raise error_str unless status.success?
|
19
|
-
end
|
20
|
-
|
21
|
-
def shellescape(str)
|
22
|
-
if Gem.win_platform?()
|
23
|
-
# https://bugs.ruby-lang.org/issues/16741
|
24
|
-
str.match(" ") ? "\"#{str}\"" : str
|
25
|
-
else
|
26
|
-
Shellwords.shellescape(str)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require "pathname"
|
2
|
-
|
3
|
-
module Metanorma
|
4
|
-
module Output
|
5
|
-
module Utils
|
6
|
-
class << self
|
7
|
-
def file_path(url_path)
|
8
|
-
file_url = url_path
|
9
|
-
file_url = "file://#{url_path}" if Pathname.new(file_url).absolute?
|
10
|
-
%r{^file://}.match?(file_url) or
|
11
|
-
file_url = "file://#{Dir.pwd}/#{url_path}"
|
12
|
-
file_url
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'mn2pdf'
|
2
|
-
require_relative "./utils.rb"
|
3
|
-
|
4
|
-
module Metanorma
|
5
|
-
module Output
|
6
|
-
class XslfoPdf < Base
|
7
|
-
def convert(url_path, output_path, xsl_stylesheet, options = "")
|
8
|
-
return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
|
9
|
-
|
10
|
-
Mn2pdf.convert(quote(url_path), quote(output_path), quote(xsl_stylesheet), options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def quote(x)
|
14
|
-
return x if /^'.*'$/.match(x)
|
15
|
-
return x if /^".*"$/.match(x)
|
16
|
-
%("#{x}")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|