metanorma 1.1.6 → 1.2.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/.github/workflows/notify.yml +47 -0
- data/.github/workflows/rake.yml +65 -0
- data/README.adoc +1 -3
- data/lib/metanorma/collection.rb +1 -1
- data/lib/metanorma/collection_renderer.rb +63 -16
- data/lib/metanorma/compile.rb +65 -4
- data/lib/metanorma/config.rb +1 -1
- data/lib/metanorma/document.rb +1 -1
- data/lib/metanorma/output/xslfo.rb +2 -2
- data/lib/metanorma/util.rb +4 -0
- data/lib/metanorma/version.rb +1 -1
- data/metanorma.gemspec +5 -1
- metadata +48 -7
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -56
- data/.github/workflows/windows.yml +0 -40
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd65d9c42b99b4d3fb54c89a6189e736fc3927c48cd28da8b96e14ece003c194
|
|
4
|
+
data.tar.gz: 71d55f8449c7495a348c3acca4f2840562179cfebd96fdeaaf82b59965a4bf98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44b4797c97b3e306c9655c5073ec302563517d49982eba22a99fef10002c48763724309946c89edfd8617d954885b6a72bd7b4463e2a39148e174408f0428909
|
|
7
|
+
data.tar.gz: 4e77d61c5bb7078f05ce2eabe7a58ba2b451d0d6f257fb6c79855366ad7f4e63fe79bf7851646a5313ff044a5715e21c173d5302e42de6784cc73b4e5bf67f91
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
name: notify
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [ master ]
|
|
8
|
+
tags:
|
|
9
|
+
- '*'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
notify:
|
|
13
|
+
name: Notify dependent repos
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
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_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.ref == 'refs/heads/master' || startsWith(github.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_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
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
continue-on-error: ${{ matrix.experimental }}
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
ruby: [ '2.6', '2.5', '2.4' ]
|
|
20
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
21
|
+
experimental: [ false ]
|
|
22
|
+
include:
|
|
23
|
+
- ruby: '2.7'
|
|
24
|
+
os: 'ubuntu-latest'
|
|
25
|
+
experimental: true
|
|
26
|
+
- ruby: '2.7'
|
|
27
|
+
os: 'windows-latest'
|
|
28
|
+
experimental: true
|
|
29
|
+
- ruby: '2.7'
|
|
30
|
+
os: 'macos-latest'
|
|
31
|
+
experimental: true
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@master
|
|
34
|
+
|
|
35
|
+
- uses: ruby/setup-ruby@v1
|
|
36
|
+
with:
|
|
37
|
+
ruby-version: ${{ matrix.ruby }}
|
|
38
|
+
|
|
39
|
+
- if: matrix.os == 'macos-latest'
|
|
40
|
+
run: brew install autoconf automake libtool
|
|
41
|
+
|
|
42
|
+
- uses: actions/cache@v2
|
|
43
|
+
with:
|
|
44
|
+
path: vendor/bundle
|
|
45
|
+
key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
|
|
46
|
+
restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
|
|
47
|
+
|
|
48
|
+
- run: bundle config set path 'vendor/bundle'
|
|
49
|
+
|
|
50
|
+
- run: bundle install --jobs 4 --retry 3
|
|
51
|
+
|
|
52
|
+
- run: bundle exec rake
|
|
53
|
+
|
|
54
|
+
tests-passed:
|
|
55
|
+
needs: rake
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
steps:
|
|
58
|
+
- name: Trigger tests passed event
|
|
59
|
+
uses: Sibz/github-status-action@v1
|
|
60
|
+
with:
|
|
61
|
+
authToken: ${{ secrets.GITHUB_TOKEN }}
|
|
62
|
+
context: 'tests-passed-successfully'
|
|
63
|
+
description: 'Tests passed successfully'
|
|
64
|
+
state: 'success'
|
|
65
|
+
sha: ${{ github.event.pull_request.head.sha || github.sha }}
|
data/README.adoc
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
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://github.com/metanorma/metanorma/workflows/
|
|
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"]
|
|
4
|
+
image:https://github.com/metanorma/metanorma/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma/actions?workflow=rake"]
|
|
7
5
|
image:https://codeclimate.com/github/metanorma/metanorma/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma"]
|
|
8
6
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma.svg["Pull Requests", link="https://github.com/metanorma/metanorma/pulls"]
|
|
9
7
|
image:https://img.shields.io/github/commits-since/metanorma/metanorma/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma/releases"]
|
data/lib/metanorma/collection.rb
CHANGED
|
@@ -47,7 +47,7 @@ module Metanorma
|
|
|
47
47
|
Nokogiri::XML::Builder.new do |xml|
|
|
48
48
|
xml.send("metanorma-collection",
|
|
49
49
|
"xmlns" => "http://metanorma.org") do |mc|
|
|
50
|
-
@bibdata.to_xml
|
|
50
|
+
mc << @bibdata.to_xml(bibdata: true, date_format: :full)
|
|
51
51
|
@manifest.to_xml mc
|
|
52
52
|
content_to_xml "prefatory", mc
|
|
53
53
|
doccontainer mc
|
|
@@ -33,6 +33,7 @@ module Metanorma
|
|
|
33
33
|
@outdir = options[:output_folder]
|
|
34
34
|
@coverpage = options[:coverpage]
|
|
35
35
|
@format = options[:format]
|
|
36
|
+
@compile_options = options[:compile] || {}
|
|
36
37
|
|
|
37
38
|
# list of files in the collection
|
|
38
39
|
@files = read_files folder
|
|
@@ -54,7 +55,8 @@ module Metanorma
|
|
|
54
55
|
end
|
|
55
56
|
|
|
56
57
|
def concatenate(col, options)
|
|
57
|
-
options[:format]
|
|
58
|
+
options[:format] << :presentation if options[:format].include?(:pdf)
|
|
59
|
+
options[:format].uniq.each do |e|
|
|
58
60
|
next unless %i(presentation xml).include?(e)
|
|
59
61
|
ext = e == :presentation ? "presentation.xml" : e.to_s
|
|
60
62
|
out = col.clone
|
|
@@ -65,6 +67,13 @@ module Metanorma
|
|
|
65
67
|
end
|
|
66
68
|
File.open(File.join(@outdir, "collection.#{ext}"), "w:UTF-8") { |f| f.write(out.to_xml) }
|
|
67
69
|
end
|
|
70
|
+
options[:format].include?(:pdf) and
|
|
71
|
+
pdfconv.convert(File.join(@outdir, "collection.presentation.xml"))
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def pdfconv
|
|
75
|
+
x = Asciidoctor.load nil, backend: @doctype.to_sym
|
|
76
|
+
x.converter.pdf_converter(Dummy.new)
|
|
68
77
|
end
|
|
69
78
|
|
|
70
79
|
# Dummy class
|
|
@@ -121,12 +130,34 @@ module Metanorma
|
|
|
121
130
|
end
|
|
122
131
|
file, _filename = targetfile(files[identifier], true)
|
|
123
132
|
xml = Nokogiri::XML(file)
|
|
133
|
+
add_document_suffix(identifier, xml)
|
|
124
134
|
files[identifier][:anchors] = read_anchors(xml)
|
|
125
135
|
files[identifier][:bibdata] = xml.at(ns("//bibdata"))
|
|
126
136
|
end
|
|
127
137
|
files
|
|
128
138
|
end
|
|
129
139
|
|
|
140
|
+
def add_suffix_to_attributes(doc, suffix, tag_name, attribute_name)
|
|
141
|
+
doc.xpath(ns("//#{tag_name}[@#{attribute_name}]")).each do |elem|
|
|
142
|
+
elem.attributes[attribute_name].value =
|
|
143
|
+
"#{elem.attributes[attribute_name].value}_#{suffix}"
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def add_document_suffix(identifier, doc)
|
|
148
|
+
document_suffix = Asciidoctor::Standoc::Cleanup.to_ncname(identifier)
|
|
149
|
+
[%w[* id],
|
|
150
|
+
%w[* bibitemid],
|
|
151
|
+
%w[review from],
|
|
152
|
+
%w[review to],
|
|
153
|
+
%w[index to],
|
|
154
|
+
%w[xref target],
|
|
155
|
+
%w[callout target]]
|
|
156
|
+
.each do |(tag_name, attribute_name)|
|
|
157
|
+
add_suffix_to_attributes(doc, document_suffix, tag_name, attribute_name)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
130
161
|
# map locality type and label (e.g. "clause" "1") to id = anchor for
|
|
131
162
|
# a document
|
|
132
163
|
def read_anchors(xml)
|
|
@@ -134,9 +165,13 @@ module Metanorma
|
|
|
134
165
|
xrefs = @isodoc.xref_init(@lang, @script, @isodoc, @isodoc.i18n, {})
|
|
135
166
|
xrefs.parse xml
|
|
136
167
|
xrefs.get.each do |k, v|
|
|
137
|
-
v[:label] && v[:type] || next
|
|
138
168
|
ret[v[:type]] ||= {}
|
|
139
|
-
|
|
169
|
+
index = v[:container] || v[:label].nil? || v[:label].empty? ?
|
|
170
|
+
UUIDTools::UUID.random_create.to_s : v[:label]
|
|
171
|
+
# Note: will only key clauses, which have unambiguous reference label in locality.
|
|
172
|
+
# Notes, examples etc with containers are just plunked agaisnt UUIDs, so that their
|
|
173
|
+
# IDs can at least be registered to be tracked as existing.
|
|
174
|
+
ret[v[:type]][index] = k
|
|
140
175
|
end
|
|
141
176
|
ret
|
|
142
177
|
end
|
|
@@ -242,6 +277,7 @@ module Metanorma
|
|
|
242
277
|
newbib = bib.replace(@files[docid][:bibdata])
|
|
243
278
|
newbib.name = "bibitem"
|
|
244
279
|
newbib["id"] = id
|
|
280
|
+
newbib["hidden"] = "true"
|
|
245
281
|
newbib&.at(ns("./ext"))&.remove
|
|
246
282
|
_file, url = targetfile(@files[docid], false)
|
|
247
283
|
uri_node = Nokogiri::XML::Node.new "uri", newbib
|
|
@@ -262,13 +298,16 @@ module Metanorma
|
|
|
262
298
|
# @return [String] XML content
|
|
263
299
|
def update_xrefs(file, identifier)
|
|
264
300
|
docxml = Nokogiri::XML(file)
|
|
301
|
+
add_document_suffix(identifier, docxml)
|
|
265
302
|
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |b|
|
|
266
303
|
docid = b&.at(ns("./docidentifier[@type = 'repository']"))&.text
|
|
267
304
|
next unless docid && %r{^current-metanorma-collection/}.match(docid)
|
|
268
|
-
|
|
269
305
|
update_bibitem(b, identifier)
|
|
270
306
|
update_anchors(b, docxml, docid)
|
|
271
307
|
end
|
|
308
|
+
docxml.xpath(ns("//references[not(./bibitem[not(@hidden) or @hidden = 'false'])]")).each do |f|
|
|
309
|
+
f["hidden"] = "true"
|
|
310
|
+
end
|
|
272
311
|
docxml.to_xml
|
|
273
312
|
end
|
|
274
313
|
|
|
@@ -276,18 +315,25 @@ module Metanorma
|
|
|
276
315
|
# anchor given the locality, and insert it into the crossref
|
|
277
316
|
def update_anchors(bib, docxml, _id) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
278
317
|
docid = bib&.at(ns("./docidentifier"))&.text
|
|
318
|
+
document_suffix = Asciidoctor::Standoc::Cleanup.to_ncname(docid)
|
|
279
319
|
docxml.xpath("//xmlns:eref[@citeas = '#{docid}']").each do |e|
|
|
280
|
-
e.at(ns(".//locality[@type = 'anchor']"))
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
320
|
+
if loc = e.at(ns(".//locality[@type = 'anchor']"))
|
|
321
|
+
ref = loc.at(ns("./referenceFrom")) || next
|
|
322
|
+
anchor = "#{ref.text}_#{document_suffix}"
|
|
323
|
+
next unless @files[docid][:anchors].inject([]) { |m, (_, x)| m+= x.values }.include?(anchor)
|
|
324
|
+
ref.content = anchor
|
|
325
|
+
else
|
|
326
|
+
ins = e.at(ns("./localityStack")) || next
|
|
327
|
+
type = ins&.at(ns("./locality/@type"))&.text
|
|
328
|
+
ref = ins&.at(ns("./locality/referenceFrom"))&.text
|
|
329
|
+
(anchor = @files[docid][:anchors][type][ref]) || next
|
|
330
|
+
ref_from = Nokogiri::XML::Node.new "referenceFrom", bib
|
|
331
|
+
ref_from.content = anchor.sub(/^_/, "")
|
|
332
|
+
locality = Nokogiri::XML::Node.new "locality", bib
|
|
333
|
+
locality[:type] = "anchor"
|
|
334
|
+
locality.add_child ref_from
|
|
335
|
+
ins << locality
|
|
336
|
+
end
|
|
291
337
|
end
|
|
292
338
|
end
|
|
293
339
|
|
|
@@ -302,7 +348,8 @@ module Metanorma
|
|
|
302
348
|
f.close
|
|
303
349
|
# warn "metanorma compile -x html #{f.path}"
|
|
304
350
|
c = Compile.new
|
|
305
|
-
|
|
351
|
+
options = { format: :asciidoc, extension_keys: @format }.merge @compile_options
|
|
352
|
+
c.compile f.path, options
|
|
306
353
|
@files[identifier][:outputs] = {}
|
|
307
354
|
@format.each do |e|
|
|
308
355
|
ext = c.processor.output_formats[e]
|
data/lib/metanorma/compile.rb
CHANGED
|
@@ -2,6 +2,9 @@ require "fileutils"
|
|
|
2
2
|
require "nokogiri"
|
|
3
3
|
require "htmlentities"
|
|
4
4
|
|
|
5
|
+
require "fontist"
|
|
6
|
+
require "fontist/manifest/install"
|
|
7
|
+
|
|
5
8
|
module Metanorma
|
|
6
9
|
class Compile
|
|
7
10
|
# @return [Array<String>]
|
|
@@ -21,6 +24,7 @@ module Metanorma
|
|
|
21
24
|
(file, isodoc = process_input(filename, options)) or return nil
|
|
22
25
|
relaton_export(isodoc, options)
|
|
23
26
|
extract(isodoc, options[:extract], options[:extract_type])
|
|
27
|
+
install_fonts(options)
|
|
24
28
|
process_extensions(extensions, file, isodoc, options)
|
|
25
29
|
end
|
|
26
30
|
|
|
@@ -63,21 +67,32 @@ module Metanorma
|
|
|
63
67
|
Util.log("[metanorma] Error: Please specify a standard type: #{@registry.supported_backends}.", :error)
|
|
64
68
|
return nil
|
|
65
69
|
end
|
|
70
|
+
|
|
66
71
|
stdtype = options[:type].to_sym
|
|
72
|
+
metanorma_flavor = "metanorma-#{stdtype}"
|
|
73
|
+
|
|
67
74
|
unless @registry.supported_backends.include? stdtype
|
|
68
|
-
Util.log("[metanorma] Info: Loading
|
|
75
|
+
Util.log("[metanorma] Info: Loading `#{metanorma_flavor}` gem for standard type `#{stdtype}`.", :info)
|
|
69
76
|
end
|
|
77
|
+
|
|
70
78
|
begin
|
|
71
79
|
require "metanorma-#{stdtype}"
|
|
72
|
-
Util.log("[metanorma] Info: gem
|
|
80
|
+
Util.log("[metanorma] Info: gem `#{metanorma_flavor}` loaded.", :info)
|
|
81
|
+
|
|
82
|
+
rescue Gem::ConflictError
|
|
83
|
+
Util.log("[metanorma] Error: Couldn't resolve dependencies for `metanorma-#{stdtype}`, Please add it to your Gemfile and run bundle install first", :error)
|
|
84
|
+
return false
|
|
85
|
+
|
|
73
86
|
rescue LoadError
|
|
74
|
-
Util.log("[metanorma] Error: loading gem
|
|
87
|
+
Util.log("[metanorma] Error: loading gem `#{metanorma_flavor}` failed. Exiting.", :error)
|
|
75
88
|
return false
|
|
76
89
|
end
|
|
90
|
+
|
|
77
91
|
unless @registry.supported_backends.include? stdtype
|
|
78
|
-
Util.log("[metanorma] Error: The
|
|
92
|
+
Util.log("[metanorma] Error: The `#{metanorma_flavor}` gem still doesn't support `#{stdtype}`. Exiting.", :error)
|
|
79
93
|
return false
|
|
80
94
|
end
|
|
95
|
+
|
|
81
96
|
true
|
|
82
97
|
end
|
|
83
98
|
|
|
@@ -252,8 +267,54 @@ module Metanorma
|
|
|
252
267
|
end
|
|
253
268
|
end
|
|
254
269
|
|
|
270
|
+
def install_fonts(options)
|
|
271
|
+
if options[:"no-install-fonts"]
|
|
272
|
+
Util.log("[fontist] Skip font installation because" \
|
|
273
|
+
" --no-install-fonts argument passed", :debug)
|
|
274
|
+
return
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
if !@processor.respond_to?(:fonts_manifest) || @processor.fonts_manifest.nil?
|
|
278
|
+
Util.log("[fontist] Skip font installation because font_manifest is missing", :debug)
|
|
279
|
+
return
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
manifest = @processor.fonts_manifest
|
|
283
|
+
agree_to_terms = options[:"agree-to-terms"] || false
|
|
284
|
+
continue_without_fonts = options[:"continue-without-fonts"] || false
|
|
285
|
+
|
|
286
|
+
install_fonts_safe(manifest, agree_to_terms, continue_without_fonts)
|
|
287
|
+
end
|
|
288
|
+
|
|
255
289
|
private
|
|
256
290
|
|
|
291
|
+
def install_fonts_safe(manifest, agree, continue)
|
|
292
|
+
fontist_install(manifest, agree)
|
|
293
|
+
rescue Fontist::Errors::LicensingError
|
|
294
|
+
if continue
|
|
295
|
+
Util.log("[fontist] Processing will continue without fonts installed", :debug)
|
|
296
|
+
else
|
|
297
|
+
Util.log("[fontist] Aborting without proper fonts installed," \
|
|
298
|
+
" make sure that you have set option --agree-to-terms", :fatal)
|
|
299
|
+
end
|
|
300
|
+
rescue Fontist::Errors::MissingFontError => e
|
|
301
|
+
font = /Font '([^']+)'/.match(e.to_s)[1]
|
|
302
|
+
Util.log("[fontist] '#{font}' font is not supported. " \
|
|
303
|
+
"Please report this issue at github.com/metanorma/metanorma-#{@processor.short}/issues" \
|
|
304
|
+
" to report this issue.", :info)
|
|
305
|
+
rescue Fontist::Errors::FormulaIndexNotFoundError
|
|
306
|
+
Util.log("[fontist] Missing formula index. Fetching it...", :debug)
|
|
307
|
+
Fontist::Formula.update_formulas_repo
|
|
308
|
+
fontist_install(manifest, agree)
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def fontist_install(manifest, agree)
|
|
312
|
+
Fontist::Manifest::Install.from_hash(
|
|
313
|
+
manifest,
|
|
314
|
+
confirmation: agree ? "yes" : "no"
|
|
315
|
+
)
|
|
316
|
+
end
|
|
317
|
+
|
|
257
318
|
# @param options [Hash]
|
|
258
319
|
# @return [String]
|
|
259
320
|
def change_output_dir(options)
|
data/lib/metanorma/config.rb
CHANGED
data/lib/metanorma/document.rb
CHANGED
|
@@ -4,10 +4,10 @@ require_relative "./utils.rb"
|
|
|
4
4
|
module Metanorma
|
|
5
5
|
module Output
|
|
6
6
|
class XslfoPdf < Base
|
|
7
|
-
def convert(url_path, output_path, xsl_stylesheet)
|
|
7
|
+
def convert(url_path, output_path, xsl_stylesheet, options = "")
|
|
8
8
|
return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
|
|
9
9
|
|
|
10
|
-
Mn2pdf.convert(quote(url_path), quote(output_path), quote(xsl_stylesheet))
|
|
10
|
+
Mn2pdf.convert(quote(url_path), quote(output_path), quote(xsl_stylesheet), options)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def quote(x)
|
data/lib/metanorma/util.rb
CHANGED
data/lib/metanorma/version.rb
CHANGED
data/metanorma.gemspec
CHANGED
|
@@ -27,6 +27,9 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.add_runtime_dependency 'htmlentities'
|
|
28
28
|
spec.add_runtime_dependency 'nokogiri'
|
|
29
29
|
spec.add_runtime_dependency 'mn2pdf', "~> 1"
|
|
30
|
+
spec.add_runtime_dependency 'pry'
|
|
31
|
+
spec.add_runtime_dependency 'fontist', '~> 1.8'
|
|
32
|
+
|
|
30
33
|
# get relaton-cli to avoic circular reference with metanorma-standoc
|
|
31
34
|
#spec.add_dependency "relaton-cli"
|
|
32
35
|
#spec.add_dependency "metanorma-standoc", "~> 1.5.3"
|
|
@@ -36,6 +39,7 @@ Gem::Specification.new do |spec|
|
|
|
36
39
|
spec.add_development_dependency "byebug", "~> 10.0"
|
|
37
40
|
spec.add_development_dependency "rspec-command", "~> 1.0"
|
|
38
41
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
|
39
|
-
spec.add_development_dependency "metanorma-iso", "~> 1.
|
|
42
|
+
spec.add_development_dependency "metanorma-iso", "~> 1.6.0"
|
|
43
|
+
spec.add_development_dependency "sassc", "~> 2.4.0"
|
|
40
44
|
#spec.add_development_dependency "isodoc", "~> 1.2.1"
|
|
41
45
|
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.
|
|
4
|
+
version: 1.2.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:
|
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: asciidoctor
|
|
@@ -66,6 +66,34 @@ dependencies:
|
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '1'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: pry
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: fontist
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '1.8'
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '1.8'
|
|
69
97
|
- !ruby/object:Gem::Dependency
|
|
70
98
|
name: rake
|
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,14 +170,28 @@ dependencies:
|
|
|
142
170
|
requirements:
|
|
143
171
|
- - "~>"
|
|
144
172
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: 1.
|
|
173
|
+
version: 1.6.0
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - "~>"
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: 1.6.0
|
|
181
|
+
- !ruby/object:Gem::Dependency
|
|
182
|
+
name: sassc
|
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
|
184
|
+
requirements:
|
|
185
|
+
- - "~>"
|
|
186
|
+
- !ruby/object:Gem::Version
|
|
187
|
+
version: 2.4.0
|
|
146
188
|
type: :development
|
|
147
189
|
prerelease: false
|
|
148
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
191
|
requirements:
|
|
150
192
|
- - "~>"
|
|
151
193
|
- !ruby/object:Gem::Version
|
|
152
|
-
version:
|
|
194
|
+
version: 2.4.0
|
|
153
195
|
description: Library to process any Metanorma standard.
|
|
154
196
|
email:
|
|
155
197
|
- open.source@ribose.com
|
|
@@ -161,9 +203,8 @@ extra_rdoc_files:
|
|
|
161
203
|
- LICENSE.txt
|
|
162
204
|
files:
|
|
163
205
|
- ".github/workflows/dependent_repos.env"
|
|
164
|
-
- ".github/workflows/
|
|
165
|
-
- ".github/workflows/
|
|
166
|
-
- ".github/workflows/windows.yml"
|
|
206
|
+
- ".github/workflows/notify.yml"
|
|
207
|
+
- ".github/workflows/rake.yml"
|
|
167
208
|
- ".gitignore"
|
|
168
209
|
- ".hound.yml"
|
|
169
210
|
- ".rspec"
|
data/.github/workflows/macos.yml
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
|
-
name: macos
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches: [ master ]
|
|
8
|
-
pull_request:
|
|
9
|
-
paths-ignore:
|
|
10
|
-
- .github/workflows/ubuntu.yml
|
|
11
|
-
- .github/workflows/windows.yml
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
test-macos:
|
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} macOS
|
|
16
|
-
runs-on: macos-latest
|
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
|
18
|
-
strategy:
|
|
19
|
-
fail-fast: false
|
|
20
|
-
matrix:
|
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
|
22
|
-
experimental: [false]
|
|
23
|
-
include:
|
|
24
|
-
- ruby: '2.7'
|
|
25
|
-
experimental: true
|
|
26
|
-
steps:
|
|
27
|
-
- uses: actions/checkout@master
|
|
28
|
-
- name: Use Ruby
|
|
29
|
-
uses: actions/setup-ruby@v1
|
|
30
|
-
with:
|
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
|
32
|
-
- name: Update gems
|
|
33
|
-
run: |
|
|
34
|
-
sudo gem install bundler --force
|
|
35
|
-
bundle install --jobs 4 --retry 3
|
|
36
|
-
- name: Run specs
|
|
37
|
-
run: |
|
|
38
|
-
bundle exec rake
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
|
-
name: ubuntu
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches: [ master ]
|
|
8
|
-
tags:
|
|
9
|
-
- '*'
|
|
10
|
-
pull_request:
|
|
11
|
-
paths-ignore:
|
|
12
|
-
- .github/workflows/macos.yml
|
|
13
|
-
- .github/workflows/windows.yml
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
test-linux:
|
|
17
|
-
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
continue-on-error: ${{ matrix.experimental }}
|
|
20
|
-
strategy:
|
|
21
|
-
fail-fast: false
|
|
22
|
-
matrix:
|
|
23
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
|
24
|
-
experimental: [false]
|
|
25
|
-
include:
|
|
26
|
-
- ruby: '2.7'
|
|
27
|
-
experimental: true
|
|
28
|
-
steps:
|
|
29
|
-
- uses: actions/checkout@master
|
|
30
|
-
- name: Use Ruby
|
|
31
|
-
uses: actions/setup-ruby@v1
|
|
32
|
-
with:
|
|
33
|
-
ruby-version: ${{ matrix.ruby }}
|
|
34
|
-
- name: Update gems
|
|
35
|
-
run: |
|
|
36
|
-
gem install bundler
|
|
37
|
-
bundle install --jobs 4 --retry 3
|
|
38
|
-
- name: Run specs
|
|
39
|
-
run: |
|
|
40
|
-
bundle exec rake
|
|
41
|
-
- name: Trigger repositories
|
|
42
|
-
if: matrix.ruby == '2.6'
|
|
43
|
-
env:
|
|
44
|
-
GH_USERNAME: metanorma-ci
|
|
45
|
-
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
|
46
|
-
run: |
|
|
47
|
-
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
|
48
|
-
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
|
49
|
-
CLIENT_PAYLOAD=$(cat <<EOF
|
|
50
|
-
"{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
|
|
51
|
-
EOF
|
|
52
|
-
)
|
|
53
|
-
for repo in $REPOS
|
|
54
|
-
do
|
|
55
|
-
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
|
|
56
|
-
done
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
|
-
name: windows
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches: [ master ]
|
|
8
|
-
pull_request:
|
|
9
|
-
paths-ignore:
|
|
10
|
-
- .github/workflows/macos.yml
|
|
11
|
-
- .github/workflows/ubuntu.yml
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
test-windows:
|
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} Windows
|
|
16
|
-
runs-on: windows-latest
|
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
|
18
|
-
strategy:
|
|
19
|
-
fail-fast: false
|
|
20
|
-
matrix:
|
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
|
22
|
-
experimental: [false]
|
|
23
|
-
include:
|
|
24
|
-
- ruby: '2.7'
|
|
25
|
-
experimental: true
|
|
26
|
-
steps:
|
|
27
|
-
- uses: actions/checkout@master
|
|
28
|
-
- name: Use Ruby
|
|
29
|
-
uses: actions/setup-ruby@v1
|
|
30
|
-
with:
|
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
|
32
|
-
- name: Update gems
|
|
33
|
-
shell: pwsh
|
|
34
|
-
run: |
|
|
35
|
-
gem install bundler
|
|
36
|
-
bundle config --local path vendor/bundle
|
|
37
|
-
bundle install --jobs 4 --retry 3
|
|
38
|
-
- name: Run specs
|
|
39
|
-
run: |
|
|
40
|
-
bundle exec rake
|