metanorma-standoc 2.2.6 → 2.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/html/htmlstyle.css +6 -0
  3. data/lib/metanorma/standoc/base.rb +3 -5
  4. data/lib/metanorma/standoc/biblio.rng +5 -0
  5. data/lib/metanorma/standoc/cleanup.rb +17 -17
  6. data/lib/metanorma/standoc/cleanup_amend.rb +2 -2
  7. data/lib/metanorma/standoc/cleanup_biblio.rb +5 -4
  8. data/lib/metanorma/standoc/cleanup_maths.rb +12 -4
  9. data/lib/metanorma/standoc/cleanup_section.rb +19 -9
  10. data/lib/metanorma/standoc/cleanup_symbols.rb +14 -7
  11. data/lib/metanorma/standoc/cleanup_text.rb +10 -4
  12. data/lib/metanorma/standoc/cleanup_toc.rb +1 -2
  13. data/lib/metanorma/standoc/cleanup_xref.rb +58 -16
  14. data/lib/metanorma/standoc/inline.rb +27 -12
  15. data/lib/metanorma/standoc/isodoc.rng +47 -13
  16. data/lib/metanorma/standoc/ref_utility.rb +1 -0
  17. data/lib/metanorma/standoc/render.rb +12 -3
  18. data/lib/metanorma/standoc/section.rb +10 -3
  19. data/lib/metanorma/standoc/utils.rb +6 -1
  20. data/lib/metanorma/standoc/validate.rb +1 -1
  21. data/lib/metanorma/standoc/version.rb +1 -1
  22. data/metanorma-standoc.gemspec +5 -2
  23. metadata +4 -128
  24. data/.github/workflows/automerge.yml +0 -31
  25. data/.github/workflows/rake.yml +0 -15
  26. data/.github/workflows/release.yml +0 -24
  27. data/Rakefile +0 -8
  28. data/bin/rspec +0 -18
  29. data/spec/assets/a1.adoc +0 -8
  30. data/spec/assets/a2.adoc +0 -10
  31. data/spec/assets/a3.adoc +0 -9
  32. data/spec/assets/a3a.adoc +0 -7
  33. data/spec/assets/a4.adoc +0 -4
  34. data/spec/assets/boilerplate.xml +0 -4
  35. data/spec/assets/codes.yml +0 -695
  36. data/spec/assets/correct.png +0 -0
  37. data/spec/assets/corrupt.png +0 -0
  38. data/spec/assets/header.html +0 -7
  39. data/spec/assets/html-override.css +0 -1
  40. data/spec/assets/html.scss +0 -13
  41. data/spec/assets/htmlcover.html +0 -4
  42. data/spec/assets/htmlintro.html +0 -5
  43. data/spec/assets/i18n.yaml +0 -17
  44. data/spec/assets/iso.adoc +0 -10
  45. data/spec/assets/iso.headless.html +0 -33
  46. data/spec/assets/iso.xml +0 -8
  47. data/spec/assets/iso123.rxl +0 -107
  48. data/spec/assets/rice_image1.png +0 -0
  49. data/spec/assets/scripts.html +0 -3
  50. data/spec/assets/std.css +0 -2
  51. data/spec/assets/word-override.css +0 -1
  52. data/spec/assets/word.scss +0 -13
  53. data/spec/assets/wordcover.html +0 -3
  54. data/spec/assets/wordintro.html +0 -4
  55. data/spec/assets/xref_error.adoc +0 -8
  56. data/spec/examples/103_01_02.html +0 -247
  57. data/spec/examples/codes_table.html +0 -3174
  58. data/spec/examples/datamodel/address_class_profile.adoc +0 -5
  59. data/spec/examples/datamodel/address_class_profile.presentation.xml +0 -14
  60. data/spec/examples/datamodel/address_component_profile.adoc +0 -5
  61. data/spec/examples/datamodel/blank_definition_profile.adoc +0 -5
  62. data/spec/examples/datamodel/common_models_diagram.adoc +0 -5
  63. data/spec/examples/datamodel/models/models/AddressClassProfile.yml +0 -90
  64. data/spec/examples/datamodel/models/models/AddressComponentProfile.yml +0 -63
  65. data/spec/examples/datamodel/models/models/AddressComponentSpecification.yml +0 -15
  66. data/spec/examples/datamodel/models/models/AddressProfile.yml +0 -36
  67. data/spec/examples/datamodel/models/models/AttributeProfile.yml +0 -32
  68. data/spec/examples/datamodel/models/models/InterchangeAddressClassProfile.yml +0 -79
  69. data/spec/examples/datamodel/models/models/Localization copy.yml +0 -23
  70. data/spec/examples/datamodel/models/models/Localization.yml +0 -23
  71. data/spec/examples/datamodel/models/models/ProfileCompliantAddress.yml +0 -36
  72. data/spec/examples/datamodel/models/models/ProfileCompliantAddressComponent.yml +0 -15
  73. data/spec/examples/datamodel/models/models/Signature.yml +0 -20
  74. data/spec/examples/datamodel/models/models/SignatureBlankDefinition.yml +0 -20
  75. data/spec/examples/datamodel/models/models/TextDirectionCode copy.yml +0 -16
  76. data/spec/examples/datamodel/models/models/TextDirectionCode.yml +0 -16
  77. data/spec/examples/datamodel/models/models/Validity.yml +0 -14
  78. data/spec/examples/datamodel/models/models/iso19160-1/Address.yml +0 -22
  79. data/spec/examples/datamodel/models/models/iso19160-1/AddressComponent.yml +0 -2
  80. data/spec/examples/datamodel/models/style.uml.inc +0 -37
  81. data/spec/examples/datamodel/models/views/CommonModels.yml +0 -9
  82. data/spec/examples/datamodel/models/views/TopDown.yml +0 -62
  83. data/spec/examples/datamodel/top_down_diagram.adoc +0 -5
  84. data/spec/examples/english.yaml +0 -69
  85. data/spec/examples/iso_123_.xml +0 -46
  86. data/spec/examples/iso_123_all_parts.xml +0 -46
  87. data/spec/examples/iso_123_no_year_note.xml +0 -47
  88. data/spec/examples/iso_124_.xml +0 -42
  89. data/spec/examples/iso_216_.xml +0 -48
  90. data/spec/examples/iso_iec_12382_.xml +0 -49
  91. data/spec/examples/rice.adoc +0 -715
  92. data/spec/examples/rice.preview.html +0 -1877
  93. data/spec/examples/rice.sh +0 -4
  94. data/spec/examples/rice_images/rice_image1.png +0 -0
  95. data/spec/examples/rice_images/rice_image2.png +0 -0
  96. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  97. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  98. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  99. data/spec/fixtures/action_schemaexpg1.svg +0 -122
  100. data/spec/fixtures/datamodel_description_sections_tree.xml +0 -327
  101. data/spec/fixtures/diagram_definitions.lutaml +0 -22
  102. data/spec/fixtures/macros_datamodel/address_class_profile.xml +0 -149
  103. data/spec/fixtures/macros_datamodel/address_component_profile.xml +0 -71
  104. data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +0 -51
  105. data/spec/fixtures/macros_datamodel/common_models_diagram.xml +0 -7
  106. data/spec/fixtures/macros_datamodel/top_down_diagram.xml +0 -7
  107. data/spec/fixtures/test.exp +0 -121
  108. data/spec/fixtures/test.xmi +0 -9250
  109. data/spec/metanorma/base_spec.rb +0 -1125
  110. data/spec/metanorma/biblio_spec.rb +0 -1012
  111. data/spec/metanorma/blank_spec.rb +0 -37
  112. data/spec/metanorma/blocks_spec.rb +0 -1784
  113. data/spec/metanorma/cleanup_blocks_spec.rb +0 -1099
  114. data/spec/metanorma/cleanup_sections_spec.rb +0 -1849
  115. data/spec/metanorma/cleanup_spec.rb +0 -1931
  116. data/spec/metanorma/cleanup_terms_spec.rb +0 -1543
  117. data/spec/metanorma/datamodel/attributes_table_preprocessor_spec.rb +0 -111
  118. data/spec/metanorma/datamodel/diagram_preprocessor_spec.rb +0 -72
  119. data/spec/metanorma/inline_spec.rb +0 -785
  120. data/spec/metanorma/isobib_cache_spec.rb +0 -742
  121. data/spec/metanorma/lists_spec.rb +0 -232
  122. data/spec/metanorma/macros_concept_spec.rb +0 -1052
  123. data/spec/metanorma/macros_json2text_spec.rb +0 -10
  124. data/spec/metanorma/macros_plantuml_spec.rb +0 -402
  125. data/spec/metanorma/macros_spec.rb +0 -1183
  126. data/spec/metanorma/macros_yaml2text_spec.rb +0 -10
  127. data/spec/metanorma/processor_spec.rb +0 -96
  128. data/spec/metanorma/refs_spec.rb +0 -2807
  129. data/spec/metanorma/reqt_spec.rb +0 -130
  130. data/spec/metanorma/section_spec.rb +0 -1325
  131. data/spec/metanorma/table_spec.rb +0 -474
  132. data/spec/metanorma/validate_spec.rb +0 -886
  133. data/spec/spec_helper.rb +0 -290
  134. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +0 -781
  135. data/spec/vcr_cassettes/bsi16341.yml +0 -486
  136. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +0 -611
  137. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +0 -149
  138. data/spec/vcr_cassettes/hide_refs.yml +0 -587
  139. data/spec/vcr_cassettes/isobib_get_123.yml +0 -149
  140. data/spec/vcr_cassettes/isobib_get_123_1.yml +0 -295
  141. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +0 -385
  142. data/spec/vcr_cassettes/isobib_get_123_2.yml +0 -295
  143. data/spec/vcr_cassettes/isobib_get_123_2001.yml +0 -149
  144. data/spec/vcr_cassettes/isobib_get_124.yml +0 -149
  145. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +0 -367
  146. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +0 -560
  147. data/spec/vcr_cassettes/std-link.yml +0 -149
