metanorma-generic 1.4.10 → 1.6.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/macos.yml +0 -1
- data/.github/workflows/ubuntu.yml +10 -7
- data/.github/workflows/windows.yml +0 -1
- data/lib/asciidoctor/generic/biblio.rng +1 -1
- data/lib/asciidoctor/generic/converter.rb +24 -47
- data/lib/asciidoctor/generic/isodoc.rng +443 -7
- data/lib/asciidoctor/generic/reqt.rng +23 -0
- data/lib/isodoc/generic.rb +1 -0
- data/lib/isodoc/generic/base_convert.rb +4 -25
- data/lib/isodoc/generic/html_convert.rb +5 -1
- data/lib/isodoc/generic/init.rb +27 -0
- data/lib/isodoc/generic/metadata.rb +2 -1
- data/lib/isodoc/generic/pdf_convert.rb +2 -0
- data/lib/isodoc/generic/presentation_xml_convert.rb +19 -0
- data/lib/isodoc/generic/word_convert.rb +6 -2
- data/lib/isodoc/generic/xref.rb +6 -0
- data/lib/metanorma/generic/processor.rb +6 -8
- data/lib/metanorma/generic/version.rb +1 -1
- data/metanorma-generic.gemspec +3 -2
- metadata +27 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4051c5aaaa0b9eb7a8830a501f63f0d31ac188bcf2da6eff4a2569370c191798
|
4
|
+
data.tar.gz: cff9b18009cd0b594bde8789c05318e5ec357f1c5e31fe2d7e20ef58c2cede1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9602b51e4a9b97efeddbe0f844bb189cc9f1f251266a88ef9ba3fa5efb534aa35991f079248f4669c59800cc7b2e3910b20c3c8ee14b3df49a57cf4478ff0b9c
|
7
|
+
data.tar.gz: 6bc8966b060289541a0702cdee8ad9be5d8707b03d6812673bbea05fedb3748d8b381c7115ecdb5c341bd4aa847b7c3122740a03d6ef6200b87d83e7145867a8
|
data/.github/workflows/macos.yml
CHANGED
@@ -31,7 +31,6 @@ jobs:
|
|
31
31
|
uses: actions/setup-ruby@v1
|
32
32
|
with:
|
33
33
|
ruby-version: ${{ matrix.ruby }}
|
34
|
-
architecture: 'x64'
|
35
34
|
- name: Update gems
|
36
35
|
run: |
|
37
36
|
gem install bundler
|
@@ -39,15 +38,19 @@ jobs:
|
|
39
38
|
- name: Run specs
|
40
39
|
run: |
|
41
40
|
bundle exec rake
|
42
|
-
- name: Trigger
|
43
|
-
if:
|
41
|
+
- name: Trigger repositories
|
42
|
+
if: matrix.ruby == '2.6'
|
44
43
|
env:
|
45
|
-
GH_USERNAME:
|
46
|
-
GH_ACCESS_TOKEN: ${{ secrets.
|
44
|
+
GH_USERNAME: metanorma-ci
|
45
|
+
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
47
46
|
run: |
|
48
47
|
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
49
48
|
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
50
|
-
|
49
|
+
CLIENT_PAYLOAD=$(cat <<EOF
|
50
|
+
"{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
|
51
|
+
EOF
|
52
|
+
)
|
53
|
+
for repo in $REPOS
|
51
54
|
do
|
52
|
-
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "
|
55
|
+
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
|
53
56
|
done
|
@@ -532,7 +532,7 @@
|
|
532
532
|
</define>
|
533
533
|
<define name="LocalityType">
|
534
534
|
<data type="string">
|
535
|
-
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|locality:[a-zA-Z0-9_]+</param>
|
535
|
+
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
536
536
|
</data>
|
537
537
|
</define>
|
538
538
|
<define name="referenceFrom">
|
@@ -24,26 +24,12 @@ module Asciidoctor
|
|
24
24
|
|
25
25
|
def baselocation(loc)
|
26
26
|
return nil if loc.nil?
|
27
|
-
File.expand_path(File.join(File.dirname(
|
27
|
+
File.expand_path(File.join(File.dirname(
|
28
|
+
self.class::_file || __FILE__), "..", "..", "..", loc))
|
28
29
|
end
|
29
30
|
|
30
|
-
def
|
31
|
-
|
32
|
-
c.role **{ type: "author" }
|
33
|
-
c.organization do |a|
|
34
|
-
a.name configuration.organization_name_long
|
35
|
-
end
|
36
|
-
end
|
37
|
-
personal_author(node, xml)
|
38
|
-
end
|
39
|
-
|
40
|
-
def metadata_publisher(node, xml)
|
41
|
-
xml.contributor do |c|
|
42
|
-
c.role **{ type: "publisher" }
|
43
|
-
c.organization do |a|
|
44
|
-
a.name configuration.organization_name_long
|
45
|
-
end
|
46
|
-
end
|
31
|
+
def default_publisher
|
32
|
+
configuration.organization_name_long
|
47
33
|
end
|
48
34
|
|
49
35
|
def metadata_committee(node, xml)
|
@@ -85,18 +71,6 @@ module Asciidoctor
|
|
85
71
|
xml.docnumber { |i| i << node.attr("docnumber") }
|
86
72
|
end
|
87
73
|
|
88
|
-
def metadata_copyright(node, xml)
|
89
|
-
from = node.attr("copyright-year") || Date.today.year
|
90
|
-
xml.copyright do |c|
|
91
|
-
c.from from
|
92
|
-
c.owner do |owner|
|
93
|
-
owner.organization do |o|
|
94
|
-
o.name configuration.organization_name_long
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
74
|
def metadata_ext(node, ext)
|
101
75
|
super
|
102
76
|
Array(configuration.metadata_extensions).each do |e|
|
@@ -105,7 +79,7 @@ module Asciidoctor
|
|
105
79
|
end
|
106
80
|
|
107
81
|
def doctype(node)
|
108
|
-
d =
|
82
|
+
d = super
|
109
83
|
configuration.doctypes or return d == "article" ? "standard" : d
|
110
84
|
default = configuration.default_doctype || Array(configuration.doctypes).dig(0) ||
|
111
85
|
"standard"
|
@@ -138,20 +112,19 @@ module Asciidoctor
|
|
138
112
|
|
139
113
|
def document(node)
|
140
114
|
read_config_file(node.attr("customize")) if node.attr("customize")
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
ret
|
115
|
+
super
|
116
|
+
end
|
117
|
+
|
118
|
+
def outputs(node, ret)
|
119
|
+
File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
|
120
|
+
presentation_xml_converter(node).convert(@filename + ".xml")
|
121
|
+
html_converter(node).convert(@filename + ".presentation.xml",
|
122
|
+
nil, false, "#{@filename}.html")
|
123
|
+
doc_converter(node).convert(@filename + ".presentation.xml",
|
124
|
+
nil, false, "#{@filename}.doc")
|
125
|
+
pdf_converter(node)&.convert(@filename + ".presentation.xml",
|
126
|
+
nil, false, "#{@filename}.pdf")
|
127
|
+
|
155
128
|
end
|
156
129
|
|
157
130
|
def validate(doc)
|
@@ -191,11 +164,15 @@ module Asciidoctor
|
|
191
164
|
IsoDoc::Generic::HtmlConvert.new(html_extract_attributes(node))
|
192
165
|
end
|
193
166
|
|
167
|
+
def presentation_xml_converter(node)
|
168
|
+
IsoDoc::Generic::PresentationXMLConvert.new(html_extract_attributes(node))
|
169
|
+
end
|
170
|
+
|
194
171
|
alias_method :pdf_converter, :html_converter
|
195
172
|
alias_method :style, :blank_method
|
196
173
|
alias_method :title_validate, :blank_method
|
197
174
|
|
198
|
-
def
|
175
|
+
def doc_converter(node)
|
199
176
|
IsoDoc::Generic::WordConvert.new(doc_extract_attributes(node))
|
200
177
|
end
|
201
178
|
|
@@ -206,7 +183,7 @@ module Asciidoctor
|
|
206
183
|
def boilerplate_isodoc(xmldoc)
|
207
184
|
conv = super
|
208
185
|
Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
|
209
|
-
conv.
|
186
|
+
conv.i18n.set(a, configuration.send(a))
|
210
187
|
end
|
211
188
|
conv
|
212
189
|
end
|
@@ -42,8 +42,11 @@
|
|
42
42
|
</define>
|
43
43
|
<define name="xref">
|
44
44
|
<element name="xref">
|
45
|
+
<!-- attribute target { xsd:IDREF }, -->
|
45
46
|
<attribute name="target">
|
46
|
-
<data type="
|
47
|
+
<data type="string">
|
48
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
49
|
+
</data>
|
47
50
|
</attribute>
|
48
51
|
<optional>
|
49
52
|
<attribute name="type">
|
@@ -64,6 +67,85 @@
|
|
64
67
|
<text/>
|
65
68
|
</element>
|
66
69
|
</define>
|
70
|
+
<define name="ul">
|
71
|
+
<element name="ul">
|
72
|
+
<attribute name="id">
|
73
|
+
<data type="ID"/>
|
74
|
+
</attribute>
|
75
|
+
<optional>
|
76
|
+
<attribute name="keep-with-next">
|
77
|
+
<data type="boolean"/>
|
78
|
+
</attribute>
|
79
|
+
</optional>
|
80
|
+
<optional>
|
81
|
+
<attribute name="keep-lines-together">
|
82
|
+
<data type="boolean"/>
|
83
|
+
</attribute>
|
84
|
+
</optional>
|
85
|
+
<oneOrMore>
|
86
|
+
<ref name="li"/>
|
87
|
+
</oneOrMore>
|
88
|
+
<zeroOrMore>
|
89
|
+
<ref name="note"/>
|
90
|
+
</zeroOrMore>
|
91
|
+
</element>
|
92
|
+
</define>
|
93
|
+
<define name="ol">
|
94
|
+
<element name="ol">
|
95
|
+
<attribute name="id">
|
96
|
+
<data type="ID"/>
|
97
|
+
</attribute>
|
98
|
+
<optional>
|
99
|
+
<attribute name="keep-with-next">
|
100
|
+
<data type="boolean"/>
|
101
|
+
</attribute>
|
102
|
+
</optional>
|
103
|
+
<optional>
|
104
|
+
<attribute name="keep-lines-together">
|
105
|
+
<data type="boolean"/>
|
106
|
+
</attribute>
|
107
|
+
</optional>
|
108
|
+
<attribute name="type">
|
109
|
+
<choice>
|
110
|
+
<value>roman</value>
|
111
|
+
<value>alphabet</value>
|
112
|
+
<value>arabic</value>
|
113
|
+
<value>roman_upper</value>
|
114
|
+
<value>alphabet_upper</value>
|
115
|
+
</choice>
|
116
|
+
</attribute>
|
117
|
+
<oneOrMore>
|
118
|
+
<ref name="li"/>
|
119
|
+
</oneOrMore>
|
120
|
+
<zeroOrMore>
|
121
|
+
<ref name="note"/>
|
122
|
+
</zeroOrMore>
|
123
|
+
</element>
|
124
|
+
</define>
|
125
|
+
<define name="dl">
|
126
|
+
<element name="dl">
|
127
|
+
<attribute name="id">
|
128
|
+
<data type="ID"/>
|
129
|
+
</attribute>
|
130
|
+
<optional>
|
131
|
+
<attribute name="keep-with-next">
|
132
|
+
<data type="boolean"/>
|
133
|
+
</attribute>
|
134
|
+
</optional>
|
135
|
+
<optional>
|
136
|
+
<attribute name="keep-lines-together">
|
137
|
+
<data type="boolean"/>
|
138
|
+
</attribute>
|
139
|
+
</optional>
|
140
|
+
<oneOrMore>
|
141
|
+
<ref name="dt"/>
|
142
|
+
<ref name="dd"/>
|
143
|
+
</oneOrMore>
|
144
|
+
<zeroOrMore>
|
145
|
+
<ref name="note"/>
|
146
|
+
</zeroOrMore>
|
147
|
+
</element>
|
148
|
+
</define>
|
67
149
|
<define name="example">
|
68
150
|
<element name="example">
|
69
151
|
<attribute name="id">
|
@@ -77,6 +159,19 @@
|
|
77
159
|
<optional>
|
78
160
|
<attribute name="subsequence"/>
|
79
161
|
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="number"/>
|
164
|
+
</optional>
|
165
|
+
<optional>
|
166
|
+
<attribute name="keep-with-next">
|
167
|
+
<data type="boolean"/>
|
168
|
+
</attribute>
|
169
|
+
</optional>
|
170
|
+
<optional>
|
171
|
+
<attribute name="keep-lines-together">
|
172
|
+
<data type="boolean"/>
|
173
|
+
</attribute>
|
174
|
+
</optional>
|
80
175
|
<optional>
|
81
176
|
<ref name="tname"/>
|
82
177
|
</optional>
|
@@ -97,6 +192,296 @@
|
|
97
192
|
</zeroOrMore>
|
98
193
|
</element>
|
99
194
|
</define>
|
195
|
+
<define name="table">
|
196
|
+
<element name="table">
|
197
|
+
<attribute name="id">
|
198
|
+
<data type="ID"/>
|
199
|
+
</attribute>
|
200
|
+
<optional>
|
201
|
+
<attribute name="unnumbered">
|
202
|
+
<data type="boolean"/>
|
203
|
+
</attribute>
|
204
|
+
</optional>
|
205
|
+
<optional>
|
206
|
+
<attribute name="number"/>
|
207
|
+
</optional>
|
208
|
+
<optional>
|
209
|
+
<attribute name="subsequence"/>
|
210
|
+
</optional>
|
211
|
+
<optional>
|
212
|
+
<attribute name="alt"/>
|
213
|
+
</optional>
|
214
|
+
<optional>
|
215
|
+
<attribute name="summary"/>
|
216
|
+
</optional>
|
217
|
+
<optional>
|
218
|
+
<attribute name="uri">
|
219
|
+
<data type="anyURI"/>
|
220
|
+
</attribute>
|
221
|
+
</optional>
|
222
|
+
<optional>
|
223
|
+
<attribute name="keep-with-next">
|
224
|
+
<data type="boolean"/>
|
225
|
+
</attribute>
|
226
|
+
</optional>
|
227
|
+
<optional>
|
228
|
+
<attribute name="keep-lines-together">
|
229
|
+
<data type="boolean"/>
|
230
|
+
</attribute>
|
231
|
+
</optional>
|
232
|
+
<optional>
|
233
|
+
<ref name="tname"/>
|
234
|
+
</optional>
|
235
|
+
<optional>
|
236
|
+
<ref name="thead"/>
|
237
|
+
</optional>
|
238
|
+
<ref name="tbody"/>
|
239
|
+
<optional>
|
240
|
+
<ref name="tfoot"/>
|
241
|
+
</optional>
|
242
|
+
<zeroOrMore>
|
243
|
+
<ref name="table-note"/>
|
244
|
+
</zeroOrMore>
|
245
|
+
<optional>
|
246
|
+
<ref name="dl"/>
|
247
|
+
</optional>
|
248
|
+
</element>
|
249
|
+
</define>
|
250
|
+
<define name="figure">
|
251
|
+
<element name="figure">
|
252
|
+
<attribute name="id">
|
253
|
+
<data type="ID"/>
|
254
|
+
</attribute>
|
255
|
+
<optional>
|
256
|
+
<attribute name="unnumbered">
|
257
|
+
<data type="boolean"/>
|
258
|
+
</attribute>
|
259
|
+
</optional>
|
260
|
+
<optional>
|
261
|
+
<attribute name="number"/>
|
262
|
+
</optional>
|
263
|
+
<optional>
|
264
|
+
<attribute name="subsequence"/>
|
265
|
+
</optional>
|
266
|
+
<optional>
|
267
|
+
<attribute name="keep-with-next">
|
268
|
+
<data type="boolean"/>
|
269
|
+
</attribute>
|
270
|
+
</optional>
|
271
|
+
<optional>
|
272
|
+
<attribute name="keep-lines-together">
|
273
|
+
<data type="boolean"/>
|
274
|
+
</attribute>
|
275
|
+
</optional>
|
276
|
+
<optional>
|
277
|
+
<attribute name="class"/>
|
278
|
+
</optional>
|
279
|
+
<optional>
|
280
|
+
<ref name="source"/>
|
281
|
+
</optional>
|
282
|
+
<optional>
|
283
|
+
<ref name="tname"/>
|
284
|
+
</optional>
|
285
|
+
<choice>
|
286
|
+
<ref name="image"/>
|
287
|
+
<ref name="video"/>
|
288
|
+
<ref name="audio"/>
|
289
|
+
<ref name="pre"/>
|
290
|
+
<oneOrMore>
|
291
|
+
<ref name="paragraph-with-footnote"/>
|
292
|
+
</oneOrMore>
|
293
|
+
<zeroOrMore>
|
294
|
+
<ref name="figure"/>
|
295
|
+
</zeroOrMore>
|
296
|
+
</choice>
|
297
|
+
<zeroOrMore>
|
298
|
+
<ref name="fn"/>
|
299
|
+
</zeroOrMore>
|
300
|
+
<optional>
|
301
|
+
<ref name="dl"/>
|
302
|
+
</optional>
|
303
|
+
<zeroOrMore>
|
304
|
+
<ref name="note"/>
|
305
|
+
</zeroOrMore>
|
306
|
+
</element>
|
307
|
+
</define>
|
308
|
+
<define name="sourcecode">
|
309
|
+
<element name="sourcecode">
|
310
|
+
<attribute name="id">
|
311
|
+
<data type="ID"/>
|
312
|
+
</attribute>
|
313
|
+
<optional>
|
314
|
+
<attribute name="unnumbered">
|
315
|
+
<data type="boolean"/>
|
316
|
+
</attribute>
|
317
|
+
</optional>
|
318
|
+
<optional>
|
319
|
+
<attribute name="number"/>
|
320
|
+
</optional>
|
321
|
+
<optional>
|
322
|
+
<attribute name="subsequence"/>
|
323
|
+
</optional>
|
324
|
+
<optional>
|
325
|
+
<attribute name="keep-with-next">
|
326
|
+
<data type="boolean"/>
|
327
|
+
</attribute>
|
328
|
+
</optional>
|
329
|
+
<optional>
|
330
|
+
<attribute name="keep-lines-together">
|
331
|
+
<data type="boolean"/>
|
332
|
+
</attribute>
|
333
|
+
</optional>
|
334
|
+
<optional>
|
335
|
+
<attribute name="lang"/>
|
336
|
+
</optional>
|
337
|
+
<optional>
|
338
|
+
<ref name="tname"/>
|
339
|
+
</optional>
|
340
|
+
<oneOrMore>
|
341
|
+
<choice>
|
342
|
+
<text/>
|
343
|
+
<ref name="callout"/>
|
344
|
+
</choice>
|
345
|
+
</oneOrMore>
|
346
|
+
<zeroOrMore>
|
347
|
+
<ref name="annotation"/>
|
348
|
+
</zeroOrMore>
|
349
|
+
<zeroOrMore>
|
350
|
+
<ref name="note"/>
|
351
|
+
</zeroOrMore>
|
352
|
+
</element>
|
353
|
+
</define>
|
354
|
+
<define name="formula">
|
355
|
+
<element name="formula">
|
356
|
+
<attribute name="id">
|
357
|
+
<data type="ID"/>
|
358
|
+
</attribute>
|
359
|
+
<optional>
|
360
|
+
<attribute name="unnumbered">
|
361
|
+
<data type="boolean"/>
|
362
|
+
</attribute>
|
363
|
+
</optional>
|
364
|
+
<optional>
|
365
|
+
<attribute name="number"/>
|
366
|
+
</optional>
|
367
|
+
<optional>
|
368
|
+
<attribute name="subsequence"/>
|
369
|
+
</optional>
|
370
|
+
<optional>
|
371
|
+
<attribute name="keep-with-next">
|
372
|
+
<data type="boolean"/>
|
373
|
+
</attribute>
|
374
|
+
</optional>
|
375
|
+
<optional>
|
376
|
+
<attribute name="keep-lines-together">
|
377
|
+
<data type="boolean"/>
|
378
|
+
</attribute>
|
379
|
+
</optional>
|
380
|
+
<optional>
|
381
|
+
<attribute name="inequality">
|
382
|
+
<data type="boolean"/>
|
383
|
+
</attribute>
|
384
|
+
</optional>
|
385
|
+
<ref name="stem"/>
|
386
|
+
<optional>
|
387
|
+
<ref name="dl"/>
|
388
|
+
</optional>
|
389
|
+
<zeroOrMore>
|
390
|
+
<ref name="note"/>
|
391
|
+
</zeroOrMore>
|
392
|
+
</element>
|
393
|
+
</define>
|
394
|
+
<define name="ParagraphType">
|
395
|
+
<attribute name="id">
|
396
|
+
<data type="ID"/>
|
397
|
+
</attribute>
|
398
|
+
<optional>
|
399
|
+
<attribute name="align">
|
400
|
+
<ref name="Alignments"/>
|
401
|
+
</attribute>
|
402
|
+
</optional>
|
403
|
+
<optional>
|
404
|
+
<attribute name="keep-with-next">
|
405
|
+
<data type="boolean"/>
|
406
|
+
</attribute>
|
407
|
+
</optional>
|
408
|
+
<optional>
|
409
|
+
<attribute name="keep-lines-together">
|
410
|
+
<data type="boolean"/>
|
411
|
+
</attribute>
|
412
|
+
</optional>
|
413
|
+
<zeroOrMore>
|
414
|
+
<ref name="TextElement"/>
|
415
|
+
</zeroOrMore>
|
416
|
+
<zeroOrMore>
|
417
|
+
<ref name="note"/>
|
418
|
+
</zeroOrMore>
|
419
|
+
</define>
|
420
|
+
<define name="paragraph-with-footnote">
|
421
|
+
<element name="p">
|
422
|
+
<attribute name="id">
|
423
|
+
<data type="ID"/>
|
424
|
+
</attribute>
|
425
|
+
<optional>
|
426
|
+
<attribute name="align">
|
427
|
+
<ref name="Alignments"/>
|
428
|
+
</attribute>
|
429
|
+
</optional>
|
430
|
+
<optional>
|
431
|
+
<attribute name="keep-with-next">
|
432
|
+
<data type="boolean"/>
|
433
|
+
</attribute>
|
434
|
+
</optional>
|
435
|
+
<optional>
|
436
|
+
<attribute name="keep-lines-together">
|
437
|
+
<data type="boolean"/>
|
438
|
+
</attribute>
|
439
|
+
</optional>
|
440
|
+
<zeroOrMore>
|
441
|
+
<choice>
|
442
|
+
<ref name="TextElement"/>
|
443
|
+
<ref name="fn"/>
|
444
|
+
</choice>
|
445
|
+
</zeroOrMore>
|
446
|
+
<zeroOrMore>
|
447
|
+
<ref name="note"/>
|
448
|
+
</zeroOrMore>
|
449
|
+
</element>
|
450
|
+
</define>
|
451
|
+
<define name="quote">
|
452
|
+
<element name="quote">
|
453
|
+
<attribute name="id">
|
454
|
+
<data type="ID"/>
|
455
|
+
</attribute>
|
456
|
+
<optional>
|
457
|
+
<attribute name="alignment">
|
458
|
+
<ref name="Alignments"/>
|
459
|
+
</attribute>
|
460
|
+
</optional>
|
461
|
+
<optional>
|
462
|
+
<attribute name="keep-with-next">
|
463
|
+
<data type="boolean"/>
|
464
|
+
</attribute>
|
465
|
+
</optional>
|
466
|
+
<optional>
|
467
|
+
<attribute name="keep-lines-together">
|
468
|
+
<data type="boolean"/>
|
469
|
+
</attribute>
|
470
|
+
</optional>
|
471
|
+
<optional>
|
472
|
+
<ref name="quote-source"/>
|
473
|
+
</optional>
|
474
|
+
<optional>
|
475
|
+
<ref name="quote-author"/>
|
476
|
+
</optional>
|
477
|
+
<oneOrMore>
|
478
|
+
<ref name="paragraph-with-footnote"/>
|
479
|
+
</oneOrMore>
|
480
|
+
<zeroOrMore>
|
481
|
+
<ref name="note"/>
|
482
|
+
</zeroOrMore>
|
483
|
+
</element>
|
484
|
+
</define>
|
100
485
|
<define name="BibDataExtensionType">
|
101
486
|
<ref name="doctype"/>
|
102
487
|
<optional>
|
@@ -165,6 +550,30 @@
|
|
165
550
|
<attribute name="id">
|
166
551
|
<data type="ID"/>
|
167
552
|
</attribute>
|
553
|
+
<optional>
|
554
|
+
<attribute name="unnumbered">
|
555
|
+
<data type="boolean"/>
|
556
|
+
</attribute>
|
557
|
+
</optional>
|
558
|
+
<optional>
|
559
|
+
<attribute name="number"/>
|
560
|
+
</optional>
|
561
|
+
<optional>
|
562
|
+
<attribute name="subsequence"/>
|
563
|
+
</optional>
|
564
|
+
<optional>
|
565
|
+
<attribute name="keep-with-next">
|
566
|
+
<data type="boolean"/>
|
567
|
+
</attribute>
|
568
|
+
</optional>
|
569
|
+
<optional>
|
570
|
+
<attribute name="keep-lines-together">
|
571
|
+
<data type="boolean"/>
|
572
|
+
</attribute>
|
573
|
+
</optional>
|
574
|
+
<optional>
|
575
|
+
<attribute name="type"/>
|
576
|
+
</optional>
|
168
577
|
<oneOrMore>
|
169
578
|
<choice>
|
170
579
|
<ref name="paragraph"/>
|
@@ -516,6 +925,9 @@
|
|
516
925
|
<optional>
|
517
926
|
<attribute name="script"/>
|
518
927
|
</optional>
|
928
|
+
<optional>
|
929
|
+
<attribute name="type"/>
|
930
|
+
</optional>
|
519
931
|
<optional>
|
520
932
|
<attribute name="obligation">
|
521
933
|
<choice>
|
@@ -555,9 +967,6 @@
|
|
555
967
|
</define>
|
556
968
|
<define name="content-subsection">
|
557
969
|
<element name="clause">
|
558
|
-
<optional>
|
559
|
-
<attribute name="type"/>
|
560
|
-
</optional>
|
561
970
|
<ref name="Content-Section"/>
|
562
971
|
</element>
|
563
972
|
</define>
|
@@ -586,6 +995,9 @@
|
|
586
995
|
</choice>
|
587
996
|
</attribute>
|
588
997
|
</optional>
|
998
|
+
<optional>
|
999
|
+
<attribute name="type"/>
|
1000
|
+
</optional>
|
589
1001
|
<optional>
|
590
1002
|
<ref name="section-title"/>
|
591
1003
|
</optional>
|
@@ -605,9 +1017,6 @@
|
|
605
1017
|
</define>
|
606
1018
|
<define name="clause">
|
607
1019
|
<element name="clause">
|
608
|
-
<optional>
|
609
|
-
<attribute name="type"/>
|
610
|
-
</optional>
|
611
1020
|
<ref name="Clause-Section"/>
|
612
1021
|
</element>
|
613
1022
|
</define>
|
@@ -636,6 +1045,9 @@
|
|
636
1045
|
</choice>
|
637
1046
|
</attribute>
|
638
1047
|
</optional>
|
1048
|
+
<optional>
|
1049
|
+
<attribute name="type"/>
|
1050
|
+
</optional>
|
639
1051
|
<optional>
|
640
1052
|
<ref name="section-title"/>
|
641
1053
|
</optional>
|
@@ -774,6 +1186,9 @@
|
|
774
1186
|
<optional>
|
775
1187
|
<attribute name="script"/>
|
776
1188
|
</optional>
|
1189
|
+
<optional>
|
1190
|
+
<attribute name="type"/>
|
1191
|
+
</optional>
|
777
1192
|
<optional>
|
778
1193
|
<attribute name="obligation">
|
779
1194
|
<choice>
|
@@ -910,6 +1325,27 @@
|
|
910
1325
|
<attribute name="id">
|
911
1326
|
<data type="ID"/>
|
912
1327
|
</attribute>
|
1328
|
+
<optional>
|
1329
|
+
<attribute name="unnumbered">
|
1330
|
+
<data type="boolean"/>
|
1331
|
+
</attribute>
|
1332
|
+
</optional>
|
1333
|
+
<optional>
|
1334
|
+
<attribute name="number"/>
|
1335
|
+
</optional>
|
1336
|
+
<optional>
|
1337
|
+
<attribute name="subsequence"/>
|
1338
|
+
</optional>
|
1339
|
+
<optional>
|
1340
|
+
<attribute name="keep-with-next">
|
1341
|
+
<data type="boolean"/>
|
1342
|
+
</attribute>
|
1343
|
+
</optional>
|
1344
|
+
<optional>
|
1345
|
+
<attribute name="keep-lines-together">
|
1346
|
+
<data type="boolean"/>
|
1347
|
+
</attribute>
|
1348
|
+
</optional>
|
913
1349
|
<oneOrMore>
|
914
1350
|
<choice>
|
915
1351
|
<ref name="paragraph"/>
|
@@ -30,9 +30,22 @@
|
|
30
30
|
<data type="boolean"/>
|
31
31
|
</attribute>
|
32
32
|
</optional>
|
33
|
+
<optional>
|
34
|
+
<attribute name="number"/>
|
35
|
+
</optional>
|
33
36
|
<optional>
|
34
37
|
<attribute name="subsequence"/>
|
35
38
|
</optional>
|
39
|
+
<optional>
|
40
|
+
<attribute name="keep-with-next">
|
41
|
+
<data type="boolean"/>
|
42
|
+
</attribute>
|
43
|
+
</optional>
|
44
|
+
<optional>
|
45
|
+
<attribute name="keep-lines-together">
|
46
|
+
<data type="boolean"/>
|
47
|
+
</attribute>
|
48
|
+
</optional>
|
36
49
|
<attribute name="id">
|
37
50
|
<data type="ID"/>
|
38
51
|
</attribute>
|
@@ -141,6 +154,16 @@
|
|
141
154
|
<data type="boolean"/>
|
142
155
|
</attribute>
|
143
156
|
</optional>
|
157
|
+
<optional>
|
158
|
+
<attribute name="keep-with-next">
|
159
|
+
<data type="boolean"/>
|
160
|
+
</attribute>
|
161
|
+
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="keep-lines-together">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</attribute>
|
166
|
+
</optional>
|
144
167
|
<oneOrMore>
|
145
168
|
<ref name="BasicBlock"/>
|
146
169
|
</oneOrMore>
|
data/lib/isodoc/generic.rb
CHANGED
@@ -1,35 +1,13 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
2
|
require "fileutils"
|
4
3
|
|
5
4
|
module IsoDoc
|
6
5
|
module Generic
|
7
6
|
module BaseConvert
|
8
|
-
def metadata_init(lang, script, labels)
|
9
|
-
@meta = Metadata.new(lang, script, labels)
|
10
|
-
end
|
11
|
-
|
12
7
|
def baselocation(loc)
|
13
8
|
return nil if loc.nil?
|
14
|
-
File.expand_path(File.join(
|
15
|
-
|
16
|
-
|
17
|
-
def annex_name(annex, name, div)
|
18
|
-
div.h1 **{ class: "Annex" } do |t|
|
19
|
-
t << "#{anchor(annex['id'], :label)} "
|
20
|
-
t.br
|
21
|
-
t.b do |b|
|
22
|
-
name&.children&.each { |c2| parse(c2, b) }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def i18n_init(lang, script)
|
28
|
-
super
|
29
|
-
end
|
30
|
-
|
31
|
-
def fileloc(loc)
|
32
|
-
File.join(File.dirname(__FILE__), loc)
|
9
|
+
File.expand_path(File.join(
|
10
|
+
File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
|
33
11
|
end
|
34
12
|
|
35
13
|
def cleanup(docxml)
|
@@ -47,7 +25,8 @@ module IsoDoc
|
|
47
25
|
end
|
48
26
|
|
49
27
|
def make_body(xml, docxml)
|
50
|
-
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
28
|
+
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
29
|
+
"xml:lang": "EN-US", class: "container" }
|
51
30
|
xml.body **body_attr do |body|
|
52
31
|
make_body1(body, docxml)
|
53
32
|
make_body2(body, docxml)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "base_convert"
|
2
|
+
require_relative "init"
|
2
3
|
require "isodoc"
|
3
4
|
|
4
5
|
module IsoDoc
|
@@ -51,10 +52,13 @@ module IsoDoc
|
|
51
52
|
|
52
53
|
def googlefonts
|
53
54
|
return unless configuration.webfont
|
54
|
-
Array(configuration.webfont).map
|
55
|
+
Array(configuration.webfont).map do |x|
|
56
|
+
%{<link href="#{x.gsub(/\&/, '&')}" rel="stylesheet">}
|
57
|
+
end.join("\n")
|
55
58
|
end
|
56
59
|
|
57
60
|
include BaseConvert
|
61
|
+
include Init
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require_relative "metadata"
|
3
|
+
require_relative "xref"
|
4
|
+
|
5
|
+
module IsoDoc
|
6
|
+
module Generic
|
7
|
+
module Init
|
8
|
+
def metadata_init(lang, script, i18n)
|
9
|
+
@meta = Metadata.new(lang, script, i18n)
|
10
|
+
end
|
11
|
+
|
12
|
+
def xref_init(lang, script, klass, i18n, options)
|
13
|
+
html = HtmlConvert.new(language: lang, script: script)
|
14
|
+
@xrefs = Xref.new(lang, script, html, i18n, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def i18n_init(lang, script, i18nyaml = nil)
|
18
|
+
@i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
|
19
|
+
end
|
20
|
+
|
21
|
+
def fileloc(loc)
|
22
|
+
File.join(File.dirname(__FILE__), loc)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -24,7 +24,8 @@ module IsoDoc
|
|
24
24
|
|
25
25
|
def baselocation(loc)
|
26
26
|
return nil if loc.nil?
|
27
|
-
File.expand_path(File.join(
|
27
|
+
File.expand_path(File.join(
|
28
|
+
File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
|
28
29
|
end
|
29
30
|
|
30
31
|
def configuration
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative "init"
|
2
|
+
require "isodoc"
|
3
|
+
|
4
|
+
module IsoDoc
|
5
|
+
module Generic
|
6
|
+
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
7
|
+
def annex1(f)
|
8
|
+
lbl = @xrefs.anchor(f['id'], :label)
|
9
|
+
if t = f.at(ns("./title"))
|
10
|
+
t.children = "<strong>#{t.children.to_xml}</strong>"
|
11
|
+
end
|
12
|
+
prefix_name(f, "<br/>", lbl, "title")
|
13
|
+
end
|
14
|
+
|
15
|
+
include Init
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "base_convert"
|
2
|
+
require_relative "init"
|
2
3
|
require "isodoc"
|
3
4
|
|
4
5
|
module IsoDoc
|
@@ -22,8 +23,10 @@ module IsoDoc
|
|
22
23
|
|
23
24
|
def default_fonts(options)
|
24
25
|
{
|
25
|
-
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
26
|
-
|
26
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
27
|
+
configuration.word_bodyfont || '"Arial",sans-serif'),
|
28
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
29
|
+
configuration.word_headerfont || '"Arial",sans-serif'),
|
27
30
|
monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
|
28
31
|
}
|
29
32
|
end
|
@@ -51,6 +54,7 @@ module IsoDoc
|
|
51
54
|
end
|
52
55
|
|
53
56
|
include BaseConvert
|
57
|
+
include Init
|
54
58
|
end
|
55
59
|
end
|
56
60
|
end
|
@@ -40,10 +40,6 @@ module Metanorma
|
|
40
40
|
"Metanorma::Generic #{Metanorma::Generic::VERSION}"
|
41
41
|
end
|
42
42
|
|
43
|
-
def input_to_isodoc(file, filename)
|
44
|
-
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
45
|
-
end
|
46
|
-
|
47
43
|
def extract_options(file)
|
48
44
|
head = file.sub(/\n\n.*$/m, "\n")
|
49
45
|
/\n:htmlstylesheet: (?<htmlstylesheet>[^\n]+)\n/ =~ head
|
@@ -73,14 +69,16 @@ module Metanorma
|
|
73
69
|
super.merge(new_options)
|
74
70
|
end
|
75
71
|
|
76
|
-
def output(isodoc_node, outname, format, options={})
|
72
|
+
def output(isodoc_node, inname, outname, format, options={})
|
77
73
|
case format
|
78
74
|
when :html
|
79
|
-
IsoDoc::Generic::HtmlConvert.new(options).convert(
|
75
|
+
IsoDoc::Generic::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
80
76
|
when :doc
|
81
|
-
IsoDoc::Generic::WordConvert.new(options).convert(
|
77
|
+
IsoDoc::Generic::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
82
78
|
when :pdf
|
83
|
-
IsoDoc::Generic::PdfConvert.new(options).convert(
|
79
|
+
IsoDoc::Generic::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
80
|
+
when :presentation
|
81
|
+
IsoDoc::Generic::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
84
82
|
else
|
85
83
|
super
|
86
84
|
end
|
data/metanorma-generic.gemspec
CHANGED
@@ -28,10 +28,11 @@ 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.
|
31
|
+
spec.add_dependency "metanorma-standoc", "~> 1.5.0"
|
32
|
+
spec.add_dependency "isodoc", "~> 1.2.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "byebug", "~> 9.1"
|
35
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
35
36
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
36
37
|
spec.add_development_dependency "guard", "~> 2.14"
|
37
38
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
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.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-27 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.5.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.5.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.
|
61
|
+
version: 1.2.0
|
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.
|
68
|
+
version: 1.2.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '9.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sassc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.4.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.4.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: equivalent-xml
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -239,9 +253,12 @@ files:
|
|
239
253
|
- lib/isodoc/generic/html/word_generic_titlepage.html
|
240
254
|
- lib/isodoc/generic/html/wordstyle.scss
|
241
255
|
- lib/isodoc/generic/html_convert.rb
|
256
|
+
- lib/isodoc/generic/init.rb
|
242
257
|
- lib/isodoc/generic/metadata.rb
|
243
258
|
- lib/isodoc/generic/pdf_convert.rb
|
259
|
+
- lib/isodoc/generic/presentation_xml_convert.rb
|
244
260
|
- lib/isodoc/generic/word_convert.rb
|
261
|
+
- lib/isodoc/generic/xref.rb
|
245
262
|
- lib/metanorma-generic.rb
|
246
263
|
- lib/metanorma/generic.rb
|
247
264
|
- lib/metanorma/generic/processor.rb
|
@@ -252,7 +269,7 @@ homepage: https://github.com/metanorma/metanorma-generic
|
|
252
269
|
licenses:
|
253
270
|
- BSD-2-Clause
|
254
271
|
metadata: {}
|
255
|
-
post_install_message:
|
272
|
+
post_install_message:
|
256
273
|
rdoc_options: []
|
257
274
|
require_paths:
|
258
275
|
- lib
|
@@ -267,9 +284,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
284
|
- !ruby/object:Gem::Version
|
268
285
|
version: '0'
|
269
286
|
requirements: []
|
270
|
-
|
271
|
-
|
272
|
-
signing_key:
|
287
|
+
rubygems_version: 3.0.3
|
288
|
+
signing_key:
|
273
289
|
specification_version: 4
|
274
290
|
summary: Metanorma template gem for customisation.
|
275
291
|
test_files: []
|