metanorma 0.3.12 → 0.3.13
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/.gitignore +7 -0
- data/Gemfile.lock +1 -1
- data/bin/metanorma-pdf.js +4 -2
- data/bin/rspec +29 -0
- data/lib/metanorma/compile.rb +1 -2
- data/lib/metanorma/output/pdf.rb +12 -5
- data/lib/metanorma/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49d9fbd197f12d48e473b402e1f096cfa3715fb7460519488e48c79d0b47478e
|
4
|
+
data.tar.gz: 4761f5e9d7ee578078268c1597b2a91f2d66a5de913a9fce55ababde3336e254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1695dc7f3bde1cc1e9a8cb0e0127de58ee8cb0d15549a56acc6508702c2553064936fca4b0e89ffed2a7fd30d6744b47a62724a1dfda1baaf90e875e2ccb409
|
7
|
+
data.tar.gz: 9be90059163824f997045b7b50039d203a91b485edfe7b76acfd69e6b4f708d0bcc2d9e7943ce25b40b6e41071663637918f6ae8ef70bade6388a06d097824a9
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/bin/metanorma-pdf.js
CHANGED
@@ -5,6 +5,7 @@ const puppeteer = require('puppeteer');
|
|
5
5
|
|
6
6
|
const createPdf = async() => {
|
7
7
|
let browser;
|
8
|
+
let exitCode = 0;
|
8
9
|
try {
|
9
10
|
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
|
10
11
|
const page = await browser.newPage();
|
@@ -14,12 +15,13 @@ const createPdf = async() => {
|
|
14
15
|
format: 'A4'
|
15
16
|
});
|
16
17
|
} catch (err) {
|
17
|
-
console.
|
18
|
+
console.error(err.message);
|
19
|
+
exitCode = 1
|
18
20
|
} finally {
|
19
21
|
if (browser) {
|
20
22
|
browser.close();
|
21
23
|
}
|
22
|
-
process.exit();
|
24
|
+
process.exit(exitCode);
|
23
25
|
}
|
24
26
|
};
|
25
27
|
createPdf();
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/lib/metanorma/compile.rb
CHANGED
@@ -52,8 +52,7 @@ module Metanorma
|
|
52
52
|
end
|
53
53
|
stdtype = options[:type].to_sym
|
54
54
|
unless @registry.supported_backends.include? stdtype
|
55
|
-
Util.log("[metanorma]
|
56
|
-
Util.log("metanorma] Info: Attempting to load `metanorma-#{stdtype}` gem for standard type `#{stdtype}`.", :info)
|
55
|
+
Util.log("[metanorma] Info: Loading `metanorma-#{stdtype}` gem for standard type `#{stdtype}`.", :info)
|
57
56
|
end
|
58
57
|
begin
|
59
58
|
require "metanorma-#{stdtype}"
|
data/lib/metanorma/output/pdf.rb
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
+
require "open3"
|
2
|
+
require "pathname"
|
3
|
+
|
1
4
|
module Metanorma
|
2
5
|
module Output
|
3
6
|
class Pdf < Base
|
4
7
|
|
5
8
|
def convert(url_path, output_path)
|
6
9
|
file_url = url_path
|
7
|
-
file_url = "file://#{url_path}" if
|
8
|
-
file_url = "file://#{Dir.pwd}/#{url_path}" unless %r{^file://}
|
9
|
-
pdfjs = File.join(File.dirname(__FILE__),
|
10
|
-
|
11
|
-
|
10
|
+
file_url = "file://#{url_path}" if Pathname.new(file_url).absolute?
|
11
|
+
file_url = "file://#{Dir.pwd}/#{url_path}" unless %r{^file://} =~ file_url
|
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].join(" ")
|
16
|
+
|
17
|
+
_, error_str, status = Open3.capture3({ "NODE_PATH" => node_path }, node_cmd)
|
18
|
+
raise error_str unless status.success?
|
12
19
|
end
|
13
20
|
end
|
14
21
|
end
|
data/lib/metanorma/version.rb
CHANGED
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: 0.3.
|
4
|
+
version: 0.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- bin/console
|
163
163
|
- bin/metanorma-pdf.js
|
164
164
|
- bin/rasterize.js
|
165
|
+
- bin/rspec
|
165
166
|
- bin/setup
|
166
167
|
- lib/metanorma.rb
|
167
168
|
- lib/metanorma/asciidoctor_extensions.rb
|
@@ -200,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
201
|
version: '0'
|
201
202
|
requirements: []
|
202
203
|
rubyforge_project:
|
203
|
-
rubygems_version: 2.7.
|
204
|
+
rubygems_version: 2.7.6
|
204
205
|
signing_key:
|
205
206
|
specification_version: 4
|
206
207
|
summary: Metanorma is the standard of standards; the metanorma gem allows you to create
|