metanorma 1.0.0 → 1.0.1
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/dependent_repos.env +1 -1
- data/.github/workflows/macos.yml +2 -3
- data/.github/workflows/ubuntu.yml +5 -5
- data/.github/workflows/windows.yml +3 -5
- data/README.adoc +3 -2
- data/bin/metanorma-pdf.js +13 -6
- data/lib/metanorma/compile.rb +9 -4
- data/lib/metanorma/output/pdf.rb +11 -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: 1b847f719ea09aa03edc9b67fc73f955c682bbff4690c0d5cea06561f7fbc478
|
4
|
+
data.tar.gz: c545afe2938e475a9360d5ae5bd1031920de4c279edf1d1860b83ee287367faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98b3f3268ce2ac4f60d71ecff97abe398e4c49ad84ff2d8759c486a3b87788c556e23b10454b9c67b352b8a86418587c969290072ee42d131d0449af030b3466
|
7
|
+
data.tar.gz: 3f3cf0eb527bf6d2b7db8438d01206961e57bdb2e7249d43537dd635c4bbac3e293b50fd5dcf7f3c069c542c454aa3b2356021aafeecd5ae0fb6c8cf3b198f4f
|
@@ -1,2 +1,2 @@
|
|
1
1
|
ORGANISATION=metanorma
|
2
|
-
DEPENDENT_REPOS=metanorma-docker
|
2
|
+
DEPENDENT_REPOS="metanorma-docker"
|
data/.github/workflows/macos.yml
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
# Auto-generated
|
2
|
-
#
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
3
|
name: macos
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
9
|
|
11
10
|
jobs:
|
12
11
|
test-macos:
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Auto-generated
|
2
|
-
#
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
3
|
name: ubuntu
|
4
4
|
|
5
5
|
on:
|
@@ -24,7 +24,7 @@ jobs:
|
|
24
24
|
architecture: 'x64'
|
25
25
|
- name: Update gems
|
26
26
|
run: |
|
27
|
-
gem install bundler
|
27
|
+
gem install bundler
|
28
28
|
bundle install --jobs 4 --retry 3
|
29
29
|
- name: Use Node
|
30
30
|
uses: actions/setup-node@v1
|
@@ -43,8 +43,8 @@ jobs:
|
|
43
43
|
GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
|
44
44
|
run: |
|
45
45
|
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
46
|
-
source .github/workflows/dependent_repos.env
|
46
|
+
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
47
47
|
for repo in $DEPENDENT_REPOS
|
48
48
|
do
|
49
49
|
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY
|
50
|
-
done
|
50
|
+
done
|
@@ -1,12 +1,11 @@
|
|
1
|
-
# Auto-generated
|
2
|
-
#
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
3
|
name: windows
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
9
|
|
11
10
|
jobs:
|
12
11
|
test-windows:
|
@@ -26,9 +25,8 @@ jobs:
|
|
26
25
|
- name: Update gems
|
27
26
|
shell: pwsh
|
28
27
|
run: |
|
29
|
-
gem install bundler
|
28
|
+
gem install bundler
|
30
29
|
bundle config --local path vendor/bundle
|
31
|
-
bundle update
|
32
30
|
bundle install --jobs 4 --retry 3
|
33
31
|
- name: Use Node
|
34
32
|
uses: actions/setup-node@v1
|
data/README.adoc
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
= Metanorma: the standard for standards
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/metanorma.svg["Gem Version", link="https://rubygems.org/gems/metanorma"]
|
4
|
-
image:https://
|
5
|
-
image:https://
|
4
|
+
image:https://github.com/metanorma/metanorma/workflows/ubuntu/badge.svg["Ubuntu Build Status", link="https://github.com/metanorma/metanorma/actions?query=workflow%3Aubuntu"]
|
5
|
+
image:https://github.com/metanorma/metanorma/workflows/macos/badge.svg["OSX Build Status", link="https://github.com/metanorma/metanorma/actions?query=workflow%3Amacos"]
|
6
|
+
image:https://github.com/metanorma/metanorma/workflows/windows/badge.svg["Windows Build Status", link="https://github.com/metanorma/metanorma/actions?query=workflow%3Awindows"]
|
6
7
|
image:https://codeclimate.com/github/metanorma/metanorma/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma"]
|
7
8
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma.svg["Pull Requests", link="https://github.com/metanorma/metanorma/pulls"]
|
8
9
|
image:https://img.shields.io/github/commits-since/metanorma/metanorma/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma/releases"]
|
data/bin/metanorma-pdf.js
CHANGED
@@ -3,17 +3,24 @@
|
|
3
3
|
|
4
4
|
const puppeteer = require('puppeteer');
|
5
5
|
|
6
|
+
const args = () => {
|
7
|
+
let args = ['--no-sandbox', '--disable-setuid-sandbox', '--headless'];
|
8
|
+
if (!process.platform.startsWith('win')) {
|
9
|
+
args << '--single-process';
|
10
|
+
}
|
11
|
+
return {args};
|
12
|
+
}
|
13
|
+
|
6
14
|
const createPdf = async() => {
|
7
15
|
let browser;
|
8
16
|
let exitCode = 0;
|
9
17
|
try {
|
10
|
-
|
11
|
-
if (!process.platform.startsWith('win')) {
|
12
|
-
args << '--single-process';
|
13
|
-
}
|
14
|
-
browser = await puppeteer.launch({args});
|
18
|
+
browser = await puppeteer.launch(args());
|
15
19
|
const page = await browser.newPage();
|
16
|
-
await page.goto(process.argv[2], {
|
20
|
+
await page.goto(process.argv[2], {
|
21
|
+
waitUntil: 'networkidle0',
|
22
|
+
timeout: 120000 //ms
|
23
|
+
});
|
17
24
|
await page.pdf({
|
18
25
|
path: process.argv[3],
|
19
26
|
format: 'A4'
|
data/lib/metanorma/compile.rb
CHANGED
@@ -39,8 +39,9 @@ module Metanorma
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def options_extract(filename, options)
|
42
|
-
|
43
|
-
o =
|
42
|
+
content = read_file(filename)
|
43
|
+
o = Metanorma::Input::Asciidoc.new.extract_metanorma_options(content)
|
44
|
+
o = o.merge(xml_options_extract(content))
|
44
45
|
options[:type] ||= o[:type]&.to_sym
|
45
46
|
dir = filename.sub(%r(/[^/]+$), "/")
|
46
47
|
options[:relaton] ||= "#{dir}/#{o[:relaton]}" if o[:relaton]
|
@@ -103,7 +104,7 @@ module Metanorma
|
|
103
104
|
case extname = File.extname(filename)
|
104
105
|
when ".adoc"
|
105
106
|
Util.log("[metanorma] Processing: Asciidoctor input.", :info)
|
106
|
-
file =
|
107
|
+
file = read_file(filename)
|
107
108
|
options[:asciimath] and
|
108
109
|
file.sub!(/^(=[^\n]+\n)/, "\\1:mn-keep-asciimath:\n")
|
109
110
|
dir = File.dirname(filename)
|
@@ -114,13 +115,17 @@ module Metanorma
|
|
114
115
|
Util.log("[metanorma] Processing: Metanorma XML input.", :info)
|
115
116
|
# TODO NN: this is a hack -- we should provide/bridge the
|
116
117
|
# document attributes in Metanorma XML
|
117
|
-
["",
|
118
|
+
["", read_file(filename)]
|
118
119
|
else
|
119
120
|
Util.log("[metanorma] Error: file extension #{extname} is not supported.", :error)
|
120
121
|
nil
|
121
122
|
end
|
122
123
|
end
|
123
124
|
|
125
|
+
def read_file(filename)
|
126
|
+
File.read(filename, encoding: "utf-8").gsub("\r\n", "\n")
|
127
|
+
end
|
128
|
+
|
124
129
|
def relaton_export(isodoc, options)
|
125
130
|
return unless options[:relaton]
|
126
131
|
xml = Nokogiri::XML(isodoc)
|
data/lib/metanorma/output/pdf.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "open3"
|
2
2
|
require "pathname"
|
3
|
+
require "shellwords"
|
3
4
|
|
4
5
|
module Metanorma
|
5
6
|
module Output
|
@@ -12,11 +13,20 @@ module Metanorma
|
|
12
13
|
pdfjs = File.join(File.dirname(__FILE__), "../../../bin/metanorma-pdf.js")
|
13
14
|
|
14
15
|
node_path = ENV["NODE_PATH"] || `npm root --quiet -g`.strip
|
15
|
-
node_cmd = ["node", pdfjs, file_url, output_path].join(" ")
|
16
|
+
node_cmd = ["node", pdfjs, file_url, output_path].map { |arg| shellescape(arg) }.join(" ")
|
16
17
|
|
17
18
|
_, error_str, status = Open3.capture3({ "NODE_PATH" => node_path }, node_cmd)
|
18
19
|
raise error_str unless status.success?
|
19
20
|
end
|
21
|
+
|
22
|
+
def shellescape(str)
|
23
|
+
if Gem.win_platform?()
|
24
|
+
# https://bugs.ruby-lang.org/issues/16741
|
25
|
+
str.match(" ") ? "\"#{str}\"" : str
|
26
|
+
else
|
27
|
+
Shellwords.shellescape(str)
|
28
|
+
end
|
29
|
+
end
|
20
30
|
end
|
21
31
|
end
|
22
32
|
end
|
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.1
|
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-03
|
11
|
+
date: 2020-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|