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 +4 -4
- data/.github/workflows/macos.yml +1 -1
- data/.github/workflows/ubuntu.yml +3 -1
- data/.github/workflows/windows.yml +1 -1
- data/bin/mn2pdf.jar +0 -0
- data/lib/metanorma/compile.rb +5 -0
- data/lib/metanorma/input/asciidoc.rb +15 -2
- data/lib/metanorma/output/xslfo.rb +3 -2
- data/lib/metanorma/registry.rb +1 -1
- data/lib/metanorma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aa08613809fac5ac67ed1e4e1b4b448e6891105eb10e3424229bbae689f247b
|
4
|
+
data.tar.gz: 742700dda1a2c119b92b6a0839bffd82cf63017da4f675e4897f684f30e579ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37b584bde8e92687cc7ff797076994c913125ea361ce94c9c1bca6c83e399735bdd0415968f20bf2f5941d53c7bc8dafbf71b02394e21dfb42256335aa125f09
|
7
|
+
data.tar.gz: 8bba4bf99743f9d843301402f8e09b5a145794c5509124ad258fcc4769ed55e3764c57f95734fcd65a5a3a25a2c91890300727d75d0f20298f98716dfac1d860
|
data/.github/workflows/macos.yml
CHANGED
data/bin/mn2pdf.jar
CHANGED
Binary file
|
data/lib/metanorma/compile.rb
CHANGED
@@ -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:
|
62
|
-
/\n:use-xinclude:
|
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", "-
|
12
|
-
|
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
|
data/lib/metanorma/registry.rb
CHANGED
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.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-
|
11
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|