metanorma-iec 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/bin/rspec +18 -0
  4. data/lib/asciidoctor/iec/biblio.rng +949 -0
  5. data/lib/asciidoctor/iec/converter.rb +68 -0
  6. data/lib/asciidoctor/iec/iec_intro_en.xml +15 -0
  7. data/lib/asciidoctor/iec/iec_intro_fr.xml +15 -0
  8. data/lib/asciidoctor/iec/isodoc.rng +1132 -0
  9. data/lib/asciidoctor/iec/isostandard.rng +789 -0
  10. data/lib/asciidoctor/iec/reqt.rng +162 -0
  11. data/lib/isodoc/iec/base_convert.rb +69 -0
  12. data/lib/isodoc/iec/html/header.html +160 -0
  13. data/lib/isodoc/iec/html/html_iec_intro.html +34 -0
  14. data/lib/isodoc/iec/html/html_iec_titlepage.html +62 -0
  15. data/lib/isodoc/iec/html/htmlstyle.scss +840 -0
  16. data/lib/isodoc/iec/html/isodoc.scss +785 -0
  17. data/lib/isodoc/iec/html/scripts.html +176 -0
  18. data/lib/isodoc/iec/html/word_iec_intro.html +72 -0
  19. data/lib/isodoc/iec/html/word_iec_titlepage.html +92 -0
  20. data/lib/isodoc/iec/html/wordstyle.scss +1849 -0
  21. data/lib/isodoc/iec/html_convert.rb +33 -0
  22. data/lib/isodoc/iec/i18n-en.yaml +3 -0
  23. data/lib/isodoc/iec/i18n-fr.yaml +3 -0
  24. data/lib/isodoc/iec/i18n-zh-Hans.yaml +3 -0
  25. data/lib/isodoc/iec/metadata.rb +20 -0
  26. data/lib/isodoc/iec/word_convert.rb +165 -0
  27. data/lib/metanorma-iec.rb +12 -0
  28. data/lib/metanorma/iec.rb +8 -0
  29. data/lib/metanorma/iec/processor.rb +40 -0
  30. data/lib/metanorma/iec/version.rb +6 -0
  31. data/metanorma-iec.gemspec +47 -0
  32. data/spec/asciidoctor-iec/base_spec.rb +609 -0
  33. data/spec/asciidoctor-iec/blocks_spec.rb +467 -0
  34. data/spec/asciidoctor-iec/cleanup_spec.rb +766 -0
  35. data/spec/asciidoctor-iec/inline_spec.rb +162 -0
  36. data/spec/asciidoctor-iec/lists_spec.rb +190 -0
  37. data/spec/asciidoctor-iec/macros_spec.rb +21 -0
  38. data/spec/asciidoctor-iec/refs_spec.rb +268 -0
  39. data/spec/asciidoctor-iec/section_spec.rb +341 -0
  40. data/spec/asciidoctor-iec/table_spec.rb +307 -0
  41. data/spec/asciidoctor-iec/validate_spec.rb +132 -0
  42. data/spec/examples/rice.adoc +723 -0
  43. data/spec/examples/rice.doc +19162 -0
  44. data/spec/examples/rice.html +1787 -0
  45. data/spec/examples/rice.xml +1951 -0
  46. data/spec/isodoc/i18n_spec.rb +642 -0
  47. data/spec/isodoc/inline_spec.rb +265 -0
  48. data/spec/isodoc/iso_spec.rb +319 -0
  49. data/spec/isodoc/metadata_spec.rb +153 -0
  50. data/spec/isodoc/postproc_spec.rb +569 -0
  51. data/spec/isodoc/section_spec.rb +686 -0
  52. data/spec/isodoc/terms_spec.rb +206 -0
  53. data/spec/isodoc/xref_spec.rb +1323 -0
  54. data/spec/metanorma/processor_spec.rb +88 -0
  55. data/spec/spec_helper.rb +253 -0
  56. metadata +325 -0