@@ -1,1052 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::Standoc do
4
- it "processes the Metanorma::Standoc concept and related macros" do
5
- input = <<~INPUT
6
- #{ASCIIDOC_BLANK_HDR}
7
-
8
- {{clause1}}
9
- {{clause two}}
10
- {{clause
11
- two}}
12
- term:[clause1]
13
- {{clause1,w\[o\]rd}}
14
- term:[clause1,w[o&#93;rd]
15
- {{clause1,w\[o\]rd,term}}
16
- {{blah}}
17
- term:[blah]
18
- {{blah,word}}
19
- term:[blah,word]
20
- {{blah,term,word}}
21
- {{blah,term,word,xref}}
22
- {{blah,term,word,xref,options="noital,noref,nolinkmention,nolinkref"}}
23
- {{blah,term,word,xref,options="ital,ref,linkmention,linkref"}}
24
-
25
- related:contrast[blah]
26
-
27
- [[clause1]]
28
- == Clause
29
- Terms are defined here
30
- INPUT
31
- output = <<~OUTPUT
32
- #{BLANK_HDR}
33
- <preface>
34
- <foreword id='_' obligation='informative'>
35
- <title>Foreword</title>
36
- <p id='_'>
37
- <concept>
38
- <strong>
39
- term
40
- <tt>clause1</tt>
41
- not resolved via ID
42
- <tt>clause1</tt>
43
- </strong>
44
- </concept>
45
- <concept>
46
- <strong>
47
- term
48
- <tt>clause two</tt>
49
- not resolved via ID
50
- <tt>clause-two</tt>
51
- </strong>
52
- </concept>
53
- <concept>
54
- <strong>
55
- term
56
- <tt>clause two</tt>
57
- not resolved via ID
58
- <tt>clause-two</tt>
59
- </strong>
60
- </concept>
61
- <concept>
62
- <strong>
63
- term
64
- <tt>clause1</tt>
65
- not resolved via ID
66
- <tt>clause1</tt>
67
- </strong>
68
- </concept>
69
- <concept>
70
- <strong>
71
- term
72
- <tt>clause1</tt>, display <tt>w[o]rd</tt>
73
- not resolved via ID
74
- <tt>clause1</tt>
75
- </strong>
76
- </concept>
77
- <concept>
78
- <strong>
79
- term
80
- <tt>clause1</tt>, display <tt>w[o]rd</tt>
81
- not resolved via ID
82
- <tt>clause1</tt>
83
- </strong>
84
- </concept>
85
- <concept>
86
- <strong>
87
- term
88
- <tt>clause1</tt>, display <tt>w[o]rd</tt>
89
- not resolved via ID
90
- <tt>clause1</tt>
91
- </strong>
92
- </concept>
93
- <concept>
94
- <strong>
95
- term
96
- <tt>blah</tt>
97
- not resolved via ID
98
- <tt>blah</tt>
99
- </strong>
100
- </concept>
101
- <concept>
102
- <strong>
103
- term
104
- <tt>blah</tt>
105
- not resolved via ID
106
- <tt>blah</tt>
107
- </strong>
108
- </concept>
109
- <concept>
110
- <strong>
111
- term
112
- <tt>blah</tt>
113
- , display
114
- <tt>word</tt>
115
- not resolved via ID
116
- <tt>blah</tt>
117
- </strong>
118
- </concept>
119
- <concept>
120
- <strong>
121
- term
122
- <tt>blah</tt>
123
- , display
124
- <tt>word</tt>
125
- not resolved via ID
126
- <tt>blah</tt>
127
- </strong>
128
- </concept>
129
- <concept>
130
- <strong>
131
- term
132
- <tt>blah</tt>
133
- , display
134
- <tt>term</tt>
135
- not resolved via ID
136
- <tt>blah</tt>
137
- </strong>
138
- </concept>
139
- <concept>
140
- <strong>
141
- term
142
- <tt>blah</tt>
143
- , display
144
- <tt>term</tt>
145
- not resolved via ID
146
- <tt>blah</tt>
147
- </strong>
148
- </concept>
149
- <concept ital='false' ref='false' linkmention='false' linkref='false'>
150
- <strong>
151
- term
152
- <tt>blah</tt>
153
- , display
154
- <tt>term</tt>
155
- not resolved via ID
156
- <tt>blah</tt>
157
- </strong>
158
- </concept>
159
- <concept ital='true' ref='true' linkmention='true' linkref='true'>
160
- <strong>
161
- term
162
- <tt>blah</tt>
163
- , display
164
- <tt>term</tt>
165
- not resolved via ID
166
- <tt>blah</tt>
167
- </strong>
168
- </concept>
169
- </p>
170
- <related type='contrast'>
171
- <strong>
172
- term
173
- <tt>blah</tt>
174
- not resolved via ID
175
- <tt>blah</tt>
176
- </strong>
177
- </related>
178
- </foreword>
179
- </preface>
180
- <sections>
181
- <clause id='clause1' inline-header='false' obligation='normative'>
182
- <title>Clause</title>
183
- <p id='_'>Terms are defined here</p>
184
- </clause>
185
- </sections>
186
- </standard-document>
187
- OUTPUT
188
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
189
- .to be_equivalent_to xmlpp(output)
190
- end
191
-
192
- it "processes the Metanorma::Standoc concept macros for acronyms" do
193
- input = <<~INPUT
194
- #{ASCIIDOC_BLANK_HDR}
195
-
196
- {{Clause1}}
197
- {{Clause1,Clause 1}}
198
- {{Clause 2}}
199
- {{Clause 2,Clause 1}}
200
- {{<<Clause2>>,Clause 2}}
201
-
202
- symbol:[Clause1]
203
- symbol:[Clause1,word]
204
- symbol:[Clause 2]
205
- symbol:[Clause 2,word]
206
-
207
- {{<<Clause2>>,word}}
208
- {{<<Clause2>>,word,term}}
209
- {{<<Clause2>>,word,term,xref}}
210
- {{<<Clause2>>,word,term,xref,options="noital,noref,nolinkmention,nolinkref"}}
211
- {{<<Clause2>>,word,term,xref,options="ital,ref,linkmention,linkref"}}
212
-
213
- == Terms and definitions
214
- === Clause1
215
- == Symbols and Abbreviated Terms
216
- Clause1:: A
217
- [[Clause2]]Clause 2:: C
218
- INPUT
219
- output = <<~OUTPUT
220
- #{BLANK_HDR}
221
- <preface>
222
- <foreword id='_' obligation='informative'>
223
- <title>Foreword</title>
224
- <p id='_'>
225
- <concept>
226
- <refterm>Clause1</refterm>
227
- <renderterm>Clause1</renderterm>
228
- <xref target='term-Clause1'/>
229
- </concept>
230
- <concept>
231
- <refterm>Clause1</refterm>
232
- <renderterm>Clause 1</renderterm>
233
- <xref target='term-Clause1'/>
234
- </concept>
235
- <concept>
236
- <refterm>Clause 2</refterm>
237
- <renderterm>Clause 2</renderterm>
238
- <xref target='Clause2'/>
239
- </concept>
240
- <concept>
241
- <refterm>Clause 2</refterm>
242
- <renderterm>Clause 1</renderterm>
243
- <xref target='Clause2'/>
244
- </concept>
245
- <concept>
246
- <refterm>Clause 2</refterm>
247
- <renderterm>Clause 2</renderterm>
248
- <xref target='Clause2'/>
249
- </concept>
250
- </p><p id="_">
251
- <concept>
252
- <refterm>Clause1</refterm>
253
- <renderterm>Clause1</renderterm>
254
- <xref target='symbol-Clause1'/>
255
- </concept>
256
- <concept>
257
- <refterm>Clause1</refterm>
258
- <renderterm>word</renderterm>
259
- <xref target='symbol-Clause1'/>
260
- </concept>
261
- <concept>
262
- <refterm>Clause 2</refterm>
263
- <renderterm>Clause 2</renderterm>
264
- <xref target='Clause2'/>
265
- </concept>
266
- <concept>
267
- <refterm>Clause 2</refterm>
268
- <renderterm>word</renderterm>
269
- <xref target='Clause2'/>
270
- </concept>
271
- </p><p id="_">
272
- <concept>
273
- <refterm>word</refterm>
274
- <renderterm>word</renderterm>
275
- <xref target='Clause2'/>
276
- </concept>
277
- <concept>
278
- <refterm>word</refterm>
279
- <renderterm>term</renderterm>
280
- <xref target='Clause2'/>
281
- </concept>
282
- <concept>
283
- <refterm>word</refterm>
284
- <renderterm>term</renderterm>
285
- <xref target='Clause2'>xref</xref>
286
- </concept>
287
- <concept ital='false' ref='false' linkmention='false' linkref='false'>
288
- <refterm>word</refterm>
289
- <renderterm>term</renderterm>
290
- <xref target='Clause2'>xref</xref>
291
- </concept>
292
- <concept ital='true' ref='true' linkmention='true' linkref='true'>
293
- <refterm>word</refterm>
294
- <renderterm>term</renderterm>
295
- <xref target='Clause2'>xref</xref>
296
- </concept>
297
- </p>
298
- </foreword>
299
- </preface>
300
- <sections>
301
- <terms id='_' obligation='normative'>
302
- <title>Terms and definitions</title>
303
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
304
- <term id='term-Clause1'>
305
- <preferred><expression><name>Clause1</name></expression></preferred>
306
- </term>
307
- </terms>
308
- <definitions id='_' obligation='normative'>
309
- <title>Symbols and abbreviated terms</title>
310
- <dl id='_'>
311
- <dt id="symbol-Clause1">Clause1</dt>
312
- <dd>
313
- <p id='_'>A</p>
314
- </dd>
315
- <dt id='Clause2'>Clause 2</dt>
316
- <dd>
317
- <p id='_'>C</p>
318
- </dd>
319
- </dl>
320
- </definitions>
321
- </sections>
322
- </standard-document>
323
- OUTPUT
324
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
325
- .to be_equivalent_to xmlpp(output)
326
- end
327
-
328
- it "processes the concept and related macros with xrefs" do
329
- input = <<~INPUT
330
- #{ASCIIDOC_BLANK_HDR}
331
- {{<<clause1>>}}
332
- {{<<clause1>>,w\[o\]rd}}
333
- {{<<clause1>>,term,w\[o\]rd}}
334
- {{<<clause1>>,term,w\[o\]rd,Clause #1}}
335
-
336
- related:supersedes[<<clause1>>,term]
337
-
338
- [[clause1]]
339
- == Clause
340
- Terms are defined here
341
- INPUT
342
- output = <<~OUTPUT
343
- #{BLANK_HDR}
344
- <preface>
345
- <foreword id='_' obligation='informative'>
346
- <title>Foreword</title>
347
- <p id='_'>
348
- <concept>
349
- <xref target='clause1'/>
350
- </concept>
351
- <concept>
352
- <refterm>w[o]rd</refterm>
353
- <renderterm>w[o]rd</renderterm>
354
- <xref target='clause1'/>
355
- </concept>
356
- <concept>
357
- <refterm>term</refterm>
358
- <renderterm>w[o]rd</renderterm>
359
- <xref target='clause1'/>
360
- </concept>
361
- <concept>
362
- <refterm>term</refterm>
363
- <renderterm>w[o]rd</renderterm>
364
- <xref target='clause1'>Clause #1</xref>
365
- </concept>
366
- </p>
367
- <related type='supersedes'>
368
- <preferred>
369
- <expression>
370
- <name>term</name>
371
- </expression>
372
- </preferred>
373
- <xref target='clause1'/>
374
- </related>
375
- </foreword>
376
- </preface>
377
- <sections>
378
- <clause id='clause1' inline-header='false' obligation='normative'>
379
- <title>Clause</title>
380
- <p id='_'>Terms are defined here</p>
381
- </clause>
382
- </sections>
383
- </standard-document>
384
- OUTPUT
385
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
386
- .to be_equivalent_to xmlpp(output)
387
- end
388
-
389
- it "processes the concept and related macros with erefs" do
390
- input = <<~INPUT
391
- #{ASCIIDOC_BLANK_HDR}
392
- {{<<blah>>}}
393
- {{<<blah>>,word}}
394
- {{<<blah>>,term,word}}
395
- {{<<blah>>,term,word,Clause #1}}
396
- {{<<blah,clause=3.1>>}}
397
- {{<<blah,clause=3.1>>,word}}
398
- {{<<blah,clause=3.1>>,term,word}}
399
- {{<<blah,clause=3.1,figure=a>>}}
400
- {{<<blah,clause=3.1,figure=a>>,word}}
401
- {{<<blah,clause=3.1,figure=a>>,term,word,Clause #1}}
402
-
403
- related:narrower[<<blah,clause=3.1,figure=a>>,term]
404
-
405
- [bibliography]
406
- == Bibliography
407
- * [[[blah,blah]]] _Blah_
408
- INPUT
409
- output = <<~OUTPUT
410
- #{BLANK_HDR}
411
- <preface>
412
- <foreword id='_' obligation='informative'>
413
- <title>Foreword</title>
414
- <p id='_'>
415
- <concept>
416
- <eref bibitemid='blah'/>
417
- </concept>
418
- <concept>
419
- <refterm>word</refterm>
420
- <renderterm>word</renderterm>
421
- <eref bibitemid='blah'/>
422
- </concept>
423
- <concept>
424
- <refterm>term</refterm>
425
- <renderterm>word</renderterm>
426
- <eref bibitemid='blah'/>
427
- </concept>
428
- <concept>
429
- <refterm>term</refterm>
430
- <renderterm>word</renderterm>
431
- <eref bibitemid='blah'>Clause #1</eref>
432
- </concept>
433
- <concept>
434
- <eref bibitemid='blah'>
435
- <localityStack>
436
- <locality type='clause'>
437
- <referenceFrom>3.1</referenceFrom>
438
- </locality>
439
- </localityStack>
440
- </eref>
441
- </concept>
442
- <concept>
443
- <refterm>word</refterm>
444
- <renderterm>word</renderterm>
445
- <eref bibitemid='blah'>
446
- <localityStack>
447
- <locality type='clause'>
448
- <referenceFrom>3.1</referenceFrom>
449
- </locality>
450
- </localityStack>
451
- </eref>
452
- </concept>
453
- <concept>
454
- <refterm>term</refterm>
455
- <renderterm>word</renderterm>
456
- <eref bibitemid='blah'>
457
- <localityStack>
458
- <locality type='clause'>
459
- <referenceFrom>3.1</referenceFrom>
460
- </locality>
461
- </localityStack>
462
- </eref>
463
- </concept>
464
- <concept>
465
- <eref bibitemid='blah'>
466
- <localityStack>
467
- <locality type='clause'>
468
- <referenceFrom>3.1</referenceFrom>
469
- </locality>
470
- <locality type='figure'>
471
- <referenceFrom>a</referenceFrom>
472
- </locality>
473
- </localityStack>
474
- </eref>
475
- </concept>
476
- <concept>
477
- <refterm>word</refterm>
478
- <renderterm>word</renderterm>
479
- <eref bibitemid='blah'>
480
- <localityStack>
481
- <locality type='clause'>
482
- <referenceFrom>3.1</referenceFrom>
483
- </locality>
484
- <locality type='figure'>
485
- <referenceFrom>a</referenceFrom>
486
- </locality>
487
- </localityStack>
488
- </eref>
489
- </concept>
490
- <concept>
491
- <refterm>term</refterm>
492
- <renderterm>word</renderterm>
493
- <eref bibitemid='blah'>
494
- <localityStack>
495
- <locality type='clause'>
496
- <referenceFrom>3.1</referenceFrom>
497
- </locality>
498
- <locality type='figure'>
499
- <referenceFrom>a</referenceFrom>
500
- </locality>
501
- </localityStack>
502
- Clause #1
503
- </eref>
504
- </concept>
505
- </p>
506
- <related type='narrower'>
507
- <preferred>
508
- <expression>
509
- <name>term</name>
510
- </expression>
511
- </preferred>
512
- <eref bibitemid='blah'>
513
- <localityStack>
514
- <locality type='clause'>
515
- <referenceFrom>3.1</referenceFrom>
516
- </locality>
517
- <locality type='figure'>
518
- <referenceFrom>a</referenceFrom>
519
- </locality>
520
- </localityStack>
521
- </eref>
522
- </related>
523
- </foreword>
524
- </preface>
525
- <sections> </sections>
526
- <bibliography>
527
- <references id='_' normative='false' obligation='informative'>
528
- <title>Bibliography</title>
529
- <bibitem id='blah'>
530
- <formattedref format='application/x-isodoc+xml'>
531
- <em>Blah</em>
532
- </formattedref>
533
- <docidentifier>blah</docidentifier>
534
- </bibitem>
535
- </references>
536
- </bibliography>
537
- </standard-document>
538
- OUTPUT
539
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
540
- .to be_equivalent_to xmlpp(output)
541
- end
542
-
543
- it "processes the concept and related macros with termbase" do
544
- input = <<~INPUT
545
- #{ASCIIDOC_BLANK_HDR}
546
- {{<<IEV:135-13-13>>}}
547
- {{<<IEV:135-13-13>>,word}}
548
- {{<<IEV:135-13-13>>,term,word}}
549
- {{<<IEV:135-13-13>>,term,word,Clause #1}}
550
-
551
- related:see[<<IEV:135-13-13>>,term]
552
- INPUT
553
- output = <<~OUTPUT
554
- #{BLANK_HDR}
555
- <sections>
556
- <p id='_'>
557
- <concept>
558
- <termref base='IEV' target='135-13-13'/>
559
- </concept>
560
- <concept>
561
- <refterm>word</refterm>
562
- <renderterm>word</renderterm>
563
- <termref base='IEV' target='135-13-13'/>
564
- </concept>
565
- <concept>
566
- <refterm>term</refterm>
567
- <renderterm>word</renderterm>
568
- <termref base='IEV' target='135-13-13'/>
569
- </concept>
570
- <concept>
571
- <refterm>term</refterm>
572
- <renderterm>word</renderterm>
573
- <termref base='IEV' target='135-13-13'>Clause #1</termref>
574
- </concept>
575
- </p>
576
- <related type='see'>
577
- <preferred>
578
- <expression>
579
- <name>term</name>
580
- </expression>
581
- </preferred>
582
- <termref base='IEV' target='135-13-13'/>
583
- </related>
584
- </sections>
585
- </standard-document>
586
- OUTPUT
587
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
588
- .to be_equivalent_to xmlpp(output)
589
- end
590
-
591
- it "processes the concept macros with disambiguation for math symbols" do
592
- input = <<~INPUT
593
- #{ASCIIDOC_BLANK_HDR}
594
- [[clause1]]
595
-
596
- == Symbols and Abbreviated Terms
597
- stem:[|~ x ~|]:: A function that returns the smallest integer greater than or equal to stem:[x]; also known as the _ceiling_ function.
598
- stem:[|__ x __|]:: A function that returns the largest integer less than or equal to stem:[x]; also known as the _floor_ function.
599
- INPUT
600
- output = <<~OUTPUT
601
- #{BLANK_HDR}
602
- <sections>
603
- <definitions id='clause1' obligation='normative'>
604
- <title>Symbols and abbreviated terms</title>
605
- <dl id='_'>
606
- <dt id='symbol-__x230a_-x-__x230b_'>
607
- <stem type='MathML'>
608
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
609
- <mo>&#8970;</mo>
610
- <mi>x</mi>
611
- <mo>&#8971;</mo>
612
- </math>
613
- </stem>
614
- </dt>
615
- <dd>
616
- <p id='_'>
617
- A function that returns the largest integer less than or equal to
618
- <stem type='MathML'>
619
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
620
- <mi>x</mi>
621
- </math>
622
- </stem>
623
- ; also known as the
624
- <em>floor</em>
625
- function.
626
- </p>
627
- </dd>
628
- <dt id='symbol-__x2308_-x-__x2309_'>
629
- <stem type='MathML'>
630
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
631
- <mo>&#8968;</mo>
632
- <mi>x</mi>
633
- <mo>&#8969;</mo>
634
- </math>
635
- </stem>
636
- </dt>
637
- <dd>
638
- <p id='_'>
639
- A function that returns the smallest integer greater than or equal
640
- to
641
- <stem type='MathML'>
642
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
643
- <mi>x</mi>
644
- </math>
645
- </stem>
646
- ; also known as the
647
- <em>ceiling</em>
648
- function.
649
- </p>
650
- </dd>
651
- </dl>
652
- </definitions>
653
- </sections>
654
- </standard-document>
655
- OUTPUT
656
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
657
- .to be_equivalent_to xmlpp(output)
658
- end
659
-
660
- describe "term inline macros" do
661
- subject(:convert) do
662
- xmlpp(
663
- strip_guid(
664
- Asciidoctor.convert(
665
- input, *OPTIONS
666
- ),
667
- ),
668
- )
669
- end
670
- let(:input) do
671
- <<~XML
672
- #{ASCIIDOC_BLANK_HDR}
673
- == Terms and Definitions
674
-
675
- === name
676
-
677
- == Main
678
-
679
- term:[name,name2] is a term
680
-
681
- {{name,name2}} is a term
682
-
683
- related:equivalent[name]
684
- XML
685
- end
686
- let(:output) do
687
- <<~XML
688
- #{BLANK_HDR}
689
- <sections>
690
- <terms id='_' obligation='normative'>
691
- <title>Terms and definitions</title>
692
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
693
- <term id='term-name'>
694
- <preferred><expression><name>name</name></expression></preferred>
695
- </term>
696
- </terms>
697
- <clause id='_' inline-header='false' obligation='normative'>
698
- <title>Main</title>
699
- <p id='_'>
700
- <concept>
701
- <refterm>name</refterm>
702
- <renderterm>name2</renderterm>
703
- <xref target='term-name'/>
704
- </concept>
705
- is a term
706
- </p>
707
- <p id='_'>
708
- <concept>
709
- <refterm>name</refterm>
710
- <renderterm>name2</renderterm>
711
- <xref target='term-name'/>
712
- </concept>
713
- is a term
714
- </p>
715
- <related type='equivalent'>
716
- <preferred>
717
- <expression>
718
- <name>name</name>
719
- </expression>
720
- </preferred>
721
- <xref target='term-name'>name</xref>
722
- </related>
723
- </clause>
724
- </sections>
725
- </standard-document>
726
- XML
727
- end
728
-
729
- it "converts macro into the correct xml" do
730
- expect(convert).to(be_equivalent_to(xmlpp(output)))
731
- end
732
-
733
- context "default params" do
734
- let(:input) do
735
- <<~XML
736
- #{ASCIIDOC_BLANK_HDR}
737
-
738
- == Terms and Definitions
739
-
740
- === name
741
-
742
- == Main
743
-
744
- term:[name] is a term
745
-
746
- {{name}} is a term
747
- XML
748
- end
749
- let(:output) do
750
- <<~XML
751
- #{BLANK_HDR}
752
- <sections>
753
- <terms id='_' obligation='normative'>
754
- <title>Terms and definitions</title>
755
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
756
- <term id='term-name'>
757
- <preferred><expression><name>name</name></expression></preferred>
758
- </term>
759
- </terms>
760
- <clause id='_' inline-header='false' obligation='normative'>
761
- <title>Main</title>
762
- <p id='_'>
763
- <concept>
764
- <refterm>name</refterm>
765
- <renderterm>name</renderterm>
766
- <xref target='term-name'/>
767
- </concept>
768
- is a term
769
- </p>
770
- <p id='_'>
771
- <concept>
772
- <refterm>name</refterm>
773
- <renderterm>name</renderterm>
774
- <xref target='term-name'/>
775
- </concept>
776
- is a term
777
- </p>
778
- </clause>
779
- </sections>
780
- </standard-document>
781
- XML
782
- end
783
-
784
- it "uses `name` as termref name" do
785
- expect(convert).to(be_equivalent_to(xmlpp(output)))
786
- end
787
- end
788
-
789
- context "terms with index terms" do
790
- let(:input) do
791
- <<~XML
792
- #{ASCIIDOC_BLANK_HDR}
793
-
794
- == Terms and Definitions
795
-
796
- === name(((name)))
797
-
798
- == Main
799
-
800
- term:[name] is a term
801
-
802
- {{name}} is a term
803
- XML
804
- end
805
- let(:output) do
806
- <<~XML
807
- #{BLANK_HDR}
808
- <sections>
809
- <terms id='_' obligation='normative'>
810
- <title>Terms and definitions</title>
811
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
812
- <term id='term-name'>
813
- <preferred><expression><name>name
814
- <index>
815
- <primary>name</primary>
816
- </index>
817
- </name>
818
- </expression></preferred>
819
- </term>
820
- </terms>
821
- <clause id='_' inline-header='false' obligation='normative'>
822
- <title>Main</title>
823
- <p id='_'>
824
- <concept>
825
- <refterm>name</refterm>
826
- <renderterm>name</renderterm>
827
- <xref target='term-name'/>
828
- </concept>
829
- is a term
830
- </p>
831
- <p id='_'>
832
- <concept>
833
- <refterm>name</refterm>
834
- <renderterm>name</renderterm>
835
- <xref target='term-name'/>
836
- </concept>
837
- is a term
838
- </p>
839
- </clause>
840
- </sections>
841
- </standard-document>
842
- XML
843
- end
844
-
845
- it "strips index terms in terms anchors" do
846
- expect(convert).to(be_equivalent_to(xmlpp(output)))
847
- end
848
- end
849
-
850
- context "multiply existing ids in document" do
851
- let(:input) do
852
- <<~XML
853
- #{ASCIIDOC_BLANK_HDR}
854
-
855
- == Terms and Definitions
856
-
857
- === name
858
- === name2
859
-
860
- [[term-name]]
861
- == Main
862
-
863
- paragraph
864
-
865
- [[term-name2]]
866
- == Second
867
-
868
- term:[name] is a term
869
- term:[name2] is a term
870
- {{name}} is a term
871
- {{name2}} is a term
872
- XML
873
- end
874
- let(:output) do
875
- <<~XML
876
- #{BLANK_HDR}
877
- <sections>
878
- <terms id='_' obligation='normative'>
879
- <title>Terms and definitions</title>
880
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
881
- <term id='term-name-1'>
882
- <preferred><expression><name>name</name></expression></preferred>
883
- </term>
884
- <term id='term-name2-1'>
885
- <preferred><expression><name>name2</name></expression></preferred>
886
- </term>
887
- </terms>
888
- <clause id='term-name' inline-header='false' obligation='normative'>
889
- <title>Main</title>
890
- <p id='_'>paragraph</p>
891
- </clause>
892
- <clause id='term-name2' inline-header='false' obligation='normative'>
893
- <title>Second</title>
894
- <p id='_'>
895
- <concept>
896
- <refterm>name</refterm>
897
- <renderterm>name</renderterm>
898
- <xref target='term-name-1'/>
899
- </concept>
900
- is a term
901
- <concept>
902
- <refterm>name2</refterm>
903
- <renderterm>name2</renderterm>
904
- <xref target='term-name2-1'/>
905
- </concept>
906
- is a term
907
- <concept>
908
- <refterm>name</refterm>
909
- <renderterm>name</renderterm>
910
- <xref target='term-name-1'/>
911
- </concept>
912
- is a term
913
- <concept>
914
- <refterm>name2</refterm>
915
- <renderterm>name2</renderterm>
916
- <xref target='term-name2-1'/>
917
- </concept>
918
- is a term
919
- </p>
920
- </clause>
921
- </sections>
922
- </standard-document>
923
- XML
924
- end
925
-
926
- it "generates unique ids which do not match existing ids" do
927
- expect(convert).to(be_equivalent_to(xmlpp(output)))
928
- end
929
- end
930
-
931
- context "when missing actual ref" do
932
- let(:input) do
933
- <<~XML
934
- #{ASCIIDOC_BLANK_HDR}
935
-
936
- == Terms and Definitions
937
-
938
- === name identity
939
-
940
- [[name-check]]
941
- === name check
942
-
943
- paragraph
944
-
945
- term:[name check] is a term
946
-
947
- term:[name identity] is a term
948
-
949
- Moreover, term:[missing] is a term
950
-
951
-
952
- {{name check}} is a term
953
-
954
- {{name identity}} is a term
955
-
956
- Moreover, {{missing}} is a term
957
-
958
- related:equivalent[missing]
959
- XML
960
- end
961
- let(:output) do
962
- <<~XML
963
- #{BLANK_HDR}
964
- <sections>
965
- <terms id='_' obligation='normative'>
966
- <title>Terms and definitions</title>
967
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
968
- <term id='term-name-identity'>
969
- <preferred><expression><name>name identity</name></expression></preferred>
970
- </term>
971
- <term id='name-check'>
972
- <preferred><expression><name>name check</name></expression></preferred>
973
- <related type='equivalent'>
974
- <strong>
975
- term
976
- <tt>missing</tt>
977
- not resolved via ID
978
- <tt>missing</tt>
979
- </strong>
980
- </related>
981
- <definition><verbal-definition>
982
- <p id='_'>paragraph</p>
983
- <p id='_'>
984
- <concept>
985
- <refterm>name check</refterm>
986
- <renderterm>name check</renderterm>
987
- <xref target='name-check'/>
988
- </concept>
989
- is a term
990
- </p>
991
- <p id='_'>
992
- <concept>
993
- <refterm>name identity</refterm>
994
- <renderterm>name identity</renderterm>
995
- <xref target='term-name-identity'/>
996
- </concept>
997
- is a term
998
- </p>
999
- <p id='_'>
1000
- Moreover,
1001
- <concept>
1002
- <strong>
1003
- term
1004
- <tt>missing</tt>
1005
- not resolved via ID
1006
- <tt>missing</tt>
1007
- </strong>
1008
- </concept>
1009
- is a term
1010
- </p>
1011
- <p id='_'>
1012
- <concept>
1013
- <refterm>name check</refterm>
1014
- <renderterm>name check</renderterm>
1015
- <xref target='name-check'/>
1016
- </concept>
1017
- is a term
1018
- </p>
1019
- <p id='_'>
1020
- <concept>
1021
- <refterm>name identity</refterm>
1022
- <renderterm>name identity</renderterm>
1023
- <xref target='term-name-identity'/>
1024
- </concept>
1025
- is a term
1026
- </p>
1027
- <p id='_'>
1028
- Moreover,
1029
- <concept>
1030
- <strong>
1031
- term
1032
- <tt>missing</tt>
1033
- not resolved via ID
1034
- <tt>missing</tt>
1035
- </strong>
1036
- </concept>
1037
- is a term
1038
- </p>
1039
- </verbal-definition></definition>
1040
- </term>
1041
- </terms>
1042
- </sections>
1043
- </standard-document>
1044
- XML
1045
- end
1046
-
1047
- it "generates unique ids which do not match existing ids" do
1048
- expect(convert).to(be_equivalent_to(xmlpp(output)))
1049
- end
1050
- end
1051
- end
1052
- end