metanorma 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5afd8795a47a00890fd05c762db66dfdb4803e8a3e7279b5c25fc579094a4824
4
- data.tar.gz: 21af01a41736b2c7b8a521d9489323c3a4ef2273670546acd898d9820445eaf0
3
+ metadata.gz: 17965bd6b4a4f5f6bc620947633b3286e938812e0fab3a8e71b92eb8651120a8
4
+ data.tar.gz: ea9f2b8b5db24dff0c95351747daf35d3de9c7dbe010657e2bc5eae655fc1c78
5
5
  SHA512:
6
- metadata.gz: 0715b1527df4e4e3169f176c9301a1c6cec2fe0a72a46c61613d45addc11186d81a8f2400c65aa395e01721870f94e081706a935480d5e87c638e10f484afd70
7
- data.tar.gz: d47bdf3f165768070fd249fa7f1bbb5e6f65305c345f4848ba7dd03820ae1729f3dde273986cd5d5e03c1f218f73da444387b19705399d50805b300d43991829
6
+ metadata.gz: 9afa1bd9a2b75a8d7fc409899220b7a3460fabfebd739aa0263f557d55d93f27deb8dc1bd96fa4d6f57b23a9200510e239f2c33b79678d48e5b9eab41e783f7c
7
+ data.tar.gz: 7e787898c91da56beb6da5fa575c1e0b2c988265e88d42f835a5b281f0894f3dfa83f42c0c5011a6436b6bc0b9ef169ef9906bfdb88896da3426ebd2b3cc5c54
@@ -29,10 +29,10 @@ jobs:
29
29
  - name: Use Node
30
30
  uses: actions/setup-node@v1
31
31
  with:
32
- node-version: '8'
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: '8'
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: '8'
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
Binary file
@@ -1,5 +1,6 @@
1
1
  require_relative "./output/base"
2
2
  require_relative "./output/pdf"
3
+ require_relative "./output/xslfo"
3
4
 
4
5
  module Metanorma
5
6
  module Output
@@ -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
+
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  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.0.2
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-17 00:00:00.000000000 Z
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