@@ -0,0 +1,68 @@
1
+ require "asciidoctor"
2
+ require "metanorma-iso"
3
+
4
+ module Asciidoctor
5
+ module Iec
6
+ class Converter < ISO::Converter
7
+
8
+ register_for "iec"
9
+
10
+ def metadata_author(node, xml)
11
+ publishers = node.attr("publisher") || "IEC"
12
+ publishers.split(/,[ ]?/).each do |p|
13
+ xml.contributor do |c|
14
+ c.role **{ type: "author" }
15
+ c.organization { |a| organization(a, p) }
16
+ end
17
+ end
18
+ end
19
+
20
+ def metadata_publisher(node, xml)
21
+ publishers = node.attr("publisher") || "IEC"
22
+ publishers.split(/,[ ]?/).each do |p|
23
+ xml.contributor do |c|
24
+ c.role **{ type: "publisher" }
25
+ c.organization { |a| organization(a, p) }
26
+ end
27
+ end
28
+ end
29
+
30
+ def metadata_copyright(node, xml)
31
+ publishers = node.attr("publisher") || "IEC"
32
+ publishers.split(/,[ ]?/).each do |p|
33
+ xml.copyright do |c|
34
+ c.from (node.attr("copyright-year") || Date.today.year)
35
+ c.owner do |owner|
36
+ owner.organization { |o| organization(o, p) }
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ def make_preface(x, s)
43
+ s.previous = boilerplate(x)
44
+ super
45
+ end
46
+
47
+ def boilerplate(x_orig)
48
+ lang = case x_orig&.at("//bibdata/language")&.text
49
+ when "fr" then "fr"
50
+ else
51
+ "en"
52
+ end
53
+ file = File.join(File.dirname(__FILE__),"iec_intro_#{lang}.xml")
54
+ File.read(file, encoding: "UTF-8")
55
+ end
56
+
57
+ def html_converter(node)
58
+ node.nil? ? IsoDoc::Iec::HtmlConvert.new({}) :
59
+ IsoDoc::Iec::HtmlConvert.new(html_extract_attributes(node))
60
+ end
61
+
62
+ def doc_converter(node)
63
+ node.nil? ? IsoDoc::Iec::WordConvert.new({}) :
64
+ IsoDoc::Iec::WordConvert.new(doc_extract_attributes(node))
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,15 @@
1
+ <boilerplate>
2
+ <legal-statement>
3
+ <ol>
4
+ <li><p>The International Electrotechnical Commission (IEC) is a worldwide organization for standardization comprising all national electrotechnical committees (IEC National Committees). The object of IEC is to promote international co-operation on all questions concerning standardization in the electrical and electronic fields. To this end and in addition to other activities, IEC publishes International Standards, Technical Specifications, Technical Reports, Publicly Available Specifications (PAS) and Guides (hereafter referred to as “IEC Publication(s)”). Their preparation is entrusted to technical committees; any IEC National Committee interested in the subject dealt with may participate in this preparatory work. International, governmental and non-governmental organizations liaising with the IEC also participate in this preparation. IEC collaborates closely with the International Organization for Standardization (ISO) in accordance with conditions determined by agreement between the two organizations.</p></li>
5
+ <li><p>The formal decisions or agreements of IEC on technical matters express, as nearly as possible, an international consensus of opinion on the relevant subjects since each technical committee has representation from all interested IEC National Committees.</p></li>
6
+ <li><p>IEC Publications have the form of recommendations for international use and are accepted by IEC National Committees in that sense. While all reasonable efforts are made to ensure that the technical content of IEC Publications is accurate, IEC cannot be held responsible for the way in which they are used or for any misinterpretation by any end user.</p></li>
7
+ <li><p>In order to promote international uniformity, IEC National Committees undertake to apply IEC Publications transparently to the maximum extent possible in their national and regional publications. Any divergence between any IEC Publication and the corresponding national or regional publication shall be clearly indicated in the latter.</p></li>
8
+ <li><p>IEC itself does not provide any attestation of conformity. Independent certification bodies provide conformity assessment services and, in some areas, access to IEC marks of conformity. IEC is not responsible for any services carried out by independent certification bodies.</p></li>
9
+ <li><p>All users should ensure that they have the latest edition of this publication.</p></li>
10
+ <li><p>No liability shall attach to IEC or its directors, employees, servants or agents including individual experts and members of its technical committees and IEC National Committees for any personal injury, property damage or other damage of any nature whatsoever, whether direct or indirect, or for costs (including legal fees) and expenses arising out of the publication, use of, or reliance upon, this IEC Publication or any other IEC Publications.</p></li>
11
+ <li><p>Attention is drawn to the Normative references cited in this publication. Use of the referenced publications is indispensable for the correct application of this publication.</p></li>
12
+ <li><p>Attention is drawn to the possibility that some of the elements of this IEC Publication may be the subject of patent rights. IEC shall not be held responsible for identifying any or all such patent rights.</p></li>
13
+ </ol>
14
+ </legal-statement>
15
+ </boilerplate>
@@ -0,0 +1,15 @@
1
+ <boilerplate>
2
+ <legal-statement>
3
+ <ol>
4
+ <li><p>La Commission Electrotechnique Internationale (IEC) est une organisation mondiale de normalisation composée de l'ensemble des comités électrotechniques nationaux (Comités nationaux de l’IEC). L’IEC a pour objet de favoriser la coopération internationale pour toutes les questions de normalisation dans les domaines de l'électricité et de l'électronique. A cet effet, l’IEC – entre autres activités – publie des Normes internationales, des Spécifications techniques, des Rapports techniques, des Spécifications accessibles au public (PAS) et des Guides (ci-après dénommés "Publication(s) de l’IEC"). Leur élaboration est confiée à des comités d'études, aux travaux desquels tout Comité national intéressé par le sujet traité peut participer. Les organisations internationales, gouvernementales et non gouvernementales, en liaison avec l’IEC, participent également aux travaux. L’IEC collabore étroitement avec l'Organisation Internationale de Normalisation (ISO), selon des conditions fixées par accord entre les deux organisations.</p></li>
5
+ <li><p>Les décisions ou accords officiels de l’IEC concernant les questions techniques représentent, dans la mesure du possible, un accord international sur les sujets étudiés, étant donné que les Comités nationaux de l’IEC intéressés sont représentés dans chaque comité d’études.</p></li>
6
+ <li><p>Les Publications de l’IEC se présentent sous la forme de recommandations internationales et sont agréées comme telles par les Comités nationaux de l’IEC. Tous les efforts raisonnables sont entrepris afin que l’IEC s'assure de l'exactitude du contenu technique de ses publications; l’IEC ne peut pas être tenue responsable de l'éventuelle mauvaise utilisation ou interprétation qui en est faite par un quelconque utilisateur final.</p></li>
7
+ <li><p>Dans le but d'encourager l'uniformité internationale, les Comités nationaux de l’IEC s'engagent, dans toute la mesure possible, à appliquer de façon transparente les Publications de l’IEC dans leurs publications nationales et régionales. Toutes divergences entre toutes Publications de l’IEC et toutes publications nationales ou régionales correspondantes doivent être indiquées en termes clairs dans ces dernières.</p></li>
8
+ <li><p>L’IEC elle-même ne fournit aucune attestation de conformité. Des organismes de certification indépendants fournissent des services d'évaluation de conformité et, dans certains secteurs, accèdent aux marques de conformité de l’IEC. L’IEC n'est responsable d'aucun des services effectués par les organismes de certification indépendants.</p></li>
9
+ <li><p>Tous les utilisateurs doivent s'assurer qu'ils sont en possession de la dernière édition de cette publication.</p></li>
10
+ <li><p>Aucune responsabilité ne doit être imputée à l’IEC, à ses administrateurs, employés, auxiliaires ou mandataires, y compris ses experts particuliers et les membres de ses comités d'études et des Comités nationaux de l’IEC, pour tout préjudice causé en cas de dommages corporels et matériels, ou de tout autre dommage de quelque nature que ce soit, directe ou indirecte, ou pour supporter les coûts (y compris les frais de justice) et les dépenses découlant de la publication ou de l'utilisation de cette Publication de l’IEC ou de toute autre Publication de l’IEC, ou au crédit qui lui est accordé.</p></li>
11
+ <li><p>L'attention est attirée sur les références normatives citées dans cette publication. L'utilisation de publications référencées est obligatoire pour une application correcte de la présente publication.</p></li>
12
+ <li><p>L’attention est attirée sur le fait que certains des éléments de la présente Publication de l’IEC peuvent faire l’objet de droits de brevet. L’IEC ne saurait être tenue pour responsable de ne pas avoir identifié de tels droits de brevets et de ne pas avoir signalé leur existence.</p></li>
13
+ </ol>
14
+ </legal-statement>
15
+ </boilerplate>
@@ -0,0 +1,1132 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ instantiations of this grammar may replace leaf strings
4
+ with more elaborated types; e.g. title (text) replaced with
5
+ title-main, title-intro, title-part; type replaced with
6
+ enum.
7
+
8
+ some renaming at leaf nodes is permissible
9
+
10
+ obligations can change both from optional to mandatory,
11
+ and from mandatory to optional; optional elements may
12
+ be omitted; freely positioned alternatives may be replaced
13
+ with strict ordering
14
+
15
+ DO NOT introduce a namespace here. We do not want a distinct namespace
16
+ for these elements, and a distinct namespace for any grammar inheriting
17
+ these elements; we just want one namespace for any child grammars
18
+ of this.
19
+ -->
20
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
+ <include href="reqt.rng"/>
22
+ <include href="biblio.rng"/>
23
+ <start>
24
+ <ref name="standard-document"/>
25
+ </start>
26
+ <define name="standard-document">
27
+ <element name="standard-document">
28
+ <ref name="bibdata"/>
29
+ <optional>
30
+ <ref name="boilerplate"/>
31
+ </optional>
32
+ <optional>
33
+ <ref name="preface"/>
34
+ </optional>
35
+ <ref name="sections"/>
36
+ <zeroOrMore>
37
+ <ref name="annex"/>
38
+ </zeroOrMore>
39
+ <zeroOrMore>
40
+ <ref name="references"/>
41
+ </zeroOrMore>
42
+ </element>
43
+ </define>
44
+ <define name="bibdata">
45
+ <element name="bibdata">
46
+ <ref name="BibData"/>
47
+ </element>
48
+ </define>
49
+ <define name="preface">
50
+ <element name="preface">
51
+ <oneOrMore>
52
+ <ref name="content"/>
53
+ </oneOrMore>
54
+ </element>
55
+ </define>
56
+ <define name="boilerplate">
57
+ <element name="boilerplate">
58
+ <optional>
59
+ <ref name="copyright-statement"/>
60
+ </optional>
61
+ <optional>
62
+ <ref name="license-statement"/>
63
+ </optional>
64
+ <optional>
65
+ <ref name="legal-statement"/>
66
+ </optional>
67
+ <optional>
68
+ <ref name="feedback-statement"/>
69
+ </optional>
70
+ </element>
71
+ </define>
72
+ <define name="copyright-statement">
73
+ <element name="copyright-statement">
74
+ <ref name="Content-Section"/>
75
+ </element>
76
+ </define>
77
+ <define name="license-statement">
78
+ <element name="license-statement">
79
+ <ref name="Content-Section"/>
80
+ </element>
81
+ </define>
82
+ <define name="legal-statement">
83
+ <element name="legal-statement">
84
+ <ref name="Content-Section"/>
85
+ </element>
86
+ </define>
87
+ <define name="feedback-statement">
88
+ <element name="feedback-statement">
89
+ <ref name="Content-Section"/>
90
+ </element>
91
+ </define>
92
+ <define name="sections">
93
+ <element name="sections">
94
+ <oneOrMore>
95
+ <choice>
96
+ <ref name="content"/>
97
+ <ref name="clause"/>
98
+ <ref name="terms"/>
99
+ <ref name="definitions"/>
100
+ </choice>
101
+ </oneOrMore>
102
+ </element>
103
+ </define>
104
+ <define name="definitions">
105
+ <element name="definitions">
106
+ <optional>
107
+ <attribute name="id">
108
+ <data type="ID"/>
109
+ </attribute>
110
+ </optional>
111
+ <optional>
112
+ <ref name="section-title"/>
113
+ </optional>
114
+ <ref name="dl"/>
115
+ </element>
116
+ </define>
117
+ <define name="section-title">
118
+ <element name="title">
119
+ <zeroOrMore>
120
+ <ref name="TextElement"/>
121
+ </zeroOrMore>
122
+ </element>
123
+ </define>
124
+ <define name="content">
125
+ <element name="content">
126
+ <ref name="Content-Section"/>
127
+ </element>
128
+ </define>
129
+ <define name="content-subsection">
130
+ <element name="clause">
131
+ <ref name="Content-Section"/>
132
+ </element>
133
+ </define>
134
+ <define name="Basic-Section">
135
+ <optional>
136
+ <attribute name="id">
137
+ <data type="ID"/>
138
+ </attribute>
139
+ </optional>
140
+ <optional>
141
+ <ref name="section-title"/>
142
+ </optional>
143
+ <oneOrMore>
144
+ <ref name="BasicBlock"/>
145
+ </oneOrMore>
146
+ <zeroOrMore>
147
+ <ref name="note"/>
148
+ </zeroOrMore>
149
+ </define>
150
+ <define name="Content-Section">
151
+ <optional>
152
+ <attribute name="id">
153
+ <data type="ID"/>
154
+ </attribute>
155
+ </optional>
156
+ <optional>
157
+ <ref name="section-title"/>
158
+ </optional>
159
+ <choice>
160
+ <group>
161
+ <oneOrMore>
162
+ <ref name="BasicBlock"/>
163
+ </oneOrMore>
164
+ <zeroOrMore>
165
+ <ref name="note"/>
166
+ </zeroOrMore>
167
+ </group>
168
+ <oneOrMore>
169
+ <ref name="content-subsection"/>
170
+ </oneOrMore>
171
+ </choice>
172
+ </define>
173
+ <define name="clause">
174
+ <element name="clause">
175
+ <ref name="Clause-Section"/>
176
+ </element>
177
+ </define>
178
+ <define name="Clause-Section">
179
+ <optional>
180
+ <attribute name="id">
181
+ <data type="ID"/>
182
+ </attribute>
183
+ </optional>
184
+ <optional>
185
+ <ref name="section-title"/>
186
+ </optional>
187
+ <choice>
188
+ <group>
189
+ <oneOrMore>
190
+ <ref name="BasicBlock"/>
191
+ </oneOrMore>
192
+ <zeroOrMore>
193
+ <ref name="note"/>
194
+ </zeroOrMore>
195
+ </group>
196
+ <oneOrMore>
197
+ <ref name="clause-subsection"/>
198
+ </oneOrMore>
199
+ </choice>
200
+ </define>
201
+ <define name="clause-subsection">
202
+ <element name="clause">
203
+ <ref name="Clause-Section"/>
204
+ </element>
205
+ </define>
206
+ <define name="annex">
207
+ <element name="annex">
208
+ <optional>
209
+ <attribute name="id">
210
+ <data type="ID"/>
211
+ </attribute>
212
+ </optional>
213
+ <attribute name="obligation">
214
+ <choice>
215
+ <value>normative</value>
216
+ <value>informative</value>
217
+ </choice>
218
+ </attribute>
219
+ <optional>
220
+ <ref name="section-title"/>
221
+ </optional>
222
+ <choice>
223
+ <group>
224
+ <oneOrMore>
225
+ <ref name="BasicBlock"/>
226
+ </oneOrMore>
227
+ <zeroOrMore>
228
+ <ref name="note"/>
229
+ </zeroOrMore>
230
+ </group>
231
+ <oneOrMore>
232
+ <ref name="clause-subsection"/>
233
+ </oneOrMore>
234
+ </choice>
235
+ </element>
236
+ </define>
237
+ <define name="references">
238
+ <element name="references">
239
+ <optional>
240
+ <attribute name="id">
241
+ <data type="ID"/>
242
+ </attribute>
243
+ </optional>
244
+ <optional>
245
+ <ref name="section-title"/>
246
+ </optional>
247
+ <zeroOrMore>
248
+ <ref name="bibitem"/>
249
+ </zeroOrMore>
250
+ </element>
251
+ </define>
252
+ <define name="terms">
253
+ <element name="terms">
254
+ <optional>
255
+ <attribute name="id">
256
+ <data type="ID"/>
257
+ </attribute>
258
+ </optional>
259
+ <oneOrMore>
260
+ <ref name="term"/>
261
+ </oneOrMore>
262
+ </element>
263
+ </define>
264
+ <define name="term">
265
+ <element name="term">
266
+ <optional>
267
+ <attribute name="id">
268
+ <data type="ID"/>
269
+ </attribute>
270
+ </optional>
271
+ <oneOrMore>
272
+ <ref name="preferred"/>
273
+ </oneOrMore>
274
+ <zeroOrMore>
275
+ <ref name="admitted"/>
276
+ </zeroOrMore>
277
+ <zeroOrMore>
278
+ <ref name="deprecates"/>
279
+ </zeroOrMore>
280
+ <optional>
281
+ <ref name="termdomain"/>
282
+ </optional>
283
+ <ref name="definition"/>
284
+ <zeroOrMore>
285
+ <ref name="termnote"/>
286
+ </zeroOrMore>
287
+ <zeroOrMore>
288
+ <ref name="termexample"/>
289
+ </zeroOrMore>
290
+ <zeroOrMore>
291
+ <ref name="termsource"/>
292
+ </zeroOrMore>
293
+ </element>
294
+ </define>
295
+ <define name="preferred">
296
+ <element name="preferred">
297
+ <oneOrMore>
298
+ <ref name="TextElement"/>
299
+ </oneOrMore>
300
+ </element>
301
+ </define>
302
+ <define name="admitted">
303
+ <element name="admitted">
304
+ <oneOrMore>
305
+ <ref name="TextElement"/>
306
+ </oneOrMore>
307
+ </element>
308
+ </define>
309
+ <define name="deprecates">
310
+ <element name="deprecates">
311
+ <oneOrMore>
312
+ <ref name="TextElement"/>
313
+ </oneOrMore>
314
+ </element>
315
+ </define>
316
+ <define name="termdomain">
317
+ <element name="domain">
318
+ <oneOrMore>
319
+ <ref name="TextElement"/>
320
+ </oneOrMore>
321
+ </element>
322
+ </define>
323
+ <define name="definition">
324
+ <element name="definition">
325
+ <ref name="paragraph"/>
326
+ </element>
327
+ </define>
328
+ <define name="termnote">
329
+ <element name="termnote">
330
+ <attribute name="id">
331
+ <data type="ID"/>
332
+ </attribute>
333
+ <ref name="paragraph"/>
334
+ </element>
335
+ </define>
336
+ <define name="termexample">
337
+ <element name="termexample">
338
+ <attribute name="id">
339
+ <data type="ID"/>
340
+ </attribute>
341
+ <ref name="paragraph"/>
342
+ </element>
343
+ </define>
344
+ <define name="termsource">
345
+ <element name="termsource">
346
+ <attribute name="status">
347
+ <choice>
348
+ <value>identical</value>
349
+ <value>modified</value>
350
+ </choice>
351
+ </attribute>
352
+ <ref name="origin"/>
353
+ <optional>
354
+ <ref name="modification"/>
355
+ </optional>
356
+ </element>
357
+ </define>
358
+ <define name="origin">
359
+ <element name="origin">
360
+ <ref name="erefType"/>
361
+ </element>
362
+ </define>
363
+ <define name="modification">
364
+ <element name="modification">
365
+ <ref name="paragraph"/>
366
+ </element>
367
+ </define>
368
+ <define name="BasicBlock">
369
+ <choice>
370
+ <ref name="paragraph-with-footnote"/>
371
+ <ref name="table"/>
372
+ <ref name="formula"/>
373
+ <ref name="admonition"/>
374
+ <ref name="ol"/>
375
+ <ref name="ul"/>
376
+ <ref name="dl"/>
377
+ <ref name="figure"/>
378
+ <ref name="quote"/>
379
+ <ref name="sourcecode"/>
380
+ <ref name="example"/>
381
+ <ref name="review"/>
382
+ <ref name="pre"/>
383
+ </choice>
384
+ </define>
385
+ <define name="paragraph">
386
+ <element name="p">
387
+ <ref name="ParagraphType"/>
388
+ </element>
389
+ </define>
390
+ <define name="Alignments">
391
+ <choice>
392
+ <value>left</value>
393
+ <value>right</value>
394
+ <value>center</value>
395
+ <value>justified</value>
396
+ </choice>
397
+ </define>
398
+ <define name="ParagraphType">
399
+ <attribute name="id">
400
+ <data type="ID"/>
401
+ </attribute>
402
+ <optional>
403
+ <attribute name="align">
404
+ <ref name="Alignments"/>
405
+ </attribute>
406
+ </optional>
407
+ <zeroOrMore>
408
+ <ref name="TextElement"/>
409
+ </zeroOrMore>
410
+ <zeroOrMore>
411
+ <ref name="note"/>
412
+ </zeroOrMore>
413
+ </define>
414
+ <define name="paragraph-with-footnote">
415
+ <element name="p">
416
+ <attribute name="id">
417
+ <data type="ID"/>
418
+ </attribute>
419
+ <optional>
420
+ <attribute name="align">
421
+ <ref name="Alignments"/>
422
+ </attribute>
423
+ </optional>
424
+ <zeroOrMore>
425
+ <choice>
426
+ <ref name="TextElement"/>
427
+ <ref name="fn"/>
428
+ </choice>
429
+ </zeroOrMore>
430
+ <zeroOrMore>
431
+ <ref name="note"/>
432
+ </zeroOrMore>
433
+ </element>
434
+ </define>
435
+ <define name="note">
436
+ <element name="note">
437
+ <attribute name="id">
438
+ <data type="ID"/>
439
+ </attribute>
440
+ <oneOrMore>
441
+ <ref name="paragraph"/>
442
+ </oneOrMore>
443
+ </element>
444
+ </define>
445
+ <define name="review">
446
+ <element name="review">
447
+ <attribute name="id">
448
+ <data type="ID"/>
449
+ </attribute>
450
+ <attribute name="reviewer"/>
451
+ <optional>
452
+ <attribute name="date">
453
+ <data type="dateTime"/>
454
+ </attribute>
455
+ </optional>
456
+ <attribute name="from">
457
+ <data type="IDREF"/>
458
+ </attribute>
459
+ <optional>
460
+ <attribute name="to">
461
+ <data type="IDREF"/>
462
+ </attribute>
463
+ </optional>
464
+ <oneOrMore>
465
+ <ref name="paragraph"/>
466
+ </oneOrMore>
467
+ </element>
468
+ </define>
469
+ <define name="formula">
470
+ <element name="formula">
471
+ <attribute name="id">
472
+ <data type="ID"/>
473
+ </attribute>
474
+ <optional>
475
+ <attribute name="unnumbered">
476
+ <data type="boolean"/>
477
+ </attribute>
478
+ </optional>
479
+ <ref name="stem"/>
480
+ <optional>
481
+ <ref name="dl"/>
482
+ </optional>
483
+ <zeroOrMore>
484
+ <ref name="note"/>
485
+ </zeroOrMore>
486
+ </element>
487
+ </define>
488
+ <define name="quote">
489
+ <element name="quote">
490
+ <attribute name="id">
491
+ <data type="ID"/>
492
+ </attribute>
493
+ <optional>
494
+ <attribute name="alignment">
495
+ <ref name="Alignments"/>
496
+ </attribute>
497
+ </optional>
498
+ <optional>
499
+ <ref name="quote-source"/>
500
+ </optional>
501
+ <optional>
502
+ <ref name="quote-author"/>
503
+ </optional>
504
+ <oneOrMore>
505
+ <ref name="paragraph-with-footnote"/>
506
+ </oneOrMore>
507
+ <zeroOrMore>
508
+ <ref name="note"/>
509
+ </zeroOrMore>
510
+ </element>
511
+ </define>
512
+ <define name="quote-source">
513
+ <element name="source">
514
+ <ref name="erefType"/>
515
+ </element>
516
+ </define>
517
+ <define name="quote-author">
518
+ <element name="author">
519
+ <text/>
520
+ </element>
521
+ </define>
522
+ <define name="sourcecode">
523
+ <element name="sourcecode">
524
+ <attribute name="id">
525
+ <data type="ID"/>
526
+ </attribute>
527
+ <optional>
528
+ <attribute name="unnumbered">
529
+ <data type="boolean"/>
530
+ </attribute>
531
+ </optional>
532
+ <optional>
533
+ <attribute name="lang"/>
534
+ </optional>
535
+ <optional>
536
+ <ref name="tname"/>
537
+ </optional>
538
+ <oneOrMore>
539
+ <choice>
540
+ <text/>
541
+ <ref name="callout"/>
542
+ </choice>
543
+ </oneOrMore>
544
+ <zeroOrMore>
545
+ <ref name="annotation"/>
546
+ </zeroOrMore>
547
+ <zeroOrMore>
548
+ <ref name="note"/>
549
+ </zeroOrMore>
550
+ </element>
551
+ </define>
552
+ <define name="pre">
553
+ <element name="pre">
554
+ <attribute name="id">
555
+ <data type="ID"/>
556
+ </attribute>
557
+ <optional>
558
+ <ref name="tname"/>
559
+ </optional>
560
+ <text/>
561
+ <zeroOrMore>
562
+ <ref name="note"/>
563
+ </zeroOrMore>
564
+ </element>
565
+ </define>
566
+ <define name="table">
567
+ <element name="table">
568
+ <attribute name="id">
569
+ <data type="ID"/>
570
+ </attribute>
571
+ <optional>
572
+ <attribute name="unnumbered">
573
+ <data type="boolean"/>
574
+ </attribute>
575
+ </optional>
576
+ <optional>
577
+ <attribute name="alt"/>
578
+ </optional>
579
+ <optional>
580
+ <ref name="tname"/>
581
+ </optional>
582
+ <optional>
583
+ <ref name="thead"/>
584
+ </optional>
585
+ <ref name="tbody"/>
586
+ <optional>
587
+ <ref name="tfoot"/>
588
+ </optional>
589
+ <zeroOrMore>
590
+ <ref name="table-note"/>
591
+ </zeroOrMore>
592
+ <optional>
593
+ <ref name="dl"/>
594
+ </optional>
595
+ </element>
596
+ </define>
597
+ <define name="tname">
598
+ <element name="name">
599
+ <text/>
600
+ </element>
601
+ </define>
602
+ <define name="thead">
603
+ <element name="thead">
604
+ <ref name="tr"/>
605
+ </element>
606
+ </define>
607
+ <define name="tfoot">
608
+ <element name="tfoot">
609
+ <ref name="tr"/>
610
+ </element>
611
+ </define>
612
+ <define name="tbody">
613
+ <element name="tbody">
614
+ <oneOrMore>
615
+ <ref name="tr"/>
616
+ </oneOrMore>
617
+ </element>
618
+ </define>
619
+ <define name="table-note">
620
+ <element name="note">
621
+ <ref name="paragraph"/>
622
+ </element>
623
+ </define>
624
+ <define name="tr">
625
+ <element name="tr">
626
+ <oneOrMore>
627
+ <choice>
628
+ <ref name="td"/>
629
+ <ref name="th"/>
630
+ </choice>
631
+ </oneOrMore>
632
+ </element>
633
+ </define>
634
+ <define name="td">
635
+ <element name="td">
636
+ <optional>
637
+ <attribute name="colspan"/>
638
+ </optional>
639
+ <optional>
640
+ <attribute name="rowspan"/>
641
+ </optional>
642
+ <optional>
643
+ <attribute name="align">
644
+ <choice>
645
+ <value>left</value>
646
+ <value>right</value>
647
+ <value>center</value>
648
+ </choice>
649
+ </attribute>
650
+ </optional>
651
+ <choice>
652
+ <zeroOrMore>
653
+ <ref name="TextElement"/>
654
+ </zeroOrMore>
655
+ <oneOrMore>
656
+ <ref name="paragraph-with-footnote"/>
657
+ </oneOrMore>
658
+ </choice>
659
+ </element>
660
+ </define>
661
+ <define name="th">
662
+ <element name="th">
663
+ <optional>
664
+ <attribute name="colspan"/>
665
+ </optional>
666
+ <optional>
667
+ <attribute name="rowspan"/>
668
+ </optional>
669
+ <optional>
670
+ <attribute name="align">
671
+ <choice>
672
+ <value>left</value>
673
+ <value>right</value>
674
+ <value>center</value>
675
+ </choice>
676
+ </attribute>
677
+ </optional>
678
+ <choice>
679
+ <zeroOrMore>
680
+ <ref name="TextElement"/>
681
+ </zeroOrMore>
682
+ <oneOrMore>
683
+ <ref name="paragraph-with-footnote"/>
684
+ </oneOrMore>
685
+ </choice>
686
+ </element>
687
+ </define>
688
+ <define name="example">
689
+ <element name="example">
690
+ <attribute name="id">
691
+ <data type="ID"/>
692
+ </attribute>
693
+ <optional>
694
+ <attribute name="unnumbered">
695
+ <data type="boolean"/>
696
+ </attribute>
697
+ </optional>
698
+ <oneOrMore>
699
+ <choice>
700
+ <ref name="formula"/>
701
+ <ref name="ul"/>
702
+ <ref name="ol"/>
703
+ <ref name="dl"/>
704
+ <ref name="quote"/>
705
+ <ref name="sourcecode"/>
706
+ <ref name="paragraph-with-footnote"/>
707
+ </choice>
708
+ </oneOrMore>
709
+ <zeroOrMore>
710
+ <ref name="note"/>
711
+ </zeroOrMore>
712
+ </element>
713
+ </define>
714
+ <define name="admonition">
715
+ <element name="admonition">
716
+ <attribute name="type">
717
+ <choice>
718
+ <value>warning</value>
719
+ <value>note</value>
720
+ <value>tip</value>
721
+ <value>important</value>
722
+ <value>caution</value>
723
+ </choice>
724
+ </attribute>
725
+ <attribute name="id">
726
+ <data type="ID"/>
727
+ </attribute>
728
+ <zeroOrMore>
729
+ <ref name="paragraph-with-footnote"/>
730
+ </zeroOrMore>
731
+ <zeroOrMore>
732
+ <ref name="note"/>
733
+ </zeroOrMore>
734
+ </element>
735
+ </define>
736
+ <define name="figure">
737
+ <element name="figure">
738
+ <attribute name="id">
739
+ <data type="ID"/>
740
+ </attribute>
741
+ <optional>
742
+ <attribute name="unnumbered">
743
+ <data type="boolean"/>
744
+ </attribute>
745
+ </optional>
746
+ <optional>
747
+ <ref name="source"/>
748
+ </optional>
749
+ <optional>
750
+ <ref name="tname"/>
751
+ </optional>
752
+ <choice>
753
+ <ref name="image"/>
754
+ <ref name="pre"/>
755
+ <zeroOrMore>
756
+ <ref name="figure"/>
757
+ </zeroOrMore>
758
+ </choice>
759
+ <zeroOrMore>
760
+ <ref name="fn"/>
761
+ </zeroOrMore>
762
+ <optional>
763
+ <ref name="dl"/>
764
+ </optional>
765
+ <zeroOrMore>
766
+ <ref name="note"/>
767
+ </zeroOrMore>
768
+ </element>
769
+ </define>
770
+ <define name="TextElement">
771
+ <choice>
772
+ <text/>
773
+ <ref name="em"/>
774
+ <ref name="eref"/>
775
+ <ref name="strong"/>
776
+ <ref name="stem"/>
777
+ <ref name="sub"/>
778
+ <ref name="sup"/>
779
+ <ref name="tt"/>
780
+ <ref name="keyword"/>
781
+ <ref name="strike"/>
782
+ <ref name="smallcap"/>
783
+ <ref name="xref"/>
784
+ <ref name="br"/>
785
+ <ref name="hyperlink"/>
786
+ <ref name="hr"/>
787
+ <ref name="pagebreak"/>
788
+ <ref name="bookmark"/>
789
+ </choice>
790
+ </define>
791
+ <define name="PureTextElement">
792
+ <choice>
793
+ <text/>
794
+ <ref name="em"/>
795
+ <ref name="strong"/>
796
+ <ref name="sub"/>
797
+ <ref name="sup"/>
798
+ <ref name="tt"/>
799
+ <ref name="keyword"/>
800
+ <ref name="strike"/>
801
+ <ref name="smallcap"/>
802
+ <ref name="br"/>
803
+ </choice>
804
+ </define>
805
+ <define name="source">
806
+ <element name="source">
807
+ <ref name="TypedUri"/>
808
+ </element>
809
+ </define>
810
+ <define name="em">
811
+ <element name="em">
812
+ <zeroOrMore>
813
+ <ref name="PureTextElement"/>
814
+ </zeroOrMore>
815
+ </element>
816
+ </define>
817
+ <define name="strong">
818
+ <element name="strong">
819
+ <zeroOrMore>
820
+ <ref name="PureTextElement"/>
821
+ </zeroOrMore>
822
+ </element>
823
+ </define>
824
+ <define name="tt">
825
+ <element name="tt">
826
+ <zeroOrMore>
827
+ <ref name="PureTextElement"/>
828
+ </zeroOrMore>
829
+ </element>
830
+ </define>
831
+ <define name="keyword">
832
+ <element name="keyword">
833
+ <zeroOrMore>
834
+ <ref name="PureTextElement"/>
835
+ </zeroOrMore>
836
+ </element>
837
+ </define>
838
+ <define name="sub">
839
+ <element name="sub">
840
+ <zeroOrMore>
841
+ <ref name="PureTextElement"/>
842
+ </zeroOrMore>
843
+ </element>
844
+ </define>
845
+ <define name="sup">
846
+ <element name="sup">
847
+ <zeroOrMore>
848
+ <ref name="PureTextElement"/>
849
+ </zeroOrMore>
850
+ </element>
851
+ </define>
852
+ <define name="strike">
853
+ <element name="strike">
854
+ <zeroOrMore>
855
+ <ref name="PureTextElement"/>
856
+ </zeroOrMore>
857
+ </element>
858
+ </define>
859
+ <define name="smallcap">
860
+ <element name="smallcap">
861
+ <zeroOrMore>
862
+ <ref name="PureTextElement"/>
863
+ </zeroOrMore>
864
+ </element>
865
+ </define>
866
+ <define name="br">
867
+ <element name="br">
868
+ <empty/>
869
+ </element>
870
+ </define>
871
+ <define name="hr">
872
+ <element name="hr">
873
+ <empty/>
874
+ </element>
875
+ </define>
876
+ <define name="pagebreak">
877
+ <element name="pagebreak">
878
+ <empty/>
879
+ </element>
880
+ </define>
881
+ <!-- bare ID element, used for referencing arbitrary spans of text -->
882
+ <define name="bookmark">
883
+ <element name="bookmark">
884
+ <attribute name="id">
885
+ <data type="ID"/>
886
+ </attribute>
887
+ <empty/>
888
+ </element>
889
+ </define>
890
+ <define name="ReferenceFormat">
891
+ <choice>
892
+ <value>external</value>
893
+ <value>inline</value>
894
+ <value>footnote</value>
895
+ <value>callout</value>
896
+ </choice>
897
+ </define>
898
+ <define name="eref">
899
+ <element name="eref">
900
+ <ref name="erefType"/>
901
+ </element>
902
+ </define>
903
+ <define name="erefType">
904
+ <optional>
905
+ <attribute name="normative">
906
+ <data type="boolean"/>
907
+ </attribute>
908
+ </optional>
909
+ <attribute name="citeas"/>
910
+ <attribute name="type">
911
+ <ref name="ReferenceFormat"/>
912
+ </attribute>
913
+ <ref name="CitationType"/>
914
+ <text/>
915
+ </define>
916
+ <define name="hyperlink">
917
+ <element name="link">
918
+ <attribute name="target">
919
+ <data type="anyURI"/>
920
+ </attribute>
921
+ <attribute name="type">
922
+ <ref name="ReferenceFormat"/>
923
+ </attribute>
924
+ <optional>
925
+ <attribute name="alt"/>
926
+ </optional>
927
+ <text/>
928
+ </element>
929
+ </define>
930
+ <define name="xref">
931
+ <element name="xref">
932
+ <attribute name="target">
933
+ <data type="IDREF"/>
934
+ </attribute>
935
+ <attribute name="type">
936
+ <ref name="ReferenceFormat"/>
937
+ </attribute>
938
+ <text/>
939
+ </element>
940
+ </define>
941
+ <define name="fn">
942
+ <element name="fn">
943
+ <attribute name="reference"/>
944
+ <oneOrMore>
945
+ <ref name="paragraph"/>
946
+ </oneOrMore>
947
+ </element>
948
+ </define>
949
+ <!--
950
+ This is xref with fixed @type="footnote", and @target built in as paragraph+
951
+ @reference replaces ReferenceElement/text
952
+ so <fn reference="2"><p>This is a footnote</p></fn>
953
+ corresponds to
954
+ <eref type="footnote" target="fn2">2</xref> <p id="fn2">This is a footnote</p>
955
+ -->
956
+ <define name="callout">
957
+ <element name="callout">
958
+ <attribute name="target">
959
+ <data type="IDREF"/>
960
+ </attribute>
961
+ <text/>
962
+ </element>
963
+ </define>
964
+ <!--
965
+ This is xref with fixed @type="callout"; the target by convention is in an annotation in the same source code snippet
966
+ so <callout target="xyz">1</callout>
967
+ corresponds to <xref type="callout" target="xyz">1</xref>
968
+ -->
969
+ <define name="image">
970
+ <element name="image">
971
+ <attribute name="id">
972
+ <data type="ID"/>
973
+ </attribute>
974
+ <optional>
975
+ <attribute name="src">
976
+ <data type="anyURI"/>
977
+ </attribute>
978
+ </optional>
979
+ <attribute name="imagetype">
980
+ <choice>
981
+ <value>SVG</value>
982
+ <value>JPEG</value>
983
+ <value>GIF</value>
984
+ <value>PNG</value>
985
+ <value>PDF</value>
986
+ </choice>
987
+ </attribute>
988
+ <optional>
989
+ <attribute name="width">
990
+ <choice>
991
+ <data type="int"/>
992
+ <value>auto</value>
993
+ </choice>
994
+ </attribute>
995
+ </optional>
996
+ <optional>
997
+ <attribute name="height">
998
+ <choice>
999
+ <data type="int"/>
1000
+ <value>auto</value>
1001
+ </choice>
1002
+ </attribute>
1003
+ </optional>
1004
+ <optional>
1005
+ <attribute name="alt"/>
1006
+ </optional>
1007
+ </element>
1008
+ </define>
1009
+ <define name="stem">
1010
+ <element name="stem">
1011
+ <attribute name="type">
1012
+ <choice>
1013
+ <value>MathML</value>
1014
+ <value>AsciiMath</value>
1015
+ </choice>
1016
+ </attribute>
1017
+ <oneOrMore>
1018
+ <choice>
1019
+ <text/>
1020
+ <ref name="AnyElement"/>
1021
+ </choice>
1022
+ </oneOrMore>
1023
+ </element>
1024
+ </define>
1025
+ <define name="annotation">
1026
+ <element name="annotation">
1027
+ <attribute name="id">
1028
+ <data type="ID"/>
1029
+ </attribute>
1030
+ <ref name="paragraph"/>
1031
+ </element>
1032
+ </define>
1033
+ <define name="ul">
1034
+ <element name="ul">
1035
+ <attribute name="id">
1036
+ <data type="ID"/>
1037
+ </attribute>
1038
+ <oneOrMore>
1039
+ <ref name="li"/>
1040
+ </oneOrMore>
1041
+ <zeroOrMore>
1042
+ <ref name="note"/>
1043
+ </zeroOrMore>
1044
+ </element>
1045
+ </define>
1046
+ <define name="li">
1047
+ <element name="li">
1048
+ <optional>
1049
+ <attribute name="id">
1050
+ <data type="ID"/>
1051
+ </attribute>
1052
+ </optional>
1053
+ <oneOrMore>
1054
+ <ref name="paragraph-with-footnote"/>
1055
+ </oneOrMore>
1056
+ </element>
1057
+ </define>
1058
+ <define name="ol">
1059
+ <element name="ol">
1060
+ <attribute name="id">
1061
+ <data type="ID"/>
1062
+ </attribute>
1063
+ <attribute name="type">
1064
+ <choice>
1065
+ <value>roman</value>
1066
+ <value>alphabet</value>
1067
+ <value>arabic</value>
1068
+ <value>roman_upper</value>
1069
+ <value>alphabet_upper</value>
1070
+ </choice>
1071
+ </attribute>
1072
+ <oneOrMore>
1073
+ <ref name="li"/>
1074
+ </oneOrMore>
1075
+ <zeroOrMore>
1076
+ <ref name="note"/>
1077
+ </zeroOrMore>
1078
+ </element>
1079
+ </define>
1080
+ <define name="dl">
1081
+ <element name="dl">
1082
+ <attribute name="id">
1083
+ <data type="ID"/>
1084
+ </attribute>
1085
+ <oneOrMore>
1086
+ <ref name="dt"/>
1087
+ <ref name="dd"/>
1088
+ </oneOrMore>
1089
+ <zeroOrMore>
1090
+ <ref name="note"/>
1091
+ </zeroOrMore>
1092
+ </element>
1093
+ </define>
1094
+ <define name="dt">
1095
+ <element name="dt">
1096
+ <zeroOrMore>
1097
+ <ref name="TextElement"/>
1098
+ </zeroOrMore>
1099
+ </element>
1100
+ </define>
1101
+ <define name="dd">
1102
+ <element name="dd">
1103
+ <zeroOrMore>
1104
+ <ref name="paragraph-with-footnote"/>
1105
+ </zeroOrMore>
1106
+ </element>
1107
+ </define>
1108
+ <define name="ext">
1109
+ <element name="ext">
1110
+ <ref name="BibDataExtensionType"/>
1111
+ </element>
1112
+ </define>
1113
+ <define name="BibDataExtensionType">
1114
+ <optional>
1115
+ <ref name="doctype"/>
1116
+ </optional>
1117
+ </define>
1118
+ <define name="doctype">
1119
+ <element name="doctype">
1120
+ <ref name="DocumentType"/>
1121
+ </element>
1122
+ </define>
1123
+ <define name="DocumentType">
1124
+ <value>document</value>
1125
+ </define>
1126
+ <define name="BibData">
1127
+ <ref name="BibliographicItem"/>
1128
+ <optional>
1129
+ <ref name="ext"/>
1130
+ </optional>
1131
+ </define>
1132
+ </grammar>