metanorma-generic 1.10.0 → 1.10.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/rake.yml +12 -11
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/lib/asciidoctor/generic/biblio.rng +1 -0
- data/lib/asciidoctor/generic/converter.rb +24 -20
- data/lib/asciidoctor/generic/generic.rng +3 -0
- data/lib/asciidoctor/generic/isodoc.rng +292 -21
- data/lib/asciidoctor/generic/reqt.rng +15 -4
- data/lib/isodoc/generic/html/htmlstyle.scss +8 -0
- data/lib/isodoc/generic/metadata.rb +26 -21
- data/lib/isodoc/generic.rb +0 -1
- data/lib/metanorma/generic/processor.rb +0 -3
- data/lib/metanorma/generic/version.rb +1 -1
- data/lib/metanorma/generic.rb +21 -17
- data/metanorma-generic.gemspec +3 -3
- metadata +7 -8
- data/lib/isodoc/generic/pdf_convert.rb +0 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb399e7d7f6b0b778b49515a23b3c29297e0cf35b84b4da1837230ee014350fd
|
4
|
+
data.tar.gz: 4f8ae09e5df6c3385d7773f5c8a6bd489880d77955112223ce1dfbb073a66547
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bfd36e3f4f82b021b0af8c8a318a39de2ee7af2b786f3b927523d209c10a24b49cd39bc5e34e3deb567f4b3428c4067fade47e6b3ebecf38cf4339cecc95b00
|
7
|
+
data.tar.gz: 41e61d3c2c8aa1ac1607bd0902a8ee7c6d784b4d6c354b8d543c763cec589dc9551c4264262430d96cb3a17b49ed133f7391c9256fb82bb88f2376cf3291755c
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
|
-
include:
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'ubuntu-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'windows-latest'
|
28
|
-
experimental: true
|
29
|
-
- ruby: '3.0'
|
30
|
-
os: 'macos-latest'
|
31
|
-
experimental: true
|
32
22
|
steps:
|
33
23
|
- uses: actions/checkout@v2
|
34
24
|
with:
|
@@ -40,3 +30,14 @@ jobs:
|
|
40
30
|
bundler-cache: true
|
41
31
|
|
42
32
|
- run: bundle exec rake
|
33
|
+
|
34
|
+
tests-passed:
|
35
|
+
needs: rake
|
36
|
+
runs-on: ubuntu-latest
|
37
|
+
steps:
|
38
|
+
- uses: peter-evans/repository-dispatch@v1
|
39
|
+
with:
|
40
|
+
token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
41
|
+
repository: ${{ github.repository }}
|
42
|
+
event-type: tests-passed
|
43
|
+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# https://github.com/
|
3
|
-
# All project-specific additions and overrides should be specified in this file.
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
4
3
|
inherit_from:
|
5
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
6
5
|
|
7
6
|
# local repo-specific modifications
|
7
|
+
# ...
|
8
8
|
|
9
9
|
AllCops:
|
10
|
-
|
11
|
-
StyleGuideCopsOnly: false
|
12
|
-
TargetRubyVersion: 2.4
|
13
|
-
Rails:
|
14
|
-
Enabled: true
|
10
|
+
TargetRubyVersion: 2.5
|
@@ -19,11 +19,13 @@ module Asciidoctor
|
|
19
19
|
configuration.document_namespace || XML_NAMESPACE
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
def baselocation(loc)
|
23
23
|
return nil if loc.nil?
|
24
|
+
|
24
25
|
return loc
|
25
26
|
File.expand_path(File.join(File.dirname(
|
26
|
-
|
27
|
+
self.class::_file || __FILE__,
|
28
|
+
), "..", "..", "..", loc))
|
27
29
|
end
|
28
30
|
|
29
31
|
def docidentifier_cleanup(xmldoc)
|
@@ -36,7 +38,7 @@ module Asciidoctor
|
|
36
38
|
|
37
39
|
def doctype(node)
|
38
40
|
d = super
|
39
|
-
configuration.doctypes or return d == "article" ?
|
41
|
+
configuration.doctypes or return d == "article" ?
|
40
42
|
(configuration.default_doctype || "standard") : d
|
41
43
|
type = configuration.default_doctype ||
|
42
44
|
configuration.doctypes.keys.dig(0) || "standard"
|
@@ -49,18 +51,18 @@ module Asciidoctor
|
|
49
51
|
end
|
50
52
|
|
51
53
|
def read_config_file(path_to_config_file)
|
52
|
-
Metanorma::Generic.configuration
|
53
|
-
set_default_values_from_yaml_file(path_to_config_file)
|
54
|
+
Metanorma::Generic.configuration
|
55
|
+
.set_default_values_from_yaml_file(path_to_config_file)
|
54
56
|
end
|
55
57
|
|
56
58
|
def sectiontype_streamline(ret)
|
57
|
-
if configuration&.termsdefs_titles&.map(&:downcase)&.include?
|
59
|
+
if configuration&.termsdefs_titles&.map(&:downcase)&.include? ret
|
58
60
|
"terms and definitions"
|
59
|
-
elsif configuration&.symbols_titles&.map(&:downcase)&.include?
|
61
|
+
elsif configuration&.symbols_titles&.map(&:downcase)&.include? ret
|
60
62
|
"symbols and abbreviated terms"
|
61
|
-
elsif configuration&.normref_titles&.map(&:downcase)&.include?
|
63
|
+
elsif configuration&.normref_titles&.map(&:downcase)&.include? ret
|
62
64
|
"normative references"
|
63
|
-
elsif configuration&.bibliography_titles&.map(&:downcase)&.include?
|
65
|
+
elsif configuration&.bibliography_titles&.map(&:downcase)&.include? ret
|
64
66
|
"bibliography"
|
65
67
|
else
|
66
68
|
ret
|
@@ -73,15 +75,14 @@ module Asciidoctor
|
|
73
75
|
end
|
74
76
|
|
75
77
|
def outputs(node, ret)
|
76
|
-
File.open(@filename
|
77
|
-
presentation_xml_converter(node)&.convert(@filename
|
78
|
-
html_converter(node)&.convert(@filename
|
78
|
+
File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
|
79
|
+
presentation_xml_converter(node)&.convert("#{@filename}.xml")
|
80
|
+
html_converter(node)&.convert("#{@filename}.presentation.xml",
|
79
81
|
nil, false, "#{@filename}.html")
|
80
|
-
doc_converter(node)&.convert(@filename
|
82
|
+
doc_converter(node)&.convert("#{@filename}.presentation.xml",
|
81
83
|
nil, false, "#{@filename}.doc")
|
82
|
-
pdf_converter(node)&.convert(@filename
|
84
|
+
pdf_converter(node)&.convert("#{@filename}.presentation.xml",
|
83
85
|
nil, false, "#{@filename}.pdf")
|
84
|
-
|
85
86
|
end
|
86
87
|
|
87
88
|
def validate(doc)
|
@@ -106,7 +107,8 @@ module Asciidoctor
|
|
106
107
|
stages.empty? and return
|
107
108
|
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
108
109
|
stages.include? stage or
|
109
|
-
@log.add("Document Attributes", nil,
|
110
|
+
@log.add("Document Attributes", nil,
|
111
|
+
"#{stage} is not a recognised status")
|
110
112
|
end
|
111
113
|
|
112
114
|
def committee_validate(xmldoc)
|
@@ -114,13 +116,14 @@ module Asciidoctor
|
|
114
116
|
committees.empty? and return
|
115
117
|
xmldoc.xpath("//bibdata/ext/editorialgroup/committee").each do |c|
|
116
118
|
committees.include? c.text or
|
117
|
-
@log.add("Document Attributes", nil,
|
119
|
+
@log.add("Document Attributes", nil,
|
120
|
+
"#{c.text} is not a recognised committee")
|
118
121
|
end
|
119
122
|
end
|
120
123
|
|
121
|
-
def sections_cleanup(
|
124
|
+
def sections_cleanup(xml)
|
122
125
|
super
|
123
|
-
|
126
|
+
xml.xpath("//*[@inline-header]").each do |h|
|
124
127
|
h.delete("inline-header")
|
125
128
|
end
|
126
129
|
end
|
@@ -132,7 +135,8 @@ module Asciidoctor
|
|
132
135
|
end
|
133
136
|
|
134
137
|
def presentation_xml_converter(node)
|
135
|
-
IsoDoc::Generic::PresentationXMLConvert
|
138
|
+
IsoDoc::Generic::PresentationXMLConvert
|
139
|
+
.new(html_extract_attributes(node))
|
136
140
|
end
|
137
141
|
|
138
142
|
alias_method :pdf_converter, :html_converter
|
@@ -32,6 +32,18 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="section-title">
|
36
|
+
<element name="title">
|
37
|
+
<zeroOrMore>
|
38
|
+
<ref name="TextElement"/>
|
39
|
+
</zeroOrMore>
|
40
|
+
</element>
|
41
|
+
<zeroOrMore>
|
42
|
+
<element name="variant-title">
|
43
|
+
<ref name="TypedTitleString"/>
|
44
|
+
</element>
|
45
|
+
</zeroOrMore>
|
46
|
+
</define>
|
35
47
|
<define name="hyperlink">
|
36
48
|
<element name="link">
|
37
49
|
<attribute name="target">
|
@@ -45,6 +57,11 @@
|
|
45
57
|
<optional>
|
46
58
|
<attribute name="alt"/>
|
47
59
|
</optional>
|
60
|
+
<optional>
|
61
|
+
<attribute name="updatetype">
|
62
|
+
<data type="boolean"/>
|
63
|
+
</attribute>
|
64
|
+
</optional>
|
48
65
|
<text/>
|
49
66
|
</element>
|
50
67
|
</define>
|
@@ -153,15 +170,17 @@
|
|
153
170
|
<data type="boolean"/>
|
154
171
|
</attribute>
|
155
172
|
</optional>
|
156
|
-
<
|
157
|
-
<
|
158
|
-
<
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
173
|
+
<optional>
|
174
|
+
<attribute name="type">
|
175
|
+
<choice>
|
176
|
+
<value>roman</value>
|
177
|
+
<value>alphabet</value>
|
178
|
+
<value>arabic</value>
|
179
|
+
<value>roman_upper</value>
|
180
|
+
<value>alphabet_upper</value>
|
181
|
+
</choice>
|
182
|
+
</attribute>
|
183
|
+
</optional>
|
165
184
|
<oneOrMore>
|
166
185
|
<ref name="li"/>
|
167
186
|
</oneOrMore>
|
@@ -199,6 +218,18 @@
|
|
199
218
|
</zeroOrMore>
|
200
219
|
</element>
|
201
220
|
</define>
|
221
|
+
<define name="dt">
|
222
|
+
<element name="dt">
|
223
|
+
<optional>
|
224
|
+
<attribute name="id">
|
225
|
+
<data type="ID"/>
|
226
|
+
</attribute>
|
227
|
+
</optional>
|
228
|
+
<zeroOrMore>
|
229
|
+
<ref name="TextElement"/>
|
230
|
+
</zeroOrMore>
|
231
|
+
</element>
|
232
|
+
</define>
|
202
233
|
<define name="example">
|
203
234
|
<element name="example">
|
204
235
|
<attribute name="id">
|
@@ -543,6 +574,9 @@
|
|
543
574
|
</define>
|
544
575
|
<define name="BibDataExtensionType">
|
545
576
|
<ref name="doctype"/>
|
577
|
+
<optional>
|
578
|
+
<ref name="docsubtype"/>
|
579
|
+
</optional>
|
546
580
|
<optional>
|
547
581
|
<ref name="editorialgroup"/>
|
548
582
|
</optional>
|
@@ -876,8 +910,28 @@
|
|
876
910
|
</zeroOrMore>
|
877
911
|
</element>
|
878
912
|
</define>
|
913
|
+
<define name="pagebreak">
|
914
|
+
<element name="pagebreak">
|
915
|
+
<optional>
|
916
|
+
<attribute name="orientation">
|
917
|
+
<choice>
|
918
|
+
<value>landscape</value>
|
919
|
+
<value>portrait</value>
|
920
|
+
</choice>
|
921
|
+
</attribute>
|
922
|
+
</optional>
|
923
|
+
</element>
|
924
|
+
</define>
|
879
925
|
</include>
|
880
926
|
<!-- end overrides -->
|
927
|
+
<define name="docsubtype">
|
928
|
+
<element name="subdoctype">
|
929
|
+
<ref name="DocumentSubtype"/>
|
930
|
+
</element>
|
931
|
+
</define>
|
932
|
+
<define name="DocumentSubtype">
|
933
|
+
<text/>
|
934
|
+
</define>
|
881
935
|
<define name="colgroup">
|
882
936
|
<element name="colgroup">
|
883
937
|
<oneOrMore>
|
@@ -927,7 +981,44 @@
|
|
927
981
|
<define name="concept">
|
928
982
|
<element name="concept">
|
929
983
|
<optional>
|
930
|
-
<attribute name="
|
984
|
+
<attribute name="ital">
|
985
|
+
<data type="boolean"/>
|
986
|
+
</attribute>
|
987
|
+
</optional>
|
988
|
+
<optional>
|
989
|
+
<attribute name="ref">
|
990
|
+
<data type="boolean"/>
|
991
|
+
</attribute>
|
992
|
+
</optional>
|
993
|
+
<optional>
|
994
|
+
<attribute name="linkmention">
|
995
|
+
<data type="boolean"/>
|
996
|
+
</attribute>
|
997
|
+
</optional>
|
998
|
+
<optional>
|
999
|
+
<attribute name="linkref">
|
1000
|
+
<data type="boolean"/>
|
1001
|
+
</attribute>
|
1002
|
+
</optional>
|
1003
|
+
<optional>
|
1004
|
+
<element name="refterm">
|
1005
|
+
<zeroOrMore>
|
1006
|
+
<choice>
|
1007
|
+
<ref name="PureTextElement"/>
|
1008
|
+
<ref name="stem"/>
|
1009
|
+
</choice>
|
1010
|
+
</zeroOrMore>
|
1011
|
+
</element>
|
1012
|
+
</optional>
|
1013
|
+
<optional>
|
1014
|
+
<element name="renderterm">
|
1015
|
+
<zeroOrMore>
|
1016
|
+
<choice>
|
1017
|
+
<ref name="PureTextElement"/>
|
1018
|
+
<ref name="stem"/>
|
1019
|
+
</choice>
|
1020
|
+
</zeroOrMore>
|
1021
|
+
</element>
|
931
1022
|
</optional>
|
932
1023
|
<choice>
|
933
1024
|
<ref name="eref"/>
|
@@ -943,8 +1034,179 @@
|
|
943
1034
|
<ref name="permission"/>
|
944
1035
|
<ref name="imagemap"/>
|
945
1036
|
<ref name="svgmap"/>
|
1037
|
+
<ref name="inputform"/>
|
1038
|
+
<ref name="toc"/>
|
1039
|
+
</choice>
|
1040
|
+
</define>
|
1041
|
+
<define name="toc">
|
1042
|
+
<element name="toc">
|
1043
|
+
<ref name="ul"/>
|
1044
|
+
</element>
|
1045
|
+
</define>
|
1046
|
+
<define name="inputform">
|
1047
|
+
<element name="form">
|
1048
|
+
<attribute name="id">
|
1049
|
+
<data type="ID"/>
|
1050
|
+
</attribute>
|
1051
|
+
<attribute name="name"/>
|
1052
|
+
<attribute name="action"/>
|
1053
|
+
<optional>
|
1054
|
+
<attribute name="class"/>
|
1055
|
+
</optional>
|
1056
|
+
<zeroOrMore>
|
1057
|
+
<choice>
|
1058
|
+
<ref name="TextElement"/>
|
1059
|
+
<ref name="FormInput"/>
|
1060
|
+
</choice>
|
1061
|
+
</zeroOrMore>
|
1062
|
+
</element>
|
1063
|
+
</define>
|
1064
|
+
<define name="FormInput">
|
1065
|
+
<choice>
|
1066
|
+
<ref name="input"/>
|
1067
|
+
<ref name="formlabel"/>
|
1068
|
+
<ref name="select"/>
|
1069
|
+
<ref name="textarea"/>
|
946
1070
|
</choice>
|
947
1071
|
</define>
|
1072
|
+
<define name="InputType">
|
1073
|
+
<choice>
|
1074
|
+
<value>button</value>
|
1075
|
+
<value>checkbox</value>
|
1076
|
+
<value>date</value>
|
1077
|
+
<value>file</value>
|
1078
|
+
<value>password</value>
|
1079
|
+
<value>radio</value>
|
1080
|
+
<value>submit</value>
|
1081
|
+
<value>text</value>
|
1082
|
+
</choice>
|
1083
|
+
</define>
|
1084
|
+
<define name="input">
|
1085
|
+
<element name="input">
|
1086
|
+
<attribute name="type">
|
1087
|
+
<ref name="InputType"/>
|
1088
|
+
</attribute>
|
1089
|
+
<optional>
|
1090
|
+
<attribute name="checked">
|
1091
|
+
<data type="boolean"/>
|
1092
|
+
</attribute>
|
1093
|
+
</optional>
|
1094
|
+
<optional>
|
1095
|
+
<attribute name="disabled">
|
1096
|
+
<data type="boolean"/>
|
1097
|
+
</attribute>
|
1098
|
+
</optional>
|
1099
|
+
<optional>
|
1100
|
+
<attribute name="readonly">
|
1101
|
+
<data type="boolean"/>
|
1102
|
+
</attribute>
|
1103
|
+
</optional>
|
1104
|
+
<optional>
|
1105
|
+
<attribute name="maxlength">
|
1106
|
+
<data type="int"/>
|
1107
|
+
</attribute>
|
1108
|
+
</optional>
|
1109
|
+
<optional>
|
1110
|
+
<attribute name="minlength">
|
1111
|
+
<data type="int"/>
|
1112
|
+
</attribute>
|
1113
|
+
</optional>
|
1114
|
+
<optional>
|
1115
|
+
<attribute name="name"/>
|
1116
|
+
</optional>
|
1117
|
+
<optional>
|
1118
|
+
<attribute name="value"/>
|
1119
|
+
</optional>
|
1120
|
+
<optional>
|
1121
|
+
<attribute name="id">
|
1122
|
+
<data type="ID"/>
|
1123
|
+
</attribute>
|
1124
|
+
</optional>
|
1125
|
+
</element>
|
1126
|
+
</define>
|
1127
|
+
<define name="formlabel">
|
1128
|
+
<element name="label">
|
1129
|
+
<attribute name="for">
|
1130
|
+
<data type="IDREF"/>
|
1131
|
+
</attribute>
|
1132
|
+
<zeroOrMore>
|
1133
|
+
<ref name="PureTextElement"/>
|
1134
|
+
</zeroOrMore>
|
1135
|
+
</element>
|
1136
|
+
</define>
|
1137
|
+
<define name="select">
|
1138
|
+
<element name="select">
|
1139
|
+
<optional>
|
1140
|
+
<attribute name="name"/>
|
1141
|
+
</optional>
|
1142
|
+
<optional>
|
1143
|
+
<attribute name="value"/>
|
1144
|
+
</optional>
|
1145
|
+
<optional>
|
1146
|
+
<attribute name="id">
|
1147
|
+
<data type="ID"/>
|
1148
|
+
</attribute>
|
1149
|
+
</optional>
|
1150
|
+
<optional>
|
1151
|
+
<attribute name="disabled">
|
1152
|
+
<data type="boolean"/>
|
1153
|
+
</attribute>
|
1154
|
+
</optional>
|
1155
|
+
<optional>
|
1156
|
+
<attribute name="multiple">
|
1157
|
+
<data type="boolean"/>
|
1158
|
+
</attribute>
|
1159
|
+
</optional>
|
1160
|
+
<optional>
|
1161
|
+
<attribute name="size">
|
1162
|
+
<data type="int"/>
|
1163
|
+
</attribute>
|
1164
|
+
</optional>
|
1165
|
+
<oneOrMore>
|
1166
|
+
<ref name="option"/>
|
1167
|
+
</oneOrMore>
|
1168
|
+
</element>
|
1169
|
+
</define>
|
1170
|
+
<define name="option">
|
1171
|
+
<element name="option">
|
1172
|
+
<optional>
|
1173
|
+
<attribute name="disabled">
|
1174
|
+
<data type="boolean"/>
|
1175
|
+
</attribute>
|
1176
|
+
</optional>
|
1177
|
+
<optional>
|
1178
|
+
<attribute name="value"/>
|
1179
|
+
</optional>
|
1180
|
+
<zeroOrMore>
|
1181
|
+
<ref name="PureTextElement"/>
|
1182
|
+
</zeroOrMore>
|
1183
|
+
</element>
|
1184
|
+
</define>
|
1185
|
+
<define name="textarea">
|
1186
|
+
<element name="textarea">
|
1187
|
+
<optional>
|
1188
|
+
<attribute name="name"/>
|
1189
|
+
</optional>
|
1190
|
+
<optional>
|
1191
|
+
<attribute name="value"/>
|
1192
|
+
</optional>
|
1193
|
+
<optional>
|
1194
|
+
<attribute name="id">
|
1195
|
+
<data type="ID"/>
|
1196
|
+
</attribute>
|
1197
|
+
</optional>
|
1198
|
+
<optional>
|
1199
|
+
<attribute name="rows">
|
1200
|
+
<data type="int"/>
|
1201
|
+
</attribute>
|
1202
|
+
</optional>
|
1203
|
+
<optional>
|
1204
|
+
<attribute name="cols">
|
1205
|
+
<data type="int"/>
|
1206
|
+
</attribute>
|
1207
|
+
</optional>
|
1208
|
+
</element>
|
1209
|
+
</define>
|
948
1210
|
<define name="bibliography">
|
949
1211
|
<element name="bibliography">
|
950
1212
|
<oneOrMore>
|
@@ -1017,13 +1279,17 @@
|
|
1017
1279
|
</define>
|
1018
1280
|
<define name="IsoWorkgroup">
|
1019
1281
|
<optional>
|
1020
|
-
<attribute name="number"
|
1021
|
-
<data type="int"/>
|
1022
|
-
</attribute>
|
1282
|
+
<attribute name="number"/>
|
1023
1283
|
</optional>
|
1024
1284
|
<optional>
|
1025
1285
|
<attribute name="type"/>
|
1026
1286
|
</optional>
|
1287
|
+
<optional>
|
1288
|
+
<attribute name="identifier"/>
|
1289
|
+
</optional>
|
1290
|
+
<optional>
|
1291
|
+
<attribute name="prefix"/>
|
1292
|
+
</optional>
|
1027
1293
|
<text/>
|
1028
1294
|
</define>
|
1029
1295
|
<define name="ics">
|
@@ -1285,26 +1551,26 @@
|
|
1285
1551
|
<optional>
|
1286
1552
|
<ref name="section-title"/>
|
1287
1553
|
</optional>
|
1288
|
-
<
|
1554
|
+
<choice>
|
1289
1555
|
<choice>
|
1290
1556
|
<group>
|
1291
|
-
<
|
1557
|
+
<oneOrMore>
|
1292
1558
|
<ref name="BasicBlock"/>
|
1293
|
-
</
|
1559
|
+
</oneOrMore>
|
1294
1560
|
<zeroOrMore>
|
1295
1561
|
<ref name="note"/>
|
1296
1562
|
</zeroOrMore>
|
1297
1563
|
</group>
|
1298
1564
|
<ref name="amend"/>
|
1299
1565
|
</choice>
|
1300
|
-
<
|
1566
|
+
<oneOrMore>
|
1301
1567
|
<choice>
|
1302
1568
|
<ref name="clause-subsection"/>
|
1303
1569
|
<ref name="terms"/>
|
1304
1570
|
<ref name="definitions"/>
|
1305
1571
|
</choice>
|
1306
|
-
</
|
1307
|
-
</
|
1572
|
+
</oneOrMore>
|
1573
|
+
</choice>
|
1308
1574
|
</define>
|
1309
1575
|
<define name="Annex-Section">
|
1310
1576
|
<optional>
|
@@ -1444,7 +1710,9 @@
|
|
1444
1710
|
<zeroOrMore>
|
1445
1711
|
<ref name="termgrammar"/>
|
1446
1712
|
</zeroOrMore>
|
1447
|
-
<
|
1713
|
+
<oneOrMore>
|
1714
|
+
<ref name="termdefinition"/>
|
1715
|
+
</oneOrMore>
|
1448
1716
|
<zeroOrMore>
|
1449
1717
|
<ref name="termnote"/>
|
1450
1718
|
</zeroOrMore>
|
@@ -1507,7 +1775,7 @@
|
|
1507
1775
|
</oneOrMore>
|
1508
1776
|
</element>
|
1509
1777
|
</define>
|
1510
|
-
<define name="
|
1778
|
+
<define name="termdefinition">
|
1511
1779
|
<element name="definition">
|
1512
1780
|
<oneOrMore>
|
1513
1781
|
<choice>
|
@@ -1516,6 +1784,9 @@
|
|
1516
1784
|
<ref name="formula"/>
|
1517
1785
|
</choice>
|
1518
1786
|
</oneOrMore>
|
1787
|
+
<zeroOrMore>
|
1788
|
+
<ref name="termsource"/>
|
1789
|
+
</zeroOrMore>
|
1519
1790
|
</element>
|
1520
1791
|
</define>
|
1521
1792
|
<define name="termnote">
|
@@ -64,9 +64,9 @@
|
|
64
64
|
<optional>
|
65
65
|
<ref name="label"/>
|
66
66
|
</optional>
|
67
|
-
<
|
67
|
+
<zeroOrMore>
|
68
68
|
<ref name="subject"/>
|
69
|
-
</
|
69
|
+
</zeroOrMore>
|
70
70
|
<zeroOrMore>
|
71
71
|
<ref name="reqinherit"/>
|
72
72
|
</zeroOrMore>
|
@@ -80,6 +80,7 @@
|
|
80
80
|
<ref name="verification"/>
|
81
81
|
<ref name="import"/>
|
82
82
|
<ref name="description"/>
|
83
|
+
<ref name="component"/>
|
83
84
|
</choice>
|
84
85
|
</zeroOrMore>
|
85
86
|
<optional>
|
@@ -105,12 +106,16 @@
|
|
105
106
|
</define>
|
106
107
|
<define name="subject">
|
107
108
|
<element name="subject">
|
108
|
-
<
|
109
|
+
<oneOrMore>
|
110
|
+
<ref name="TextElement"/>
|
111
|
+
</oneOrMore>
|
109
112
|
</element>
|
110
113
|
</define>
|
111
114
|
<define name="reqinherit">
|
112
115
|
<element name="inherit">
|
113
|
-
<
|
116
|
+
<oneOrMore>
|
117
|
+
<ref name="TextElement"/>
|
118
|
+
</oneOrMore>
|
114
119
|
</element>
|
115
120
|
</define>
|
116
121
|
<define name="measurementtarget">
|
@@ -138,6 +143,12 @@
|
|
138
143
|
<ref name="RequirementSubpart"/>
|
139
144
|
</element>
|
140
145
|
</define>
|
146
|
+
<define name="component">
|
147
|
+
<element name="component">
|
148
|
+
<attribute name="class"/>
|
149
|
+
<ref name="RequirementSubpart"/>
|
150
|
+
</element>
|
151
|
+
</define>
|
141
152
|
<define name="reqt_references">
|
142
153
|
<element name="references">
|
143
154
|
<oneOrMore>
|
@@ -4,20 +4,20 @@ require_relative "init"
|
|
4
4
|
require_relative "utils"
|
5
5
|
|
6
6
|
class Nokogiri::XML::Node
|
7
|
-
TYPENAMES = {1=>
|
7
|
+
TYPENAMES = { 1 => "element", 2 => "attribute", 3 => "text",
|
8
|
+
4 => "cdata", 8 => "comment" }.freeze
|
8
9
|
def to_hash
|
9
|
-
|
10
|
-
h
|
10
|
+
{ kind: TYPENAMES[node_type], name: name }.tap do |h|
|
11
|
+
h[:text] = text&.strip
|
11
12
|
a = attribute_nodes.map(&:to_hash)
|
12
13
|
if element? && !a.empty?
|
13
|
-
h
|
14
|
+
h[:attr] = a.inject({}) { |m, v| m[v[:name]] = v[:text]; m }
|
14
15
|
end
|
15
16
|
c = children.map(&:to_hash)
|
16
17
|
if element? && !(c&.size == 1 && c[0][:kind] == "text")
|
17
18
|
h.merge! kids: c.delete_if { |n| n[:kind] == "text" && n[:text].empty? }
|
18
19
|
end
|
19
20
|
end
|
20
|
-
ret
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -27,15 +27,16 @@ end
|
|
27
27
|
|
28
28
|
module IsoDoc
|
29
29
|
module Generic
|
30
|
-
|
31
30
|
class Metadata < IsoDoc::Metadata
|
32
31
|
def initialize(lang, script, labels)
|
33
32
|
super
|
34
33
|
here = File.dirname(__FILE__)
|
35
|
-
default_logo_path =
|
34
|
+
default_logo_path =
|
35
|
+
File.expand_path(File.join(here, "html", "logo.jpg"))
|
36
36
|
set(:logo, baselocation(configuration.logo_path) || default_logo_path)
|
37
37
|
unless configuration.logo_paths.nil?
|
38
|
-
set(:logo_paths,
|
38
|
+
set(:logo_paths,
|
39
|
+
Array(configuration.logo_paths).map { |p| baselocation(p) })
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -43,8 +44,8 @@ module IsoDoc
|
|
43
44
|
attr_accessor :_file
|
44
45
|
end
|
45
46
|
|
46
|
-
def self.inherited(
|
47
|
-
|
47
|
+
def self.inherited(klass) # rubocop:disable Lint/MissingSuper
|
48
|
+
klass._file = caller_locations(1..1).first.absolute_path
|
48
49
|
end
|
49
50
|
|
50
51
|
def author(isoxml, _out)
|
@@ -55,6 +56,7 @@ module IsoDoc
|
|
55
56
|
|
56
57
|
def stage_abbr(status)
|
57
58
|
return super unless configuration.stage_abbreviations
|
59
|
+
|
58
60
|
Hash(configuration.stage_abbreviations).dig(status)
|
59
61
|
end
|
60
62
|
|
@@ -65,32 +67,35 @@ module IsoDoc
|
|
65
67
|
|
66
68
|
def doctype(isoxml, _out)
|
67
69
|
super
|
68
|
-
b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
|
70
|
+
b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
|
69
71
|
isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}")) || return
|
70
72
|
a = b["abbreviation"] and set(:doctype_abbr, a)
|
71
73
|
end
|
72
74
|
|
73
|
-
def xmlhash2hash(
|
75
|
+
def xmlhash2hash(hash)
|
74
76
|
ret = {}
|
75
|
-
return ret if
|
76
|
-
|
77
|
-
|
77
|
+
return ret if hash.nil? || hash[:kind] != "element"
|
78
|
+
|
79
|
+
hash[:attr].nil? or
|
80
|
+
hash[:attr].each { |k, v| ret["#{hash[:name]}_#{k}"] = v }
|
81
|
+
ret[hash[:name]] = hash[:kids] ? xmlhash2hash_kids(hash) : hash[:text]
|
78
82
|
ret
|
79
83
|
end
|
80
84
|
|
81
|
-
def xmlhash2hash_kids(
|
85
|
+
def xmlhash2hash_kids(hash)
|
82
86
|
c = {}
|
83
|
-
|
87
|
+
hash[:kids].each do |n|
|
84
88
|
xmlhash2hash(n).each do |k1, v1|
|
85
|
-
c[k1] = c[k1].nil?
|
86
|
-
|
87
|
-
|
89
|
+
c[k1] = if c[k1].nil? then v1
|
90
|
+
elsif c[k1].is_a?(Array) then c[k1] << v1
|
91
|
+
else [c[k1], v1]
|
92
|
+
end
|
88
93
|
end
|
89
94
|
end
|
90
95
|
c
|
91
96
|
end
|
92
97
|
|
93
|
-
def ext(isoxml,
|
98
|
+
def ext(isoxml, _out)
|
94
99
|
b = isoxml&.at(ns("//bibdata/ext")) or return
|
95
100
|
set(:metadata_extensions, xmlhash2hash(b.to_hash)["ext"])
|
96
101
|
end
|
data/lib/isodoc/generic.rb
CHANGED
@@ -17,7 +17,6 @@ module Metanorma
|
|
17
17
|
super.merge(
|
18
18
|
html: "html",
|
19
19
|
doc: "doc",
|
20
|
-
pdf: "pdf"
|
21
20
|
)
|
22
21
|
end
|
23
22
|
|
@@ -44,8 +43,6 @@ module Metanorma
|
|
44
43
|
IsoDoc::Generic::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
45
44
|
when :doc
|
46
45
|
IsoDoc::Generic::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
47
|
-
when :pdf
|
48
|
-
IsoDoc::Generic::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
49
46
|
when :presentation
|
50
47
|
IsoDoc::Generic::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
51
48
|
else
|
data/lib/metanorma/generic.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require "metanorma/generic/processor"
|
2
2
|
require "metanorma/generic/version"
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "forwardable"
|
4
|
+
require "yaml"
|
5
5
|
|
6
6
|
module Metanorma
|
7
7
|
module Generic
|
8
8
|
ORGANIZATION_NAME_SHORT = "Acme"
|
9
9
|
ORGANIZATION_NAME_LONG = "Acme Corp."
|
10
10
|
DOCUMENT_NAMESPACE = "https://www.metanorma.org/ns/generic"
|
11
|
-
YAML_CONFIG_FILE =
|
11
|
+
YAML_CONFIG_FILE = "metanorma.yml"
|
12
12
|
|
13
13
|
class Configuration
|
14
14
|
CONFIG_ATTRS = %i[
|
@@ -63,7 +63,7 @@ module Metanorma
|
|
63
63
|
].freeze
|
64
64
|
|
65
65
|
def filepath_attrs
|
66
|
-
|
66
|
+
%i[
|
67
67
|
i18nyaml
|
68
68
|
boilerplate
|
69
69
|
logo_path
|
@@ -88,24 +88,26 @@ module Metanorma
|
|
88
88
|
attr_accessor :_file
|
89
89
|
end
|
90
90
|
|
91
|
-
def self.inherited(
|
92
|
-
|
91
|
+
def self.inherited(klass)
|
92
|
+
klass._file = caller_locations(1..1).first.absolute_path
|
93
93
|
end
|
94
94
|
|
95
95
|
def initialize(*args)
|
96
96
|
super
|
97
97
|
# Try to set config values from yaml file in current directory
|
98
|
-
@yaml = File.join(File.dirname(self.class::_file || __FILE__), "..",
|
98
|
+
@yaml = File.join(File.dirname(self.class::_file || __FILE__), "..",
|
99
|
+
"..", YAML_CONFIG_FILE)
|
99
100
|
set_default_values_from_yaml_file(@yaml) if File.file?(@yaml)
|
100
101
|
self.organization_name_short ||= ORGANIZATION_NAME_SHORT
|
101
102
|
self.organization_name_long ||= ORGANIZATION_NAME_LONG
|
102
103
|
self.document_namespace ||= DOCUMENT_NAMESPACE
|
103
|
-
self.termsdefs_titles ||=
|
104
|
+
self.termsdefs_titles ||=
|
104
105
|
["Terms and definitions", "Terms, definitions, symbols and abbreviated terms",
|
105
106
|
"Terms, definitions, symbols and abbreviations", "Terms, definitions and symbols",
|
106
107
|
"Terms, definitions and abbreviations", "Terms, definitions and abbreviated terms"]
|
107
108
|
self.symbols_titles ||=
|
108
|
-
["Symbols and abbreviated terms", "Symbols", "Abbreviated terms",
|
109
|
+
["Symbols and abbreviated terms", "Symbols", "Abbreviated terms",
|
110
|
+
"Abbreviations"]
|
109
111
|
self.normref_titles ||=
|
110
112
|
["Normative references"]
|
111
113
|
self.bibliography_titles ||= ["Bibliography"]
|
@@ -114,9 +116,11 @@ module Metanorma
|
|
114
116
|
def set_default_values_from_yaml_file(config_file)
|
115
117
|
root_path = File.dirname(self.class::_file || __FILE__)
|
116
118
|
default_config_options = YAML.load(File.read(config_file))
|
117
|
-
if default_config_options["doctypes"]
|
118
|
-
default_config_options["doctypes"] =
|
119
|
-
each_with_object({})
|
119
|
+
if default_config_options["doctypes"].is_a? Array
|
120
|
+
default_config_options["doctypes"] =
|
121
|
+
default_config_options["doctypes"].each_with_object({}) do |k, m|
|
122
|
+
m[k] = nil
|
123
|
+
end
|
120
124
|
end
|
121
125
|
CONFIG_ATTRS.each do |attr_name|
|
122
126
|
value = default_config_options[attr_name.to_s]
|
@@ -128,8 +132,8 @@ module Metanorma
|
|
128
132
|
end
|
129
133
|
end
|
130
134
|
|
131
|
-
def blank?(
|
132
|
-
|
135
|
+
def blank?(val)
|
136
|
+
val.nil? || val.respond_to?(:empty?) && val.empty?
|
133
137
|
end
|
134
138
|
|
135
139
|
def absolute_path(value, root_path)
|
@@ -145,14 +149,14 @@ module Metanorma
|
|
145
149
|
end
|
146
150
|
end
|
147
151
|
|
148
|
-
def absolute_path1(
|
149
|
-
|
152
|
+
def absolute_path1(hash, pref)
|
153
|
+
hash.reject { |_k, v| blank?(v) }
|
154
|
+
.each_with_object({}) do |(k, v), g|
|
150
155
|
g[k] = absolute_path(v, pref)
|
151
156
|
end
|
152
157
|
end
|
153
158
|
end
|
154
159
|
|
155
|
-
|
156
160
|
class << self
|
157
161
|
extend Forwardable
|
158
162
|
|
data/metanorma-generic.gemspec
CHANGED
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.bindir = "exe"
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ["lib"]
|
27
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
27
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
29
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
|
-
spec.add_dependency "isodoc", "~> 1.
|
31
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
30
|
+
spec.add_dependency "isodoc", "~> 1.7.0"
|
31
|
+
spec.add_dependency "metanorma-standoc", "~> 1.10.0"
|
32
32
|
spec.add_dependency "ruby-jing"
|
33
33
|
|
34
34
|
spec.add_development_dependency "byebug", "~> 9.1"
|
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.10.
|
4
|
+
version: 1.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.7.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.7.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: metanorma-standoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.10.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.10.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: ruby-jing
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -251,7 +251,6 @@ files:
|
|
251
251
|
- lib/isodoc/generic/i18n.rb
|
252
252
|
- lib/isodoc/generic/init.rb
|
253
253
|
- lib/isodoc/generic/metadata.rb
|
254
|
-
- lib/isodoc/generic/pdf_convert.rb
|
255
254
|
- lib/isodoc/generic/presentation_xml_convert.rb
|
256
255
|
- lib/isodoc/generic/utils.rb
|
257
256
|
- lib/isodoc/generic/word_convert.rb
|
@@ -275,7 +274,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
275
274
|
requirements:
|
276
275
|
- - ">="
|
277
276
|
- !ruby/object:Gem::Version
|
278
|
-
version: 2.
|
277
|
+
version: 2.5.0
|
279
278
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
279
|
requirements:
|
281
280
|
- - ">="
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require_relative "base_convert"
|
2
|
-
require_relative "init"
|
3
|
-
require "isodoc"
|
4
|
-
|
5
|
-
module IsoDoc
|
6
|
-
module Generic
|
7
|
-
# A {Converter} implementation that generates PDF HTML output, and a
|
8
|
-
# document schema encapsulation of the document for validation
|
9
|
-
class PdfConvert < IsoDoc::PdfConvert
|
10
|
-
def initialize(options)
|
11
|
-
@libdir = File.dirname(__FILE__)
|
12
|
-
super
|
13
|
-
end
|
14
|
-
|
15
|
-
class << self
|
16
|
-
attr_accessor :_file
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.inherited( k )
|
20
|
-
k._file = caller_locations.first.absolute_path
|
21
|
-
end
|
22
|
-
|
23
|
-
def default_fonts(options)
|
24
|
-
{
|
25
|
-
bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif'
|
26
|
-
: configuration.html_bodyfont || '"Overpass",sans-serif'),
|
27
|
-
headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
|
28
|
-
configuration.html_headerfont || '"Overpass",sans-serif'),
|
29
|
-
monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
|
30
|
-
}.transform_values { |v| v&.empty? ? nil : v }
|
31
|
-
end
|
32
|
-
|
33
|
-
def default_file_locations(_options)
|
34
|
-
{
|
35
|
-
htmlstylesheet: baselocation(configuration.htmlstylesheet) ||
|
36
|
-
html_doc_path("htmlstyle.scss"),
|
37
|
-
htmlcoverpage: baselocation(configuration.htmlcoverpage) ||
|
38
|
-
html_doc_path("html_generic_titlepage.html"),
|
39
|
-
htmlintropage: baselocation(configuration.htmlintropage) ||
|
40
|
-
html_doc_path("html_generic_intro.html"),
|
41
|
-
scripts_pdf: baselocation(configuration.scripts_pdf) ||
|
42
|
-
html_doc_path("scripts.pdf.html")
|
43
|
-
}.transform_values { |v| v&.empty? ? nil : v }
|
44
|
-
end
|
45
|
-
|
46
|
-
def googlefonts
|
47
|
-
<<~HEAD.freeze
|
48
|
-
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
|
49
|
-
<link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
|
50
|
-
HEAD
|
51
|
-
end
|
52
|
-
|
53
|
-
def html_toc(docxml)
|
54
|
-
docxml
|
55
|
-
end
|
56
|
-
|
57
|
-
def configuration
|
58
|
-
Metanorma::Generic.configuration
|
59
|
-
end
|
60
|
-
|
61
|
-
include BaseConvert
|
62
|
-
include Init
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|