metanorma 1.0.2 → 1.0.3
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/macos.yml +2 -2
- data/.github/workflows/ubuntu.yml +2 -2
- data/.github/workflows/windows.yml +2 -2
- data/bin/mn2pdf.jar +0 -0
- data/lib/metanorma/output.rb +1 -0
- data/lib/metanorma/output/pdf.rb +2 -3
- data/lib/metanorma/output/utils.rb +16 -0
- data/lib/metanorma/output/xslfo.rb +19 -0
- data/lib/metanorma/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17965bd6b4a4f5f6bc620947633b3286e938812e0fab3a8e71b92eb8651120a8
|
4
|
+
data.tar.gz: ea9f2b8b5db24dff0c95351747daf35d3de9c7dbe010657e2bc5eae655fc1c78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9afa1bd9a2b75a8d7fc409899220b7a3460fabfebd739aa0263f557d55d93f27deb8dc1bd96fa4d6f57b23a9200510e239f2c33b79678d48e5b9eab41e783f7c
|
7
|
+
data.tar.gz: 7e787898c91da56beb6da5fa575c1e0b2c988265e88d42f835a5b281f0894f3dfa83f42c0c5011a6436b6bc0b9ef169ef9906bfdb88896da3426ebd2b3cc5c54
|
data/.github/workflows/macos.yml
CHANGED
@@ -29,10 +29,10 @@ jobs:
|
|
29
29
|
- name: Use Node
|
30
30
|
uses: actions/setup-node@v1
|
31
31
|
with:
|
32
|
-
node-version: '
|
32
|
+
node-version: '12'
|
33
33
|
- name: Install Puppeteer
|
34
34
|
run: |
|
35
|
-
npm install -g puppeteer
|
35
|
+
npm install -g puppeteer@3.0.0
|
36
36
|
- name: Run specs
|
37
37
|
run: |
|
38
38
|
bundle exec rake
|
@@ -29,10 +29,10 @@ jobs:
|
|
29
29
|
- name: Use Node
|
30
30
|
uses: actions/setup-node@v1
|
31
31
|
with:
|
32
|
-
node-version: '
|
32
|
+
node-version: '12'
|
33
33
|
- name: Install Puppeteer
|
34
34
|
run: |
|
35
|
-
npm install -g puppeteer
|
35
|
+
npm install -g puppeteer@3.0.0
|
36
36
|
- name: Run specs
|
37
37
|
run: |
|
38
38
|
bundle exec rake
|
@@ -31,10 +31,10 @@ jobs:
|
|
31
31
|
- name: Use Node
|
32
32
|
uses: actions/setup-node@v1
|
33
33
|
with:
|
34
|
-
node-version: '
|
34
|
+
node-version: '12'
|
35
35
|
- name: Install Puppeteer
|
36
36
|
run: |
|
37
|
-
npm install -g puppeteer
|
37
|
+
npm install -g puppeteer@3.0.0
|
38
38
|
- name: Run specs
|
39
39
|
run: |
|
40
40
|
bundle exec rake
|
data/bin/mn2pdf.jar
ADDED
Binary file
|
data/lib/metanorma/output.rb
CHANGED
data/lib/metanorma/output/pdf.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "open3"
|
2
|
+
require_relative "./utils.rb"
|
2
3
|
require "pathname"
|
3
4
|
require "shellwords"
|
4
5
|
|
@@ -7,9 +8,7 @@ module Metanorma
|
|
7
8
|
class Pdf < Base
|
8
9
|
|
9
10
|
def convert(url_path, output_path)
|
10
|
-
file_url = url_path
|
11
|
-
file_url = "file://#{url_path}" if Pathname.new(file_url).absolute?
|
12
|
-
file_url = "file://#{Dir.pwd}/#{url_path}" unless %r{^file://} =~ file_url
|
11
|
+
file_url = Utils::file_path(url_path)
|
13
12
|
pdfjs = File.join(File.dirname(__FILE__), "../../../bin/metanorma-pdf.js")
|
14
13
|
|
15
14
|
node_path = ENV["NODE_PATH"] || `npm root --quiet -g`.strip
|
@@ -0,0 +1,16 @@
|
|
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
|
+
file_url = "file://#{Dir.pwd}/#{url_path}" unless %r{^file://} =~ file_url
|
11
|
+
file_url
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "open3"
|
2
|
+
require "tempfile"
|
3
|
+
require_relative "./utils.rb"
|
4
|
+
|
5
|
+
module Metanorma
|
6
|
+
module Output
|
7
|
+
class XslfoPdf < Base
|
8
|
+
def convert(url_path, output_path, xsl_stylesheet)
|
9
|
+
return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
|
10
|
+
pdfjar = File.join(File.dirname(__FILE__), "../../../bin/mn2pdf.jar")
|
11
|
+
cmd = ["java", "-jar", pdfjar, "--xml-file", url_path, "--xsl-file",
|
12
|
+
xsl_stylesheet, "--pdf-file", output_path].join(" ")
|
13
|
+
_, error_str, status = Open3.capture3(cmd)
|
14
|
+
raise error_str unless status.success?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
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: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-21 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
|
- Rakefile
|
163
163
|
- bin/console
|
164
164
|
- bin/metanorma-pdf.js
|
165
|
+
- bin/mn2pdf.jar
|
165
166
|
- bin/rasterize.js
|
166
167
|
- bin/rspec
|
167
168
|
- bin/setup
|
@@ -177,6 +178,8 @@ files:
|
|
177
178
|
- lib/metanorma/output.rb
|
178
179
|
- lib/metanorma/output/base.rb
|
179
180
|
- lib/metanorma/output/pdf.rb
|
181
|
+
- lib/metanorma/output/utils.rb
|
182
|
+
- lib/metanorma/output/xslfo.rb
|
180
183
|
- lib/metanorma/processor.rb
|
181
184
|
- lib/metanorma/registry.rb
|
182
185
|
- lib/metanorma/util.rb
|