metanorma 1.0.3 → 1.0.4

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: 17965bd6b4a4f5f6bc620947633b3286e938812e0fab3a8e71b92eb8651120a8
4
- data.tar.gz: ea9f2b8b5db24dff0c95351747daf35d3de9c7dbe010657e2bc5eae655fc1c78
3
+ metadata.gz: 7aa08613809fac5ac67ed1e4e1b4b448e6891105eb10e3424229bbae689f247b
4
+ data.tar.gz: 742700dda1a2c119b92b6a0839bffd82cf63017da4f675e4897f684f30e579ba
5
5
  SHA512:
6
- metadata.gz: 9afa1bd9a2b75a8d7fc409899220b7a3460fabfebd739aa0263f557d55d93f27deb8dc1bd96fa4d6f57b23a9200510e239f2c33b79678d48e5b9eab41e783f7c
7
- data.tar.gz: 7e787898c91da56beb6da5fa575c1e0b2c988265e88d42f835a5b281f0894f3dfa83f42c0c5011a6436b6bc0b9ef169ef9906bfdb88896da3426ebd2b3cc5c54
6
+ metadata.gz: 37b584bde8e92687cc7ff797076994c913125ea361ce94c9c1bca6c83e399735bdd0415968f20bf2f5941d53c7bc8dafbf71b02394e21dfb42256335aa125f09
7
+ data.tar.gz: 8bba4bf99743f9d843301402f8e09b5a145794c5509124ad258fcc4769ed55e3764c57f95734fcd65a5a3a25a2c91890300727d75d0f20298f98716dfac1d860
@@ -32,7 +32,7 @@ jobs:
32
32
  node-version: '12'
33
33
  - name: Install Puppeteer
34
34
  run: |
35
- npm install -g puppeteer@3.0.0
35
+ npm install -g puppeteer@3.0.1
36
36
  - name: Run specs
37
37
  run: |
38
38
  bundle exec rake
@@ -32,7 +32,9 @@ jobs:
32
32
  node-version: '12'
33
33
  - name: Install Puppeteer
34
34
  run: |
35
- npm install -g puppeteer@3.0.0
35
+ sudo apt-get update
36
+ sudo apt-get install libgbm1
37
+ npm install -g puppeteer@3.0.1
36
38
  - name: Run specs
37
39
  run: |
38
40
  bundle exec rake
@@ -34,7 +34,7 @@ jobs:
34
34
  node-version: '12'
35
35
  - name: Install Puppeteer
36
36
  run: |
37
- npm install -g puppeteer@3.0.0
37
+ npm install -g puppeteer@3.0.1
38
38
  - name: Run specs
39
39
  run: |
40
40
  bundle exec rake
data/bin/mn2pdf.jar CHANGED
Binary file
@@ -32,6 +32,7 @@ module Metanorma
32
32
  xml = Nokogiri::XML(file)
33
33
  if xml.root
34
34
  @registry.root_tags.each do |k, v|
35
+ STDERR.puts "k(#{k}), v(#{v})"
35
36
  return { type: k } if v == xml.root.name
36
37
  end
37
38
  end
@@ -205,7 +206,11 @@ module Metanorma
205
206
  options[:relaton] = outfilename
206
207
  relaton_export(isodoc, options)
207
208
  else
209
+ begin
208
210
  @processor.output(isodoc, outfilename, ext, isodoc_options)
211
+ rescue StandardError => e
212
+ puts e.message
213
+ end
209
214
  end
210
215
  if options[:wrapper] and /html$/.match file_extension
211
216
  outfilename = outfilename.sub(/\.html$/, "")
@@ -34,6 +34,10 @@ module Metanorma
34
34
  }.reject { |_, val| val.nil? }
35
35
  end
36
36
 
37
+ def empty_attr(attr, name)
38
+ attr&.sub(/^#{name}:\s*$/, "#{name}: true")&.sub(/^#{name}:\s+/, "")
39
+ end
40
+
37
41
  def extract_options(file)
38
42
  headerextract = file.sub(/\n\n.*$/m, "\n")
39
43
 
@@ -58,8 +62,16 @@ module Metanorma
58
62
  /\n:data-uri-image: (?<datauriimage>[^\n]+)\n/ =~ headerextract
59
63
  /\n:htmltoclevels: (?<htmltoclevels>[^\n]+)\n/ =~ headerextract
60
64
  /\n:doctoclevels: (?<doctoclevels>[^\n]+)\n/ =~ headerextract
61
- /\n:hierarchical-assets: (?<hierarchical_assets>[^\n]+)\n/ =~ headerextract
62
- /\n:use-xinclude: (?<use_xinclude>[^\n]+)\n/ =~ headerextract
65
+ /\n:(?<hierarchical_assets>hierarchical-assets:[^\n]*)\n/ =~ headerextract
66
+ /\n:(?<use_xinclude>use-xinclude:[^\n]*)\n/ =~ headerextract
67
+ /\n:(?<break_up_urls_in_tables>break-up-urls-in-tables:[^\n]*)\n/ =~ headerextract
68
+
69
+ defined?(hierarchical_assets) and
70
+ hierarchical_assets = empty_attr(hierarchical_assets, "hierarchical-assets")
71
+ defined?(use_xinclude) and
72
+ use_xinclude = empty_attr(use_xinclude, "use-xinclude")
73
+ defined?(break_up_urls_in_tables) and
74
+ break_up_urls_in_tables = empty_attr(break_up_urls_in_tables, "break-up-urls-in-tables")
63
75
  {
64
76
  script: defined?(script) ? script : nil,
65
77
  bodyfont: defined?(bodyfont) ? bodyfont : nil,
@@ -84,6 +96,7 @@ module Metanorma
84
96
  doctoclevels: defined?(doctoclevels) ? doctoclevels : nil,
85
97
  hierarchical_assets: defined?(hierarchical_assets) ? hierarchical_assets : nil,
86
98
  use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
99
+ break_up_urls_in_tables: defined?(break_up_urls_in_tables) ? break_up_urls_in_tables : nil,
87
100
  }.reject { |_, val| val.nil? }
88
101
  end
89
102
 
@@ -8,8 +8,9 @@ module Metanorma
8
8
  def convert(url_path, output_path, xsl_stylesheet)
9
9
  return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
10
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(" ")
11
+ cmd = ["java", "-Xss5m", "-Xmx1024m", "-jar", pdfjar, "--xml-file",
12
+ url_path, "--xsl-file", xsl_stylesheet, "--pdf-file",
13
+ output_path].join(" ")
13
14
  _, error_str, status = Open3.capture3(cmd)
14
15
  raise error_str unless status.success?
15
16
  end
@@ -48,7 +48,7 @@ module Metanorma
48
48
  @processors.inject({}) do |acc, (k,v)|
49
49
  if v.asciidoctor_backend
50
50
  x = Asciidoctor.load nil, {backend: v.asciidoctor_backend}
51
- acc[k] = x.converter.class::XML_ROOT_TAG
51
+ acc[k] = x.converter.xml_root_tag
52
52
  end
53
53
  acc
54
54
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
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.3
4
+ version: 1.0.4
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-21 00:00:00.000000000 Z
11
+ date: 2020-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor