metanorma-generic 1.7.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +65 -0
- data/README.adoc +1 -3
- data/lib/asciidoctor/generic/basicdoc.rng +50 -3
- data/lib/asciidoctor/generic/converter.rb +5 -3
- data/lib/asciidoctor/generic/front.rb +6 -1
- data/lib/asciidoctor/generic/isodoc.rng +62 -46
- data/lib/isodoc/generic/base_convert.rb +0 -8
- data/lib/isodoc/generic/html_convert.rb +7 -9
- data/lib/isodoc/generic/metadata.rb +7 -0
- data/lib/isodoc/generic/pdf_convert.rb +2 -2
- data/lib/isodoc/generic/utils.rb +3 -1
- data/lib/isodoc/generic/word_convert.rb +7 -9
- data/lib/metanorma/generic.rb +63 -1
- data/lib/metanorma/generic/fonts_manifest.yaml +5 -0
- data/lib/metanorma/generic/processor.rb +0 -15
- data/lib/metanorma/generic/version.rb +1 -1
- data/metanorma-generic.gemspec +2 -2
- data/metanorma.yml.example +8 -0
- metadata +8 -9
- 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: fe8ede218e4a08dcca9458e6c27ea4079c130723c5a66e6585949bbd9355bea7
|
4
|
+
data.tar.gz: 8ddf9e1982c5b9b25909c49b7078bb2312e0fa4c7f446af8f914cd1c469785a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1e637f0f8b278addf710e060eb889316a83dd585da6856829ae505f1dae4ac0792b80652d1c1162b4350fb7ab7e04d3abace5e26e460c9fe4c48114c9322416
|
7
|
+
data.tar.gz: 756fc1dad9d182e3a8830a06aaa8efd5e77569b8648ac10e7bd651b27f1800d0150171e8a49ee4d32d0e6b7e51e24c84b0ffc0dd6ef4f158a6efaa3ee9bcacc1
|
@@ -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.METANORMA_CI_PAT_TOKEN || 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
@@ -3,9 +3,7 @@
|
|
3
3
|
Formerly known as metanorma-acme
|
4
4
|
|
5
5
|
image:https://img.shields.io/gem/v/metanorma-generic.svg["Gem Version", link="https://rubygems.org/gems/metanorma-generic"]
|
6
|
-
image:https://github.com/metanorma/metanorma-generic/workflows/
|
7
|
-
image:https://github.com/metanorma/metanorma-generic/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=ubuntu"]
|
8
|
-
image:https://github.com/metanorma/metanorma-generic/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-generic/actions?workflow=windows"]
|
6
|
+
image:https://github.com/metanorma/metanorma-generic/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-generic/actions?workflow=rake"]
|
9
7
|
image:https://codeclimate.com/github/metanorma/metanorma-acme/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-acme"]
|
10
8
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-generic.svg["Pull Requests", link="https://github.com/metanorma/metanorma-generic/pulls"]
|
11
9
|
image:https://img.shields.io/github/commits-since/metanorma/metanorma-generic/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-generic/releases"]
|
@@ -596,6 +596,7 @@
|
|
596
596
|
<ref name="bookmark"/>
|
597
597
|
<ref name="image"/>
|
598
598
|
<ref name="index"/>
|
599
|
+
<ref name="index-xref"/>
|
599
600
|
</choice>
|
600
601
|
</define>
|
601
602
|
<define name="PureTextElement">
|
@@ -728,15 +729,61 @@
|
|
728
729
|
</define>
|
729
730
|
<define name="index">
|
730
731
|
<element name="index">
|
731
|
-
<attribute name="
|
732
|
+
<attribute name="to">
|
733
|
+
<data type="IDREF"/>
|
734
|
+
</attribute>
|
735
|
+
<element name="primary">
|
736
|
+
<oneOrMore>
|
737
|
+
<ref name="PureTextElement"/>
|
738
|
+
</oneOrMore>
|
739
|
+
</element>
|
732
740
|
<optional>
|
733
|
-
<
|
741
|
+
<element name="secondary">
|
742
|
+
<oneOrMore>
|
743
|
+
<ref name="PureTextElement"/>
|
744
|
+
</oneOrMore>
|
745
|
+
</element>
|
734
746
|
</optional>
|
735
747
|
<optional>
|
736
|
-
<
|
748
|
+
<element name="tertiary">
|
749
|
+
<oneOrMore>
|
750
|
+
<ref name="PureTextElement"/>
|
751
|
+
</oneOrMore>
|
752
|
+
</element>
|
737
753
|
</optional>
|
738
754
|
</element>
|
739
755
|
</define>
|
756
|
+
<define name="index-xref">
|
757
|
+
<element name="index-xref">
|
758
|
+
<attribute name="also">
|
759
|
+
<data type="boolean"/>
|
760
|
+
</attribute>
|
761
|
+
<element name="primary">
|
762
|
+
<oneOrMore>
|
763
|
+
<ref name="PureTextElement"/>
|
764
|
+
</oneOrMore>
|
765
|
+
</element>
|
766
|
+
<optional>
|
767
|
+
<element name="secondary">
|
768
|
+
<oneOrMore>
|
769
|
+
<ref name="PureTextElement"/>
|
770
|
+
</oneOrMore>
|
771
|
+
</element>
|
772
|
+
</optional>
|
773
|
+
<optional>
|
774
|
+
<element name="tertiary">
|
775
|
+
<oneOrMore>
|
776
|
+
<ref name="PureTextElement"/>
|
777
|
+
</oneOrMore>
|
778
|
+
</element>
|
779
|
+
</optional>
|
780
|
+
<element name="target">
|
781
|
+
<oneOrMore>
|
782
|
+
<ref name="PureTextElement"/>
|
783
|
+
</oneOrMore>
|
784
|
+
</element>
|
785
|
+
</element>
|
786
|
+
</define>
|
740
787
|
<!-- bare ID element, used for referencing arbitrary spans of text -->
|
741
788
|
<define name="bookmark">
|
742
789
|
<element name="bookmark">
|
@@ -21,6 +21,7 @@ module Asciidoctor
|
|
21
21
|
|
22
22
|
def baselocation(loc)
|
23
23
|
return nil if loc.nil?
|
24
|
+
return loc
|
24
25
|
File.expand_path(File.join(File.dirname(
|
25
26
|
self.class::_file || __FILE__), "..", "..", "..", loc))
|
26
27
|
end
|
@@ -35,10 +36,11 @@ module Asciidoctor
|
|
35
36
|
|
36
37
|
def doctype(node)
|
37
38
|
d = super
|
38
|
-
configuration.doctypes or return d == "article" ?
|
39
|
+
configuration.doctypes or return d == "article" ?
|
40
|
+
(configuration.default_doctype || "standard") : d
|
39
41
|
type = configuration.default_doctype ||
|
40
|
-
|
41
|
-
unless
|
42
|
+
configuration.doctypes.keys.dig(0) || "standard"
|
43
|
+
unless configuration.doctypes.keys.include? d
|
42
44
|
@log.add("Document Attributes", nil,
|
43
45
|
"#{d} is not a legal document type: reverting to '#{type}'")
|
44
46
|
d = type
|
@@ -63,13 +63,18 @@ module Asciidoctor
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
def metadata_doctype(node, xml)
|
67
|
+
d = doctype(node)
|
68
|
+
xml.doctype d, attr_code(abbreviation: configuration&.doctypes&.dig(d))
|
69
|
+
end
|
70
|
+
|
66
71
|
EXT_STRUCT = %w(_output _attribute _list).freeze
|
67
72
|
|
68
73
|
def metadata_ext_hash(node, ext, hash)
|
69
74
|
hash.each do |k, v|
|
70
75
|
next if EXT_STRUCT.include?(k) || !v&.is_a?(Hash) && !node.attr(k)
|
71
76
|
if v&.is_a?(Hash) && v["_list"]
|
72
|
-
csv_split(node.attr(k)).each do |val|
|
77
|
+
csv_split(node.attr(k), ",").each do |val|
|
73
78
|
metadata_ext_hash1(k, val, ext, v, node)
|
74
79
|
end
|
75
80
|
else
|
@@ -24,6 +24,14 @@
|
|
24
24
|
<start>
|
25
25
|
<ref name="standard-document"/>
|
26
26
|
</start>
|
27
|
+
<define name="doctype">
|
28
|
+
<element name="doctype">
|
29
|
+
<optional>
|
30
|
+
<attribute name="abbreviation"/>
|
31
|
+
</optional>
|
32
|
+
<ref name="DocumentType"/>
|
33
|
+
</element>
|
34
|
+
</define>
|
27
35
|
<define name="hyperlink">
|
28
36
|
<element name="link">
|
29
37
|
<attribute name="target">
|
@@ -47,6 +55,13 @@
|
|
47
55
|
<param name="pattern">\i\c*|\c+#\c+</param>
|
48
56
|
</data>
|
49
57
|
</attribute>
|
58
|
+
<optional>
|
59
|
+
<attribute name="to">
|
60
|
+
<data type="string">
|
61
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
62
|
+
</data>
|
63
|
+
</attribute>
|
64
|
+
</optional>
|
50
65
|
<optional>
|
51
66
|
<attribute name="type">
|
52
67
|
<ref name="ReferenceFormat"/>
|
@@ -141,6 +156,11 @@
|
|
141
156
|
<data type="boolean"/>
|
142
157
|
</attribute>
|
143
158
|
</optional>
|
159
|
+
<optional>
|
160
|
+
<attribute name="key">
|
161
|
+
<data type="boolean"/>
|
162
|
+
</attribute>
|
163
|
+
</optional>
|
144
164
|
<oneOrMore>
|
145
165
|
<ref name="dt"/>
|
146
166
|
<ref name="dd"/>
|
@@ -233,6 +253,12 @@
|
|
233
253
|
<data type="boolean"/>
|
234
254
|
</attribute>
|
235
255
|
</optional>
|
256
|
+
<optional>
|
257
|
+
<attribute name="width"/>
|
258
|
+
</optional>
|
259
|
+
<optional>
|
260
|
+
<ref name="colgroup"/>
|
261
|
+
</optional>
|
236
262
|
<optional>
|
237
263
|
<ref name="tname"/>
|
238
264
|
</optional>
|
@@ -751,6 +777,18 @@
|
|
751
777
|
</define>
|
752
778
|
</include>
|
753
779
|
<!-- end overrides -->
|
780
|
+
<define name="colgroup">
|
781
|
+
<element name="colgroup">
|
782
|
+
<oneOrMore>
|
783
|
+
<ref name="col"/>
|
784
|
+
</oneOrMore>
|
785
|
+
</element>
|
786
|
+
</define>
|
787
|
+
<define name="col">
|
788
|
+
<element name="col">
|
789
|
+
<attribute name="width"/>
|
790
|
+
</element>
|
791
|
+
</define>
|
754
792
|
<define name="TextElement" combine="choice">
|
755
793
|
<ref name="concept"/>
|
756
794
|
</define>
|
@@ -801,6 +839,9 @@
|
|
801
839
|
<data type="boolean"/>
|
802
840
|
</attribute>
|
803
841
|
</optional>
|
842
|
+
<optional>
|
843
|
+
<attribute name="number"/>
|
844
|
+
</optional>
|
804
845
|
<optional>
|
805
846
|
<attribute name="obligation">
|
806
847
|
<choice>
|
@@ -856,9 +897,11 @@
|
|
856
897
|
<element name="code">
|
857
898
|
<text/>
|
858
899
|
</element>
|
859
|
-
<
|
860
|
-
<text
|
861
|
-
|
900
|
+
<optional>
|
901
|
+
<element name="text">
|
902
|
+
<text/>
|
903
|
+
</element>
|
904
|
+
</optional>
|
862
905
|
</element>
|
863
906
|
</define>
|
864
907
|
<define name="standard-document">
|
@@ -1028,6 +1071,9 @@
|
|
1028
1071
|
</choice>
|
1029
1072
|
</attribute>
|
1030
1073
|
</optional>
|
1074
|
+
<optional>
|
1075
|
+
<attribute name="number"/>
|
1076
|
+
</optional>
|
1031
1077
|
<optional>
|
1032
1078
|
<attribute name="type"/>
|
1033
1079
|
</optional>
|
@@ -1081,6 +1127,9 @@
|
|
1081
1127
|
<optional>
|
1082
1128
|
<attribute name="type"/>
|
1083
1129
|
</optional>
|
1130
|
+
<optional>
|
1131
|
+
<attribute name="number"/>
|
1132
|
+
</optional>
|
1084
1133
|
<optional>
|
1085
1134
|
<ref name="section-title"/>
|
1086
1135
|
</optional>
|
@@ -1164,49 +1213,7 @@
|
|
1164
1213
|
</define>
|
1165
1214
|
<define name="annex">
|
1166
1215
|
<element name="annex">
|
1167
|
-
<
|
1168
|
-
<attribute name="id">
|
1169
|
-
<data type="ID"/>
|
1170
|
-
</attribute>
|
1171
|
-
</optional>
|
1172
|
-
<optional>
|
1173
|
-
<attribute name="language"/>
|
1174
|
-
</optional>
|
1175
|
-
<optional>
|
1176
|
-
<attribute name="script"/>
|
1177
|
-
</optional>
|
1178
|
-
<optional>
|
1179
|
-
<attribute name="inline-header">
|
1180
|
-
<data type="boolean"/>
|
1181
|
-
</attribute>
|
1182
|
-
</optional>
|
1183
|
-
<attribute name="obligation">
|
1184
|
-
<choice>
|
1185
|
-
<value>normative</value>
|
1186
|
-
<value>informative</value>
|
1187
|
-
</choice>
|
1188
|
-
</attribute>
|
1189
|
-
<optional>
|
1190
|
-
<ref name="section-title"/>
|
1191
|
-
</optional>
|
1192
|
-
<group>
|
1193
|
-
<group>
|
1194
|
-
<zeroOrMore>
|
1195
|
-
<ref name="BasicBlock"/>
|
1196
|
-
</zeroOrMore>
|
1197
|
-
<zeroOrMore>
|
1198
|
-
<ref name="note"/>
|
1199
|
-
</zeroOrMore>
|
1200
|
-
</group>
|
1201
|
-
<zeroOrMore>
|
1202
|
-
<choice>
|
1203
|
-
<ref name="annex-subsection"/>
|
1204
|
-
<ref name="terms"/>
|
1205
|
-
<ref name="definitions"/>
|
1206
|
-
<ref name="references"/>
|
1207
|
-
</choice>
|
1208
|
-
</zeroOrMore>
|
1209
|
-
</group>
|
1216
|
+
<ref name="Annex-Section"/>
|
1210
1217
|
</element>
|
1211
1218
|
</define>
|
1212
1219
|
<define name="terms">
|
@@ -1225,6 +1232,9 @@
|
|
1225
1232
|
<optional>
|
1226
1233
|
<attribute name="type"/>
|
1227
1234
|
</optional>
|
1235
|
+
<optional>
|
1236
|
+
<attribute name="number"/>
|
1237
|
+
</optional>
|
1228
1238
|
<optional>
|
1229
1239
|
<attribute name="obligation">
|
1230
1240
|
<choice>
|
@@ -1553,6 +1563,7 @@
|
|
1553
1563
|
<value>add</value>
|
1554
1564
|
<value>modify</value>
|
1555
1565
|
<value>delete</value>
|
1566
|
+
<value>replace</value>
|
1556
1567
|
</choice>
|
1557
1568
|
</attribute>
|
1558
1569
|
<optional>
|
@@ -1583,6 +1594,11 @@
|
|
1583
1594
|
</optional>
|
1584
1595
|
<optional>
|
1585
1596
|
<element name="newcontent">
|
1597
|
+
<optional>
|
1598
|
+
<attribute name="id">
|
1599
|
+
<data type="ID"/>
|
1600
|
+
</attribute>
|
1601
|
+
</optional>
|
1586
1602
|
<zeroOrMore>
|
1587
1603
|
<ref name="BasicBlock"/>
|
1588
1604
|
</zeroOrMore>
|
@@ -4,14 +4,6 @@ require "fileutils"
|
|
4
4
|
module IsoDoc
|
5
5
|
module Generic
|
6
6
|
module BaseConvert
|
7
|
-
=begin
|
8
|
-
def baselocation(loc)
|
9
|
-
return nil if loc.nil?
|
10
|
-
File.expand_path(File.join(
|
11
|
-
File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
|
12
|
-
end
|
13
|
-
=end
|
14
|
-
|
15
7
|
def cleanup(docxml)
|
16
8
|
super
|
17
9
|
term_cleanup(docxml)
|
@@ -32,8 +32,12 @@ module IsoDoc
|
|
32
32
|
options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
33
33
|
configuration.html_headerfont || '"Overpass",sans-serif'
|
34
34
|
),
|
35
|
-
monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
|
36
|
-
|
35
|
+
monospacefont: configuration.html_monospacefont || '"Space Mono",monospace',
|
36
|
+
normalfontsize: configuration.html_normalfontsize,
|
37
|
+
smallerfontsize: configuration.html_smallerfontsize,
|
38
|
+
footnotefontsize: configuration.html_footnotefontsize,
|
39
|
+
monospacefontsize: configuration.html_monospacefontsize,
|
40
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
37
41
|
end
|
38
42
|
|
39
43
|
def default_file_locations(_options)
|
@@ -48,15 +52,9 @@ module IsoDoc
|
|
48
52
|
html_doc_path("scripts.html"),
|
49
53
|
i18nyaml: (configuration.i18nyaml.is_a?(String) ?
|
50
54
|
baselocation(configuration.i18nyaml) : nil)
|
51
|
-
}
|
55
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
52
56
|
end
|
53
57
|
|
54
|
-
=begin
|
55
|
-
def configuration
|
56
|
-
Metanorma::Generic.configuration
|
57
|
-
end
|
58
|
-
=end
|
59
|
-
|
60
58
|
def googlefonts
|
61
59
|
return unless configuration.webfont
|
62
60
|
Array(configuration.webfont).map do |x|
|
@@ -63,6 +63,13 @@ module IsoDoc
|
|
63
63
|
!(Array(stages).map { |m| m.downcase }.include? status.downcase)
|
64
64
|
end
|
65
65
|
|
66
|
+
def doctype(isoxml, _out)
|
67
|
+
super
|
68
|
+
b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
|
69
|
+
isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}")) || return
|
70
|
+
a = b["abbreviation"] and set(:doctype_abbr, a)
|
71
|
+
end
|
72
|
+
|
66
73
|
def xmlhash2hash(h)
|
67
74
|
ret = {}
|
68
75
|
return ret if h.nil? || h[:kind] != "element"
|
@@ -27,7 +27,7 @@ module IsoDoc
|
|
27
27
|
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
28
28
|
configuration.html_headerfont || '"Overpass",sans-serif'),
|
29
29
|
monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
|
30
|
-
}
|
30
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
31
31
|
end
|
32
32
|
|
33
33
|
def default_file_locations(_options)
|
@@ -40,7 +40,7 @@ module IsoDoc
|
|
40
40
|
html_doc_path("html_generic_intro.html"),
|
41
41
|
scripts_pdf: baselocation(configuration.scripts_pdf) ||
|
42
42
|
html_doc_path("scripts.pdf.html")
|
43
|
-
}
|
43
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
44
44
|
end
|
45
45
|
|
46
46
|
def googlefonts
|
data/lib/isodoc/generic/utils.rb
CHANGED
@@ -9,8 +9,10 @@ module IsoDoc
|
|
9
9
|
File.join(File.dirname(__FILE__), loc)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
def baselocation(loc)
|
13
13
|
return nil if loc.nil?
|
14
|
+
return "" if loc.empty?
|
15
|
+
return loc
|
14
16
|
f = defined?(self.class::_file) ? (self.class::_file || __FILE__) :
|
15
17
|
__FILE__
|
16
18
|
File.expand_path(File.join(
|
@@ -31,8 +31,12 @@ module IsoDoc
|
|
31
31
|
options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
32
32
|
configuration.word_headerfont || '"Arial",sans-serif'
|
33
33
|
),
|
34
|
-
monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
|
35
|
-
|
34
|
+
monospacefont: configuration.word_monospacefont || '"Courier New",monospace',
|
35
|
+
normalfontsize: configuration.word_normalfontsize,
|
36
|
+
smallerfontsize: configuration.word_smallerfontsize,
|
37
|
+
footnotefontsize: configuration.word_footnotefontsize,
|
38
|
+
monospacefontsize: configuration.word_monospacefontsize,
|
39
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
36
40
|
end
|
37
41
|
|
38
42
|
def default_file_locations(options)
|
@@ -51,15 +55,9 @@ module IsoDoc
|
|
51
55
|
baselocation(configuration.i18nyaml) : nil),
|
52
56
|
ulstyle: "l3",
|
53
57
|
olstyle: "l2",
|
54
|
-
}
|
58
|
+
}.transform_values { |v| v&.empty? ? nil : v }
|
55
59
|
end
|
56
60
|
|
57
|
-
=begin
|
58
|
-
def configuration
|
59
|
-
Metanorma::Generic.configuration
|
60
|
-
end
|
61
|
-
=end
|
62
|
-
|
63
61
|
include BaseConvert
|
64
62
|
include Init
|
65
63
|
end
|
data/lib/metanorma/generic.rb
CHANGED
@@ -31,6 +31,10 @@ module Metanorma
|
|
31
31
|
html_bodyfont
|
32
32
|
html_headerfont
|
33
33
|
html_monospacefont
|
34
|
+
html_normalfontsize
|
35
|
+
html_monospacefontsize
|
36
|
+
html_smallerfontsize
|
37
|
+
html_footnotefontsize
|
34
38
|
metadata_extensions
|
35
39
|
metanorma_name
|
36
40
|
normref_titles
|
@@ -51,9 +55,33 @@ module Metanorma
|
|
51
55
|
word_bodyfont
|
52
56
|
word_headerfont
|
53
57
|
word_monospacefont
|
58
|
+
word_normalfontsize
|
59
|
+
word_monospacefontsize
|
60
|
+
word_smallerfontsize
|
61
|
+
word_footnotefontsize
|
54
62
|
xml_root_tag
|
55
63
|
].freeze
|
56
64
|
|
65
|
+
def filepath_attrs
|
66
|
+
return %i[
|
67
|
+
i18nyaml
|
68
|
+
boilerplate
|
69
|
+
logo_path
|
70
|
+
logo_paths
|
71
|
+
header
|
72
|
+
htmlcoverpage
|
73
|
+
htmlintropage
|
74
|
+
htmlstylesheet
|
75
|
+
scripts
|
76
|
+
scripts_pdf
|
77
|
+
standardstylesheet
|
78
|
+
validate_rng_file
|
79
|
+
wordcoverpage
|
80
|
+
wordintropage
|
81
|
+
wordstylesheet
|
82
|
+
]
|
83
|
+
end
|
84
|
+
|
57
85
|
attr_accessor(*CONFIG_ATTRS)
|
58
86
|
|
59
87
|
class << self
|
@@ -84,13 +112,47 @@ module Metanorma
|
|
84
112
|
end
|
85
113
|
|
86
114
|
def set_default_values_from_yaml_file(config_file)
|
115
|
+
root_path = File.dirname(self.class::_file || __FILE__)
|
87
116
|
default_config_options = YAML.load(File.read(config_file))
|
117
|
+
if default_config_options["doctypes"]&.is_a? Array
|
118
|
+
default_config_options["doctypes"] = default_config_options["doctypes"].
|
119
|
+
each_with_object({}) { |k, m| m[k] = nil }
|
120
|
+
end
|
88
121
|
CONFIG_ATTRS.each do |attr_name|
|
89
|
-
|
122
|
+
value = default_config_options[attr_name.to_s]
|
123
|
+
if value && filepath_attrs.include?(attr_name)
|
124
|
+
value = absolute_path(value, root_path)
|
125
|
+
end
|
126
|
+
|
127
|
+
instance_variable_set("@#{attr_name}", value)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def blank?(v)
|
132
|
+
v.nil? || v.respond_to?(:empty?) && v.empty?
|
133
|
+
end
|
134
|
+
|
135
|
+
def absolute_path(value, root_path)
|
136
|
+
if value.is_a? Hash then absolute_path1(value, root_path)
|
137
|
+
elsif value.is_a? Array
|
138
|
+
value.reject { |a| blank?(a) }.each_with_object([]) do |v1, g|
|
139
|
+
g << absolute_path(v1, root_path)
|
140
|
+
end
|
141
|
+
elsif value.is_a?(String) && !value.empty?
|
142
|
+
File.join(root_path, "..", "..", value)
|
143
|
+
else
|
144
|
+
value
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def absolute_path1(h, pref)
|
149
|
+
h.reject { |k, v| blank?(v) }.each_with_object({}) do |(k, v), g|
|
150
|
+
g[k] = absolute_path(v, pref)
|
90
151
|
end
|
91
152
|
end
|
92
153
|
end
|
93
154
|
|
155
|
+
|
94
156
|
class << self
|
95
157
|
extend Forwardable
|
96
158
|
|
@@ -2,21 +2,6 @@ require "metanorma/processor"
|
|
2
2
|
|
3
3
|
module Metanorma
|
4
4
|
module Generic
|
5
|
-
def self.fonts_used
|
6
|
-
{
|
7
|
-
html: [
|
8
|
-
configuration.html_bodyfont || "Overpass", configuration.html_headerfont || "Overpass",
|
9
|
-
configuration.html_monospacefont || "Space Mono"
|
10
|
-
].uniq,
|
11
|
-
doc: [
|
12
|
-
configuration.word_bodyfont || "Overpass", configuration.word_headerfont || "Overpass",
|
13
|
-
configuration.word_monospacefont || "Space Mono"].uniq,
|
14
|
-
pdf: [
|
15
|
-
configuration.word_bodyfont || "Overpass", configuration.word_headerfont || "Overpass",
|
16
|
-
configuration.word_monospacefont || "Space Mono"].uniq,
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
5
|
class Processor < Metanorma::Processor
|
21
6
|
def configuration
|
22
7
|
Metanorma::Generic.configuration
|
data/metanorma-generic.gemspec
CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
30
|
spec.add_dependency "ruby-jing"
|
31
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
32
|
-
spec.add_dependency "isodoc", "~> 1.2
|
31
|
+
spec.add_dependency "metanorma-standoc", "~> 1.7.0"
|
32
|
+
spec.add_dependency "isodoc", "~> 1.4.2"
|
33
33
|
|
34
34
|
spec.add_development_dependency "byebug", "~> 9.1"
|
35
35
|
spec.add_development_dependency "sassc", "2.4.0"
|
data/metanorma.yml.example
CHANGED
@@ -14,6 +14,10 @@ htmlstylesheet: /metanorma-mine/lib/isodoc/mine/html/htmlstyle.scss
|
|
14
14
|
html_bodyfont: '"Source Sans Pro",sans-serif'
|
15
15
|
html_headerfont: '"Source Sans Pro",sans-serif'
|
16
16
|
html_monospacefont: '"Source Code Pro",monospace'
|
17
|
+
html_normalfontsize: "1.0em"
|
18
|
+
html_monospacefontsize: "0.8em"
|
19
|
+
html_smallerfontsize: "0.9em"
|
20
|
+
html_footnotefontsize: "0.8em"
|
17
21
|
scripts: /metanorma-mine/lib/isodoc/mine/html/scripts.html
|
18
22
|
scripts_pdf: /metanorma-mine/lib/isodoc/mine/html/scripts.prd.html
|
19
23
|
standardstylesheet: /metanorma-mine/lib/isodoc/mine/html/
|
@@ -24,6 +28,10 @@ wordstylesheet: /metanorma-mine/lib/isodoc/mine/html/wordstyle.scss
|
|
24
28
|
word_bodyfont: '"Source Sans Pro","Arial",sans-serif'
|
25
29
|
word_headerfont: '"Source Sans Pro","Arial",sans-serif'
|
26
30
|
word_monospacefont: '"Source Code Pro",monospace'
|
31
|
+
word_normalfontsize: "12.0pt"
|
32
|
+
word_monospacefontsize: "11.0pt"
|
33
|
+
word_smallerfontsize: "10.0pt"
|
34
|
+
word_footnotefontsize: "9.0pt"
|
27
35
|
docid_template: "{{ organization_name_short }} {{ docnumeric }}"
|
28
36
|
metadata_extensions:
|
29
37
|
- security
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-generic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
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: htmlentities
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.7.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.7.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: isodoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.2
|
61
|
+
version: 1.4.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.2
|
68
|
+
version: 1.4.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,9 +216,7 @@ executables: []
|
|
216
216
|
extensions: []
|
217
217
|
extra_rdoc_files: []
|
218
218
|
files:
|
219
|
-
- ".github/workflows/
|
220
|
-
- ".github/workflows/ubuntu.yml"
|
221
|
-
- ".github/workflows/windows.yml"
|
219
|
+
- ".github/workflows/rake.yml"
|
222
220
|
- ".gitignore"
|
223
221
|
- ".hound.yml"
|
224
222
|
- ".rubocop.ribose.yml"
|
@@ -264,6 +262,7 @@ files:
|
|
264
262
|
- lib/isodoc/generic/xref.rb
|
265
263
|
- lib/metanorma-generic.rb
|
266
264
|
- lib/metanorma/generic.rb
|
265
|
+
- lib/metanorma/generic/fonts_manifest.yaml
|
267
266
|
- lib/metanorma/generic/processor.rb
|
268
267
|
- lib/metanorma/generic/version.rb
|
269
268
|
- metanorma-generic.gemspec
|
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
|