metanorma-bsi 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.hound.yml +3 -0
  4. data/.rubocop.yml +14 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +7 -0
  7. data/LICENSE +25 -0
  8. data/README.adoc +199 -0
  9. data/Rakefile +8 -0
  10. data/bin/rspec +18 -0
  11. data/lib/asciidoctor/bsi/basicdoc.rng +1131 -0
  12. data/lib/asciidoctor/bsi/biblio.rng +1235 -0
  13. data/lib/asciidoctor/bsi/bsi.rng +120 -0
  14. data/lib/asciidoctor/bsi/bsi_intro_en.xml +105 -0
  15. data/lib/asciidoctor/bsi/cleanup.rb +78 -0
  16. data/lib/asciidoctor/bsi/cleanup_ref.rb +183 -0
  17. data/lib/asciidoctor/bsi/converter.rb +83 -0
  18. data/lib/asciidoctor/bsi/front.rb +67 -0
  19. data/lib/asciidoctor/bsi/isodoc.rng +1870 -0
  20. data/lib/asciidoctor/bsi/isostandard.rng +477 -0
  21. data/lib/asciidoctor/bsi/reqt.rng +194 -0
  22. data/lib/asciidoctor/bsi/validate.rb +224 -0
  23. data/lib/asciidoctor/bsi/validate_list.rb +72 -0
  24. data/lib/asciidoctor/bsi/validate_requirement.rb +163 -0
  25. data/lib/isodoc/bsi/base_convert.rb +91 -0
  26. data/lib/isodoc/bsi/bsi.international-standard.xsl +6540 -0
  27. data/lib/isodoc/bsi/html/html_bsi_intro.html +8 -0
  28. data/lib/isodoc/bsi/html/html_bsi_titlepage.html +50 -0
  29. data/lib/isodoc/bsi/html/htmlstyle.css +968 -0
  30. data/lib/isodoc/bsi/html/htmlstyle.scss +699 -0
  31. data/lib/isodoc/bsi/html_convert.rb +56 -0
  32. data/lib/isodoc/bsi/i18n-en.yaml +56 -0
  33. data/lib/isodoc/bsi/i18n.rb +15 -0
  34. data/lib/isodoc/bsi/init.rb +24 -0
  35. data/lib/isodoc/bsi/metadata.rb +33 -0
  36. data/lib/isodoc/bsi/pdf_convert.rb +17 -0
  37. data/lib/isodoc/bsi/presentation_xml_convert.rb +72 -0
  38. data/lib/isodoc/bsi/sts_convert.rb +30 -0
  39. data/lib/isodoc/bsi/xref.rb +134 -0
  40. data/lib/metanorma-bsi.rb +15 -0
  41. data/lib/metanorma/bsi.rb +6 -0
  42. data/lib/metanorma/bsi/processor.rb +51 -0
  43. data/lib/metanorma/bsi/version.rb +6 -0
  44. data/metanorma-bsi.gemspec +47 -0
  45. data/spec/asciidoctor/base_spec.rb +778 -0
  46. data/spec/asciidoctor/blocks_spec.rb +553 -0
  47. data/spec/asciidoctor/cleanup_spec.rb +547 -0
  48. data/spec/asciidoctor/inline_spec.rb +176 -0
  49. data/spec/asciidoctor/lists_spec.rb +194 -0
  50. data/spec/asciidoctor/refs_spec.rb +318 -0
  51. data/spec/asciidoctor/section_spec.rb +382 -0
  52. data/spec/asciidoctor/validate_spec.rb +858 -0
  53. data/spec/assets/header.html +7 -0
  54. data/spec/assets/html.css +2 -0
  55. data/spec/assets/iso.xml +71 -0
  56. data/spec/assets/rice_image1.png +0 -0
  57. data/spec/assets/word.css +2 -0
  58. data/spec/assets/wordintro.html +4 -0
  59. data/spec/assets/xref_error.adoc +7 -0
  60. data/spec/isodoc/blocks_spec.rb +259 -0
  61. data/spec/isodoc/i18n_spec.rb +442 -0
  62. data/spec/isodoc/inline_spec.rb +287 -0
  63. data/spec/isodoc/iso_spec.rb +116 -0
  64. data/spec/isodoc/metadata_spec.rb +262 -0
  65. data/spec/isodoc/postproc_spec.rb +137 -0
  66. data/spec/isodoc/ref_spec.rb +376 -0
  67. data/spec/isodoc/section_spec.rb +467 -0
  68. data/spec/isodoc/terms_spec.rb +246 -0
  69. data/spec/isodoc/xref_spec.rb +1730 -0
  70. data/spec/metanorma/processor_spec.rb +76 -0
  71. data/spec/spec_helper.rb +291 -0
  72. data/spec/vcr_cassettes/iso-639.yml +182 -0
  73. data/spec/vcr_cassettes/isobib_get_639_1967.yml +136 -0
  74. data/spec/vcr_cassettes/multistandard.yml +352 -0
  75. metadata +343 -0
