metanorma 1.5.1 → 1.5.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 +4 -4
- data/lib/metanorma/collection_renderer.rb +1 -1
- data/lib/metanorma/input/asciidoc.rb +37 -25
- data/lib/metanorma/version.rb +1 -1
- data/metanorma.gemspec +3 -2
- metadata +4 -14
- data/.github/workflows/dependent_repos.env +0 -2
- data/.github/workflows/notify.yml +0 -47
- data/.github/workflows/rake.yml +0 -15
- data/.github/workflows/release.yml +0 -27
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/metanorma-pdf.js +0 -39
- data/bin/rasterize.js +0 -49
- data/bin/rspec +0 -29
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 504b901a50469dec68785b7c3cb207e287757a7b2a86394843210dd90b8703ed
|
4
|
+
data.tar.gz: '097ecbfebaa22181ecbb33330d4d5a8b609a24bf56d3df882a4a50504324ba17'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc055a69f2d0ab1e130ea9692e438df7e8547529191b601581ae7547b410c03e2cd35b54fb1f574dfad9795c4e3113f2e60dea924a16be4537a30c6dd6d13cd1
|
7
|
+
data.tar.gz: 609f4b00335d2ded1b480edf5839518c3b2ee7d857a063a1b5dab8dc0a0d5a2b2232b6ae5502b92593c51bbb5cb53d3c969f86edfac804dc6e6aff24aa4cc1e1
|
@@ -60,7 +60,7 @@ module Metanorma
|
|
60
60
|
%w(htmlstylesheet htmlcoverpage htmlintropage scripts
|
61
61
|
scripts-override scripts-pdf wordstylesheet i18nyaml
|
62
62
|
standardstylesheet header wordcoverpage wordintropage
|
63
|
-
ulstyle olstyle htmlstylesheet-override bare
|
63
|
+
ulstyle olstyle htmlstylesheet-override bare toclevels
|
64
64
|
htmltoclevels doctoclevels sectionsplit base-asset-path
|
65
65
|
body-font header-font monospace-font title-font
|
66
66
|
align-cross-elements wordstylesheet-override ieee-dtd
|
@@ -68,38 +68,50 @@ module Metanorma
|
|
68
68
|
pdf-owner-password pdf-allow-copy-content pdf-allow-edit-content
|
69
69
|
pdf-allow-assemble-document pdf-allow-edit-annotations
|
70
70
|
pdf-allow-print pdf-allow-print-hq pdf-allow-fill-in-forms
|
71
|
-
|
72
|
-
font-license-agreement pdf-allow-access-content
|
71
|
+
fonts font-license-agreement pdf-allow-access-content
|
73
72
|
pdf-encrypt-metadata iso-word-template document-scheme
|
74
|
-
localize-number
|
73
|
+
localize-number iso-word-bg-strip-color
|
74
|
+
modspec-identifier-base).freeze
|
75
|
+
|
76
|
+
EMPTY_ADOC_OPTIONS_DEFAULT_TRUE =
|
77
|
+
%w(data-uri-image suppress-asciimath-dup use-xinclude).freeze
|
78
|
+
|
79
|
+
EMPTY_ADOC_OPTIONS_DEFAULT_FALSE =
|
80
|
+
%w(hierarchical-assets break-up-urls-in-tables toc-figures
|
81
|
+
toc-tables toc-recommendations).freeze
|
82
|
+
|
83
|
+
def attr_name_normalise(name)
|
84
|
+
name.gsub(/-/, "").sub(/override$/, "_override").sub(/pdf$/, "_pdf")
|
85
|
+
.to_sym
|
86
|
+
end
|
75
87
|
|
76
88
|
def extract_options(file)
|
77
89
|
header = file.sub(/\n\n.*$/m, "\n")
|
78
90
|
ret = ADOC_OPTIONS.each_with_object({}) do |w, acc|
|
79
91
|
m = /\n:#{w}: ([^\n]+)\n/.match(header) or next
|
80
|
-
acc[w
|
81
|
-
.sub(/pdf$/, "_pdf").to_sym] = m[1]
|
92
|
+
acc[attr_name_normalise(w)] = m[1]
|
82
93
|
end
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
break_up = empty_attr(break_up, "break-up-urls-in-tables")
|
95
|
-
ret.merge(
|
96
|
-
datauriimage: defined?(datauriimage) ? datauriimage != "false" : true,
|
97
|
-
suppressasciimathdup: defined?(suppress_asciimath_dup) ? suppress_asciimath_dup != "false" : nil,
|
98
|
-
hierarchical_assets: defined?(hier_assets) ? hier_assets : nil,
|
99
|
-
use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
|
100
|
-
break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
|
101
|
-
).compact
|
94
|
+
ret2 = EMPTY_ADOC_OPTIONS_DEFAULT_TRUE.each_with_object({}) do |w, acc|
|
95
|
+
m = /\n:#{w}:([^\n]*)\n/.match(header) || [nil, "true"]
|
96
|
+
#require "debug" binding.b if w == "break-up-urls-in-tables"
|
97
|
+
acc[attr_name_normalise(w)] = (m[1].strip != "false")
|
98
|
+
end
|
99
|
+
ret3 = EMPTY_ADOC_OPTIONS_DEFAULT_FALSE.each_with_object({}) do |w, acc|
|
100
|
+
m = /\n:#{w}:([^\n]*)\n/.match(header) || [nil, "false"]
|
101
|
+
#require "debug" binding.b if w == "break-up-urls-in-tables"
|
102
|
+
acc[attr_name_normalise(w)] = !["false"].include?(m[1].strip)
|
103
|
+
end
|
104
|
+
ret.merge(ret2).merge(ret3).compact
|
102
105
|
end
|
106
|
+
|
107
|
+
# ret.merge(
|
108
|
+
# datauriimage: defined?(datauriimage) ? datauriimage != "false" : true,
|
109
|
+
# suppressasciimathdup: defined?(suppress_asciimath_dup) ? suppress_asciimath_dup != "false" : nil,
|
110
|
+
# hierarchical_assets: defined?(hier_assets) ? hier_assets : nil,
|
111
|
+
# use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
|
112
|
+
# break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
|
113
|
+
# ).compact
|
114
|
+
# end
|
103
115
|
end
|
104
116
|
end
|
105
117
|
end
|
data/lib/metanorma/version.rb
CHANGED
data/metanorma.gemspec
CHANGED
@@ -14,13 +14,14 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = "BSD-2-Clause"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
-
f.match(%r{^(test|spec|features)/})
|
17
|
+
f.match(%r{^(test|spec|features|bin|.github)/}) \
|
18
|
+
|| f.match(%r{Rakefile|bin/rspec})
|
18
19
|
end
|
19
20
|
spec.extra_rdoc_files = %w[README.adoc CHANGELOG.adoc LICENSE.txt]
|
20
21
|
spec.bindir = "bin"
|
21
22
|
# spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
23
|
spec.require_paths = ["lib"]
|
23
|
-
spec.required_ruby_version = ">= 2.
|
24
|
+
spec.required_ruby_version = ">= 2.7.0"
|
24
25
|
|
25
26
|
spec.add_runtime_dependency "asciidoctor"
|
26
27
|
spec.add_runtime_dependency "fontist", ">= 1.14.3"
|
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.5.
|
4
|
+
version: 1.5.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: 2022-
|
11
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -258,10 +258,6 @@ extra_rdoc_files:
|
|
258
258
|
- CHANGELOG.adoc
|
259
259
|
- LICENSE.txt
|
260
260
|
files:
|
261
|
-
- ".github/workflows/dependent_repos.env"
|
262
|
-
- ".github/workflows/notify.yml"
|
263
|
-
- ".github/workflows/rake.yml"
|
264
|
-
- ".github/workflows/release.yml"
|
265
261
|
- ".gitignore"
|
266
262
|
- ".hound.yml"
|
267
263
|
- ".rspec"
|
@@ -271,12 +267,6 @@ files:
|
|
271
267
|
- Gemfile
|
272
268
|
- LICENSE.txt
|
273
269
|
- README.adoc
|
274
|
-
- Rakefile
|
275
|
-
- bin/console
|
276
|
-
- bin/metanorma-pdf.js
|
277
|
-
- bin/rasterize.js
|
278
|
-
- bin/rspec
|
279
|
-
- bin/setup
|
280
270
|
- lib/metanorma.rb
|
281
271
|
- lib/metanorma/asciidoctor_extensions.rb
|
282
272
|
- lib/metanorma/asciidoctor_extensions/glob_include_processor.rb
|
@@ -314,14 +304,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
314
304
|
requirements:
|
315
305
|
- - ">="
|
316
306
|
- !ruby/object:Gem::Version
|
317
|
-
version: 2.
|
307
|
+
version: 2.7.0
|
318
308
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
319
309
|
requirements:
|
320
310
|
- - ">="
|
321
311
|
- !ruby/object:Gem::Version
|
322
312
|
version: '0'
|
323
313
|
requirements: []
|
324
|
-
rubygems_version: 3.
|
314
|
+
rubygems_version: 3.3.7
|
325
315
|
signing_key:
|
326
316
|
specification_version: 4
|
327
317
|
summary: Metanorma is the standard of standards; the metanorma gem allows you to create
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: notify
|
4
|
-
|
5
|
-
on:
|
6
|
-
repository_dispatch:
|
7
|
-
types: [ notify ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
notify:
|
11
|
-
name: Notify dependent repos
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v2
|
15
|
-
|
16
|
-
- name: Trigger repositories
|
17
|
-
env:
|
18
|
-
GH_USERNAME: metanorma-ci
|
19
|
-
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
20
|
-
run: |
|
21
|
-
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
22
|
-
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
23
|
-
CLIENT_PAYLOAD=$(cat <<EOF
|
24
|
-
"{ "ref": "${{ github.event.client_payload.ref }}", "repo": "${GITHUB_REPOSITORY}" }"
|
25
|
-
EOF
|
26
|
-
)
|
27
|
-
for repo in $TEMPLATE_REPOS" $SAMPLES_REPOS"
|
28
|
-
do
|
29
|
-
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
|
30
|
-
done
|
31
|
-
|
32
|
-
- name: Trigger release repositories
|
33
|
-
if: github.event.client_payload.ref == 'refs/heads/master' || startsWith(github.event.client_payload.ref, 'refs/tags/v')
|
34
|
-
env:
|
35
|
-
GH_USERNAME: metanorma-ci
|
36
|
-
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
37
|
-
run: |
|
38
|
-
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
39
|
-
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
40
|
-
CLIENT_PAYLOAD=$(cat <<EOF
|
41
|
-
"{ "ref": "${{ github.event.client_payload.ref }}", "repo": "${GITHUB_REPOSITORY}" }"
|
42
|
-
EOF
|
43
|
-
)
|
44
|
-
for repo in $DEPENDENT_REPOS
|
45
|
-
do
|
46
|
-
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
|
47
|
-
done
|
data/.github/workflows/rake.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: rake
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master, main ]
|
8
|
-
tags: [ v* ]
|
9
|
-
pull_request:
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
rake:
|
13
|
-
uses: metanorma/ci/.github/workflows/inkscape-rake.yml@main
|
14
|
-
secrets:
|
15
|
-
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: release
|
4
|
-
|
5
|
-
on:
|
6
|
-
workflow_dispatch:
|
7
|
-
inputs:
|
8
|
-
next_version:
|
9
|
-
description: |
|
10
|
-
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
11
|
-
required: true
|
12
|
-
default: 'skip'
|
13
|
-
push:
|
14
|
-
tags: [ v* ]
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
release:
|
18
|
-
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
19
|
-
with:
|
20
|
-
next_version: ${{ github.event.inputs.next_version }}
|
21
|
-
release_command: rake release
|
22
|
-
bundler_cache: false
|
23
|
-
post_install: gem install bundler rake rspec
|
24
|
-
secrets:
|
25
|
-
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
26
|
-
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
27
|
-
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "metanorma"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/metanorma-pdf.js
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
const puppeteer = require('puppeteer');
|
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
|
-
|
14
|
-
const createPdf = async() => {
|
15
|
-
let browser;
|
16
|
-
let exitCode = 0;
|
17
|
-
try {
|
18
|
-
browser = await puppeteer.launch(args());
|
19
|
-
const page = await browser.newPage();
|
20
|
-
await page.goto(process.argv[2], {
|
21
|
-
waitUntil: 'networkidle0',
|
22
|
-
timeout: 120000 //ms
|
23
|
-
});
|
24
|
-
await page.pdf({
|
25
|
-
path: process.argv[3],
|
26
|
-
format: 'A4'
|
27
|
-
});
|
28
|
-
} catch (err) {
|
29
|
-
console.error(err.message);
|
30
|
-
console.error(err.stack);
|
31
|
-
exitCode = 1;
|
32
|
-
} finally {
|
33
|
-
if (browser) {
|
34
|
-
browser.close();
|
35
|
-
}
|
36
|
-
process.exit(exitCode);
|
37
|
-
}
|
38
|
-
};
|
39
|
-
createPdf();
|
data/bin/rasterize.js
DELETED
@@ -1,49 +0,0 @@
|
|
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
|
-
}
|
data/bin/rspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rspec' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("rspec-core", "rspec")
|