metanorma 0.3.2 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59c1e77fc3df934cbf3512262e9bcf280272db2489dbc640c2f508365b03589f
4
- data.tar.gz: 0be23070d766e7531e2d60c49db7b788d0800b0b23548a77c32891135b833ed7
3
+ metadata.gz: 81a9d0206754ec2f1d456dc7812e54b05b5f74055025e723ba003af362d78380
4
+ data.tar.gz: 3b306cb4f28c937b46ebb2308f7fcf546c89493ee9eff2aad29140b6a5c3e583
5
5
  SHA512:
6
- metadata.gz: 5d4d1525a4a6917ef045806b05b2e8b2656ee9d3778e66e6748fffa30fa5584ac2225992edadf80a141dd98d50b2792def8b2069a15533db56d8e1dbc937a0c3
7
- data.tar.gz: d045217e6895b936b86bf420bbe08ccc66fba36be294798fb341f5dc0ec0ad296f2fa58bc9d6fba9de33a70732b462bf86bb375cee31d473f05f9f3c27eb25b4
6
+ metadata.gz: c173af8b2eff9547b2c7d17a54426f89dee53a030e717866f40ab5c5b2cf35092988a65a1df7681636897d2d07e5291ec7717a8d72bd4b4b2daac796970767b6
7
+ data.tar.gz: b71ac8b84f2de84828530e89d9df566ed0e2bc111b9254de3fb223b65573e495ae0f814d247fa17083d8861de4105b5cc2ce05c4b7b1ff0d57433131fc509ca5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metanorma (0.3.2)
4
+ metanorma (0.3.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,29 @@
1
+ version: '{build}'
2
+
3
+ environment:
4
+ matrix:
5
+ - RUBY_VERSION: 25
6
+ - RUBY_VERSION: 24
7
+ - RUBY_VERSION: 23
8
+ - RUBY_VERSION: _trunk
9
+
10
+ matrix:
11
+ allow_failures:
12
+ - RUBY_VERSION: _trunk
13
+
14
+ install:
15
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
16
+ - gem install bundler -v 1.16.1
17
+ - npm install -g puppeteer
18
+ - npm install
19
+ - bundle install
20
+
21
+ build: off
22
+
23
+ before_test:
24
+ - ruby -v
25
+ - gem -v
26
+ - bundle -v
27
+
28
+ test_script:
29
+ - bundle exec rake
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var page = require('webpage').create(),
3
+ system = require('system'),
4
+ address, output, size, pageWidth, pageHeight;
5
+
6
+ if (system.args.length < 3 || system.args.length > 5) {
7
+ console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]');
8
+ console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"');
9
+ console.log(' image (png/jpg output) examples: "1920px" entire page, window width 1920px');
10
+ console.log(' "800px*600px" window, clipped to 800x600');
11
+ phantom.exit(1);
12
+ } else {
13
+ address = system.args[1];
14
+ output = system.args[2];
15
+ page.viewportSize = { width: 600, height: 600 };
16
+ if (system.args.length > 3 && system.args[2].substr(-4) === ".pdf") {
17
+ size = system.args[3].split('*');
18
+ page.paperSize = size.length === 2 ? { width: size[0], height: size[1], margin: '0px' }
19
+ : { format: system.args[3], orientation: 'portrait', margin: '1cm' };
20
+ } else if (system.args.length > 3 && system.args[3].substr(-2) === "px") {
21
+ size = system.args[3].split('*');
22
+ if (size.length === 2) {
23
+ pageWidth = parseInt(size[0], 10);
24
+ pageHeight = parseInt(size[1], 10);
25
+ page.viewportSize = { width: pageWidth, height: pageHeight };
26
+ page.clipRect = { top: 0, left: 0, width: pageWidth, height: pageHeight };
27
+ } else {
28
+ console.log("size:", system.args[3]);
29
+ pageWidth = parseInt(system.args[3], 10);
30
+ pageHeight = parseInt(pageWidth * 3/4, 10); // it's as good an assumption as any
31
+ console.log ("pageHeight:",pageHeight);
32
+ page.viewportSize = { width: pageWidth, height: pageHeight };
33
+ }
34
+ }
35
+ if (system.args.length > 4) {
36
+ page.zoomFactor = system.args[4];
37
+ }
38
+ page.open(address, function (status) {
39
+ if (status !== 'success') {
40
+ console.log('Unable to load the address!');
41
+ phantom.exit(1);
42
+ } else {
43
+ window.setTimeout(function () {
44
+ page.render(output);
45
+ phantom.exit();
46
+ }, 200);
47
+ }
48
+ });
49
+ }
@@ -5,10 +5,12 @@ module Metanorma
5
5
  def convert(url_path, output_path)
6
6
  file_url = "file://#{Dir.pwd}/#{url_path}"
7
7
  pdfjs = File.join(File.dirname(__FILE__), '../../../bin/metanorma-pdf.js')
8
- system "export NODE_PATH=$(npm root --quiet -g);
9
- node #{pdfjs} #{file_url} #{output_path}"
8
+ ENV['NODE_PATH'] = `npm root --quiet -g`.strip
9
+ system "node #{pdfjs} #{file_url} #{output_path}"
10
+ #Phantomjs.path
11
+ #pdfjs = File.join(File.dirname(__FILE__), "../../../bin/rasterize.js")
12
+ #Phantomjs.run(pdfjs, file_url, output_path, "A4")
10
13
  end
11
-
12
14
  end
13
15
  end
14
16
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -30,5 +30,4 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "byebug", "~> 10.0"
31
31
  spec.add_development_dependency "rspec-command", "~> 1.0.3"
32
32
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
33
-
34
33
  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: 0.3.2
4
+ version: 0.3.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: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2018-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -116,8 +116,10 @@ files:
116
116
  - LICENSE.txt
117
117
  - README.adoc
118
118
  - Rakefile
119
+ - appveyor.yml
119
120
  - bin/console
120
121
  - bin/metanorma-pdf.js
122
+ - bin/rasterize.js
121
123
  - bin/setup
122
124
  - lib/metanorma.rb
123
125
  - lib/metanorma/document.rb