@@ -0,0 +1,477 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
4
+ <include href="isodoc.rng">
5
+ <start>
6
+ <ref name="iso-standard"/>
7
+ </start>
8
+ <define name="organization">
9
+ <element name="organization">
10
+ <oneOrMore>
11
+ <ref name="orgname"/>
12
+ </oneOrMore>
13
+ <optional>
14
+ <ref name="abbreviation"/>
15
+ </optional>
16
+ <optional>
17
+ <ref name="uri"/>
18
+ </optional>
19
+ <zeroOrMore>
20
+ <ref name="org-identifier"/>
21
+ </zeroOrMore>
22
+ <zeroOrMore>
23
+ <ref name="contact"/>
24
+ </zeroOrMore>
25
+ <optional>
26
+ <ref name="technical-committee"/>
27
+ </optional>
28
+ <optional>
29
+ <ref name="subcommittee"/>
30
+ </optional>
31
+ <optional>
32
+ <ref name="workgroup"/>
33
+ </optional>
34
+ <optional>
35
+ <ref name="secretariat"/>
36
+ </optional>
37
+ </element>
38
+ </define>
39
+ <define name="BibDataExtensionType">
40
+ <ref name="doctype"/>
41
+ <optional>
42
+ <ref name="horizontal"/>
43
+ </optional>
44
+ <ref name="editorialgroup"/>
45
+ <zeroOrMore>
46
+ <ref name="ics"/>
47
+ </zeroOrMore>
48
+ <ref name="structuredidentifier"/>
49
+ <optional>
50
+ <ref name="stagename"/>
51
+ </optional>
52
+ </define>
53
+ <define name="bdate">
54
+ <element name="date">
55
+ <attribute name="type">
56
+ <choice>
57
+ <ref name="BibliographicDateType"/>
58
+ <text/>
59
+ </choice>
60
+ </attribute>
61
+ <choice>
62
+ <group>
63
+ <element name="from">
64
+ <ref name="ISO8601Date"/>
65
+ </element>
66
+ <optional>
67
+ <element name="to">
68
+ <ref name="ISO8601Date"/>
69
+ </element>
70
+ </optional>
71
+ </group>
72
+ <element name="on">
73
+ <choice>
74
+ <ref name="ISO8601Date"/>
75
+ <value>--</value>
76
+ <value>–</value>
77
+ </choice>
78
+ </element>
79
+ </choice>
80
+ </element>
81
+ </define>
82
+ <define name="sections">
83
+ <element name="sections">
84
+ <zeroOrMore>
85
+ <choice>
86
+ <ref name="note"/>
87
+ <ref name="admonition"/>
88
+ </choice>
89
+ </zeroOrMore>
90
+ <ref name="clause"/>
91
+ <optional>
92
+ <choice>
93
+ <ref name="term-clause"/>
94
+ <ref name="terms"/>
95
+ </choice>
96
+ </optional>
97
+ <optional>
98
+ <ref name="definitions"/>
99
+ </optional>
100
+ <oneOrMore>
101
+ <ref name="clause"/>
102
+ </oneOrMore>
103
+ </element>
104
+ </define>
105
+ <define name="Clause-Section">
106
+ <optional>
107
+ <attribute name="id">
108
+ <data type="ID"/>
109
+ </attribute>
110
+ </optional>
111
+ <optional>
112
+ <attribute name="language"/>
113
+ </optional>
114
+ <optional>
115
+ <attribute name="script"/>
116
+ </optional>
117
+ <optional>
118
+ <attribute name="inline-header">
119
+ <data type="boolean"/>
120
+ </attribute>
121
+ </optional>
122
+ <optional>
123
+ <attribute name="obligation">
124
+ <choice>
125
+ <value>normative</value>
126
+ <value>informative</value>
127
+ </choice>
128
+ </attribute>
129
+ </optional>
130
+ <optional>
131
+ <attribute name="type"/>
132
+ </optional>
133
+ <optional>
134
+ <ref name="section-title"/>
135
+ </optional>
136
+ <group>
137
+ <choice>
138
+ <group>
139
+ <oneOrMore>
140
+ <ref name="BasicBlock"/>
141
+ </oneOrMore>
142
+ <zeroOrMore>
143
+ <ref name="note"/>
144
+ </zeroOrMore>
145
+ </group>
146
+ <ref name="amend"/>
147
+ </choice>
148
+ <oneOrMore>
149
+ <ref name="clause-subsection"/>
150
+ </oneOrMore>
151
+ </group>
152
+ </define>
153
+ <define name="term">
154
+ <element name="term">
155
+ <optional>
156
+ <attribute name="id">
157
+ <data type="ID"/>
158
+ </attribute>
159
+ </optional>
160
+ <ref name="preferred"/>
161
+ <zeroOrMore>
162
+ <ref name="admitted"/>
163
+ </zeroOrMore>
164
+ <zeroOrMore>
165
+ <ref name="deprecates"/>
166
+ </zeroOrMore>
167
+ <optional>
168
+ <ref name="termdomain"/>
169
+ </optional>
170
+ <ref name="definition"/>
171
+ <zeroOrMore>
172
+ <ref name="termnote"/>
173
+ </zeroOrMore>
174
+ <zeroOrMore>
175
+ <ref name="termexample"/>
176
+ </zeroOrMore>
177
+ <zeroOrMore>
178
+ <ref name="termsource"/>
179
+ </zeroOrMore>
180
+ </element>
181
+ </define>
182
+ <define name="annex">
183
+ <element name="annex">
184
+ <optional>
185
+ <attribute name="id">
186
+ <data type="ID"/>
187
+ </attribute>
188
+ </optional>
189
+ <optional>
190
+ <attribute name="language"/>
191
+ </optional>
192
+ <optional>
193
+ <attribute name="script"/>
194
+ </optional>
195
+ <optional>
196
+ <attribute name="inline-header">
197
+ <data type="boolean"/>
198
+ </attribute>
199
+ </optional>
200
+ <optional>
201
+ <attribute name="obligation">
202
+ <choice>
203
+ <value>normative</value>
204
+ <value>informative</value>
205
+ </choice>
206
+ </attribute>
207
+ </optional>
208
+ <optional>
209
+ <ref name="section-title"/>
210
+ </optional>
211
+ <zeroOrMore>
212
+ <!--
213
+ allow hanging paragraps in annexes: they introduce lists
214
+ ( paragraph-with-footnote | table | note | formula | admonition | ol | ul | dl | figure | quote | sourcecode | review | example )*,
215
+ -->
216
+ <ref name="BasicBlock"/>
217
+ </zeroOrMore>
218
+ <zeroOrMore>
219
+ <ref name="note"/>
220
+ </zeroOrMore>
221
+ <zeroOrMore>
222
+ <ref name="clause-hanging-paragraph-with-footnote"/>
223
+ </zeroOrMore>
224
+ <zeroOrMore>
225
+ <ref name="annex-appendix"/>
226
+ </zeroOrMore>
227
+ </element>
228
+ </define>
229
+ <define name="AdmonitionType">
230
+ <choice>
231
+ <value>danger</value>
232
+ <value>caution</value>
233
+ <value>warning</value>
234
+ <value>important</value>
235
+ <value>safety precautions</value>
236
+ </choice>
237
+ </define>
238
+ <define name="preface">
239
+ <element name="preface">
240
+ <optional>
241
+ <ref name="abstract"/>
242
+ </optional>
243
+ <ref name="foreword"/>
244
+ <optional>
245
+ <ref name="introduction"/>
246
+ </optional>
247
+ </element>
248
+ </define>
249
+ <define name="DocumentType">
250
+ <choice>
251
+ <value>international-standard</value>
252
+ <value>technical-specification</value>
253
+ <value>technical-report</value>
254
+ <value>publicly-available-specification</value>
255
+ <value>international-workshop-agreement</value>
256
+ <value>guide</value>
257
+ <value>amendment</value>
258
+ <value>technical-corrigendum</value>
259
+ </choice>
260
+ </define>
261
+ <define name="structuredidentifier">
262
+ <element name="structuredidentifier">
263
+ <optional>
264
+ <attribute name="type"/>
265
+ </optional>
266
+ <group>
267
+ <ref name="documentnumber"/>
268
+ <optional>
269
+ <ref name="tc-documentnumber"/>
270
+ </optional>
271
+ </group>
272
+ </element>
273
+ </define>
274
+ <define name="foreword">
275
+ <element name="foreword">
276
+ <ref name="Basic-Section"/>
277
+ </element>
278
+ </define>
279
+ <define name="introduction">
280
+ <element name="introduction">
281
+ <ref name="Content-Section"/>
282
+ </element>
283
+ </define>
284
+ <define name="editorialgroup">
285
+ <element name="editorialgroup">
286
+ <oneOrMore>
287
+ <ref name="technical-committee"/>
288
+ </oneOrMore>
289
+ <zeroOrMore>
290
+ <ref name="subcommittee"/>
291
+ </zeroOrMore>
292
+ <zeroOrMore>
293
+ <ref name="workgroup"/>
294
+ </zeroOrMore>
295
+ <optional>
296
+ <ref name="secretariat"/>
297
+ </optional>
298
+ </element>
299
+ </define>
300
+ <define name="Content-Section">
301
+ <optional>
302
+ <attribute name="id">
303
+ <data type="ID"/>
304
+ </attribute>
305
+ </optional>
306
+ <optional>
307
+ <attribute name="language"/>
308
+ </optional>
309
+ <optional>
310
+ <attribute name="script"/>
311
+ </optional>
312
+ <optional>
313
+ <attribute name="inline-header">
314
+ <data type="boolean"/>
315
+ </attribute>
316
+ </optional>
317
+ <optional>
318
+ <attribute name="obligation">
319
+ <choice>
320
+ <value>normative</value>
321
+ <value>informative</value>
322
+ </choice>
323
+ </attribute>
324
+ </optional>
325
+ <optional>
326
+ <attribute name="number"/>
327
+ </optional>
328
+ <optional>
329
+ <attribute name="type"/>
330
+ </optional>
331
+ <optional>
332
+ <ref name="section-title"/>
333
+ </optional>
334
+ <choice>
335
+ <group>
336
+ <zeroOrMore>
337
+ <ref name="BasicBlock"/>
338
+ </zeroOrMore>
339
+ <zeroOrMore>
340
+ <ref name="note"/>
341
+ </zeroOrMore>
342
+ </group>
343
+ <oneOrMore>
344
+ <ref name="content-subsection"/>
345
+ </oneOrMore>
346
+ </choice>
347
+ </define>
348
+ </include>
349
+ <!-- end overrides -->
350
+ <!--
351
+ We display the Normative References between scope and terms; but to keep the
352
+ grammar simple, we keep the references together
353
+ -->
354
+ <define name="iso-standard">
355
+ <element name="iso-standard">
356
+ <attribute name="version"/>
357
+ <attribute name="type">
358
+ <choice>
359
+ <value>semantic</value>
360
+ <value>presentation</value>
361
+ </choice>
362
+ </attribute>
363
+ <ref name="bibdata"/>
364
+ <zeroOrMore>
365
+ <ref name="termdocsource"/>
366
+ </zeroOrMore>
367
+ <optional>
368
+ <ref name="misccontainer"/>
369
+ </optional>
370
+ <optional>
371
+ <ref name="boilerplate"/>
372
+ </optional>
373
+ <ref name="preface"/>
374
+ <oneOrMore>
375
+ <ref name="sections"/>
376
+ </oneOrMore>
377
+ <zeroOrMore>
378
+ <ref name="annex"/>
379
+ </zeroOrMore>
380
+ <ref name="bibliography"/>
381
+ <zeroOrMore>
382
+ <ref name="indexsect"/>
383
+ </zeroOrMore>
384
+ </element>
385
+ </define>
386
+ <define name="horizontal">
387
+ <element name="horizontal">
388
+ <data type="boolean"/>
389
+ </element>
390
+ </define>
391
+ <define name="documentnumber">
392
+ <element name="project-number">
393
+ <optional>
394
+ <attribute name="part">
395
+ <data type="int"/>
396
+ </attribute>
397
+ </optional>
398
+ <optional>
399
+ <attribute name="subpart">
400
+ <data type="int"/>
401
+ </attribute>
402
+ </optional>
403
+ <text/>
404
+ </element>
405
+ </define>
406
+ <define name="tc-documentnumber">
407
+ <element name="tc-document-number">
408
+ <data type="int"/>
409
+ </element>
410
+ </define>
411
+ <define name="subcommittee">
412
+ <element name="subcommittee">
413
+ <ref name="IsoWorkgroup"/>
414
+ </element>
415
+ </define>
416
+ <define name="workgroup">
417
+ <element name="workgroup">
418
+ <ref name="IsoWorkgroup"/>
419
+ </element>
420
+ </define>
421
+ <define name="secretariat">
422
+ <element name="secretariat">
423
+ <text/>
424
+ </element>
425
+ </define>
426
+ <define name="clause-hanging-paragraph-with-footnote">
427
+ <element name="clause">
428
+ <optional>
429
+ <attribute name="id">
430
+ <data type="ID"/>
431
+ </attribute>
432
+ </optional>
433
+ <optional>
434
+ <attribute name="language"/>
435
+ </optional>
436
+ <optional>
437
+ <attribute name="script"/>
438
+ </optional>
439
+ <optional>
440
+ <attribute name="inline-header">
441
+ <data type="boolean"/>
442
+ </attribute>
443
+ </optional>
444
+ <optional>
445
+ <attribute name="obligation">
446
+ <choice>
447
+ <value>normative</value>
448
+ <value>informative</value>
449
+ </choice>
450
+ </attribute>
451
+ </optional>
452
+ <optional>
453
+ <ref name="section-title"/>
454
+ </optional>
455
+ <zeroOrMore>
456
+ <!-- allow hanging paragraphs in annexes: they introduce lists -->
457
+ <ref name="BasicBlock"/>
458
+ </zeroOrMore>
459
+ <zeroOrMore>
460
+ <ref name="note"/>
461
+ </zeroOrMore>
462
+ <zeroOrMore>
463
+ <ref name="clause-hanging-paragraph-with-footnote"/>
464
+ </zeroOrMore>
465
+ </element>
466
+ </define>
467
+ <define name="annex-appendix">
468
+ <element name="appendix">
469
+ <ref name="Clause-Section"/>
470
+ </element>
471
+ </define>
472
+ <define name="stagename">
473
+ <element name="stagename">
474
+ <text/>
475
+ </element>
476
+ </define>
477
+ </grammar>