metanorma-standoc 2.2.6 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +3 -5
  3. data/lib/metanorma/standoc/biblio.rng +5 -0
  4. data/lib/metanorma/standoc/cleanup.rb +17 -17
  5. data/lib/metanorma/standoc/cleanup_amend.rb +2 -2
  6. data/lib/metanorma/standoc/cleanup_biblio.rb +2 -1
  7. data/lib/metanorma/standoc/cleanup_maths.rb +12 -4
  8. data/lib/metanorma/standoc/cleanup_section.rb +19 -9
  9. data/lib/metanorma/standoc/cleanup_symbols.rb +14 -7
  10. data/lib/metanorma/standoc/cleanup_text.rb +10 -4
  11. data/lib/metanorma/standoc/cleanup_toc.rb +1 -2
  12. data/lib/metanorma/standoc/cleanup_xref.rb +55 -14
  13. data/lib/metanorma/standoc/inline.rb +27 -12
  14. data/lib/metanorma/standoc/isodoc.rng +46 -12
  15. data/lib/metanorma/standoc/ref_utility.rb +1 -0
  16. data/lib/metanorma/standoc/render.rb +10 -1
  17. data/lib/metanorma/standoc/section.rb +10 -3
  18. data/lib/metanorma/standoc/utils.rb +6 -1
  19. data/lib/metanorma/standoc/validate.rb +1 -1
  20. data/lib/metanorma/standoc/version.rb +1 -1
  21. data/metanorma-standoc.gemspec +5 -2
  22. metadata +4 -128
  23. data/.github/workflows/automerge.yml +0 -31
  24. data/.github/workflows/rake.yml +0 -15
  25. data/.github/workflows/release.yml +0 -24
  26. data/Rakefile +0 -8
  27. data/bin/rspec +0 -18
  28. data/spec/assets/a1.adoc +0 -8
  29. data/spec/assets/a2.adoc +0 -10
  30. data/spec/assets/a3.adoc +0 -9
  31. data/spec/assets/a3a.adoc +0 -7
  32. data/spec/assets/a4.adoc +0 -4
  33. data/spec/assets/boilerplate.xml +0 -4
  34. data/spec/assets/codes.yml +0 -695
  35. data/spec/assets/correct.png +0 -0
  36. data/spec/assets/corrupt.png +0 -0
  37. data/spec/assets/header.html +0 -7
  38. data/spec/assets/html-override.css +0 -1
  39. data/spec/assets/html.scss +0 -13
  40. data/spec/assets/htmlcover.html +0 -4
  41. data/spec/assets/htmlintro.html +0 -5
  42. data/spec/assets/i18n.yaml +0 -17
  43. data/spec/assets/iso.adoc +0 -10
  44. data/spec/assets/iso.headless.html +0 -33
  45. data/spec/assets/iso.xml +0 -8
  46. data/spec/assets/iso123.rxl +0 -107
  47. data/spec/assets/rice_image1.png +0 -0
  48. data/spec/assets/scripts.html +0 -3
  49. data/spec/assets/std.css +0 -2
  50. data/spec/assets/word-override.css +0 -1
  51. data/spec/assets/word.scss +0 -13
  52. data/spec/assets/wordcover.html +0 -3
  53. data/spec/assets/wordintro.html +0 -4
  54. data/spec/assets/xref_error.adoc +0 -8
  55. data/spec/examples/103_01_02.html +0 -247
  56. data/spec/examples/codes_table.html +0 -3174
  57. data/spec/examples/datamodel/address_class_profile.adoc +0 -5
  58. data/spec/examples/datamodel/address_class_profile.presentation.xml +0 -14
  59. data/spec/examples/datamodel/address_component_profile.adoc +0 -5
  60. data/spec/examples/datamodel/blank_definition_profile.adoc +0 -5
  61. data/spec/examples/datamodel/common_models_diagram.adoc +0 -5
  62. data/spec/examples/datamodel/models/models/AddressClassProfile.yml +0 -90
  63. data/spec/examples/datamodel/models/models/AddressComponentProfile.yml +0 -63
  64. data/spec/examples/datamodel/models/models/AddressComponentSpecification.yml +0 -15
  65. data/spec/examples/datamodel/models/models/AddressProfile.yml +0 -36
  66. data/spec/examples/datamodel/models/models/AttributeProfile.yml +0 -32
  67. data/spec/examples/datamodel/models/models/InterchangeAddressClassProfile.yml +0 -79
  68. data/spec/examples/datamodel/models/models/Localization copy.yml +0 -23
  69. data/spec/examples/datamodel/models/models/Localization.yml +0 -23
  70. data/spec/examples/datamodel/models/models/ProfileCompliantAddress.yml +0 -36
  71. data/spec/examples/datamodel/models/models/ProfileCompliantAddressComponent.yml +0 -15
  72. data/spec/examples/datamodel/models/models/Signature.yml +0 -20
  73. data/spec/examples/datamodel/models/models/SignatureBlankDefinition.yml +0 -20
  74. data/spec/examples/datamodel/models/models/TextDirectionCode copy.yml +0 -16
  75. data/spec/examples/datamodel/models/models/TextDirectionCode.yml +0 -16
  76. data/spec/examples/datamodel/models/models/Validity.yml +0 -14
  77. data/spec/examples/datamodel/models/models/iso19160-1/Address.yml +0 -22
  78. data/spec/examples/datamodel/models/models/iso19160-1/AddressComponent.yml +0 -2
  79. data/spec/examples/datamodel/models/style.uml.inc +0 -37
  80. data/spec/examples/datamodel/models/views/CommonModels.yml +0 -9
  81. data/spec/examples/datamodel/models/views/TopDown.yml +0 -62
  82. data/spec/examples/datamodel/top_down_diagram.adoc +0 -5
  83. data/spec/examples/english.yaml +0 -69
  84. data/spec/examples/iso_123_.xml +0 -46
  85. data/spec/examples/iso_123_all_parts.xml +0 -46
  86. data/spec/examples/iso_123_no_year_note.xml +0 -47
  87. data/spec/examples/iso_124_.xml +0 -42
  88. data/spec/examples/iso_216_.xml +0 -48
  89. data/spec/examples/iso_iec_12382_.xml +0 -49
  90. data/spec/examples/rice.adoc +0 -715
  91. data/spec/examples/rice.preview.html +0 -1877
  92. data/spec/examples/rice.sh +0 -4
  93. data/spec/examples/rice_images/rice_image1.png +0 -0
  94. data/spec/examples/rice_images/rice_image2.png +0 -0
  95. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  96. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  97. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  98. data/spec/fixtures/action_schemaexpg1.svg +0 -122
  99. data/spec/fixtures/datamodel_description_sections_tree.xml +0 -327
  100. data/spec/fixtures/diagram_definitions.lutaml +0 -22
  101. data/spec/fixtures/macros_datamodel/address_class_profile.xml +0 -149
  102. data/spec/fixtures/macros_datamodel/address_component_profile.xml +0 -71
  103. data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +0 -51
  104. data/spec/fixtures/macros_datamodel/common_models_diagram.xml +0 -7
  105. data/spec/fixtures/macros_datamodel/top_down_diagram.xml +0 -7
  106. data/spec/fixtures/test.exp +0 -121
  107. data/spec/fixtures/test.xmi +0 -9250
  108. data/spec/metanorma/base_spec.rb +0 -1125
  109. data/spec/metanorma/biblio_spec.rb +0 -1012
  110. data/spec/metanorma/blank_spec.rb +0 -37
  111. data/spec/metanorma/blocks_spec.rb +0 -1784
  112. data/spec/metanorma/cleanup_blocks_spec.rb +0 -1099
  113. data/spec/metanorma/cleanup_sections_spec.rb +0 -1849
  114. data/spec/metanorma/cleanup_spec.rb +0 -1931
  115. data/spec/metanorma/cleanup_terms_spec.rb +0 -1543
  116. data/spec/metanorma/datamodel/attributes_table_preprocessor_spec.rb +0 -111
  117. data/spec/metanorma/datamodel/diagram_preprocessor_spec.rb +0 -72
  118. data/spec/metanorma/inline_spec.rb +0 -785
  119. data/spec/metanorma/isobib_cache_spec.rb +0 -742
  120. data/spec/metanorma/lists_spec.rb +0 -232
  121. data/spec/metanorma/macros_concept_spec.rb +0 -1052
  122. data/spec/metanorma/macros_json2text_spec.rb +0 -10
  123. data/spec/metanorma/macros_plantuml_spec.rb +0 -402
  124. data/spec/metanorma/macros_spec.rb +0 -1183
  125. data/spec/metanorma/macros_yaml2text_spec.rb +0 -10
  126. data/spec/metanorma/processor_spec.rb +0 -96
  127. data/spec/metanorma/refs_spec.rb +0 -2807
  128. data/spec/metanorma/reqt_spec.rb +0 -130
  129. data/spec/metanorma/section_spec.rb +0 -1325
  130. data/spec/metanorma/table_spec.rb +0 -474
  131. data/spec/metanorma/validate_spec.rb +0 -886
  132. data/spec/spec_helper.rb +0 -290
  133. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +0 -781
  134. data/spec/vcr_cassettes/bsi16341.yml +0 -486
  135. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +0 -611
  136. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +0 -149
  137. data/spec/vcr_cassettes/hide_refs.yml +0 -587
  138. data/spec/vcr_cassettes/isobib_get_123.yml +0 -149
  139. data/spec/vcr_cassettes/isobib_get_123_1.yml +0 -295
  140. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +0 -385
  141. data/spec/vcr_cassettes/isobib_get_123_2.yml +0 -295
  142. data/spec/vcr_cassettes/isobib_get_123_2001.yml +0 -149
  143. data/spec/vcr_cassettes/isobib_get_124.yml +0 -149
  144. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +0 -367
  145. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +0 -560
  146. data/spec/vcr_cassettes/std-link.yml +0 -149
@@ -1,781 +0,0 @@
1
- RSpec.shared_examples "structured data 2 text preprocessor" do
2
- describe "#process" do
3
- let(:example_file) { "example.#{extention}" }
4
-
5
- before do
6
- File.open(example_file, "w") do |n|
7
- n.puts(transform_to_type(example_content))
8
- end
9
- end
10
-
11
- after do
12
- FileUtils.rm_rf(example_file)
13
- end
14
-
15
- context "Array of hashes" do
16
- let(:example_content) do
17
- [{ "name" => "spaghetti",
18
- "desc" => "wheat noodles of 9mm diameter",
19
- "symbol" => "SPAG",
20
- "symbol_def" =>
21
- "the situation is message like spaghetti at a kid's meal" }]
22
- end
23
- let(:input) do
24
- <<~TEXT
25
- = Document title
26
- Author
27
- :docfile: test.adoc
28
- :nodoc:
29
- :novalid:
30
- :no-isobib:
31
- :imagesdir: spec/assets
32
-
33
- [#{extention}2text,#{example_file},my_context]
34
- ----
35
- {my_context.*,item,EOF}
36
- {item.name}:: {item.desc}
37
- {EOF}
38
- ----
39
- TEXT
40
- end
41
- let(:output) do
42
- <<~TEXT
43
- #{BLANK_HDR}
44
- <sections>
45
- <dl id='_'>
46
- <dt>spaghetti</dt>
47
- <dd>
48
- <p id='_'>wheat noodles of 9mm diameter</p>
49
- </dd>
50
- </dl>
51
- </sections>
52
- </standard-document>
53
- TEXT
54
- end
55
-
56
- it "correctly renders input" do
57
- expect(
58
- xmlpp(
59
- strip_guid(
60
- Asciidoctor.convert(input,
61
- backend: :standoc,
62
- header_footer: true),
63
- ),
64
- ),
65
- ).to(be_equivalent_to(xmlpp(output)))
66
- end
67
- end
68
-
69
- context "An array of strings" do
70
- let(:example_content) do
71
- ["lorem", "ipsum", "dolor"]
72
- end
73
- let(:input) do
74
- <<~TEXT
75
- = Document title
76
- Author
77
- :docfile: test.adoc
78
- :nodoc:
79
- :novalid:
80
- :no-isobib:
81
- :imagesdir: spec/assets
82
-
83
- [#{extention}2text,#{example_file},ar]
84
- ----
85
- {ar.*,s,EOS}
86
- === {s.#} {s}
87
-
88
- This section is about {s}.
89
-
90
- {EOS}
91
- ----
92
- TEXT
93
- end
94
- let(:output) do
95
- <<~TEXT
96
- #{BLANK_HDR}
97
- <sections>
98
- <clause id="_" inline-header="false" obligation="normative">
99
- <title>0 lorem</title>
100
- <p id='_'>This section is about lorem.</p>
101
- </clause>
102
- <clause id='_' inline-header='false' obligation='normative'>
103
- <title>1 ipsum</title>
104
- <p id='_'>This section is about ipsum.</p>
105
- </clause>
106
- <clause id='_' inline-header='false' obligation='normative'>
107
- <title>2 dolor</title>
108
- <p id='_'>This section is about dolor.</p>
109
- </clause>
110
- </sections>
111
- </standard-document>
112
- TEXT
113
- end
114
-
115
- it "correctly renders input" do
116
- expect(
117
- xmlpp(
118
- strip_guid(
119
- Asciidoctor.convert(input,
120
- backend: :standoc,
121
- header_footer: true),
122
- ),
123
- ),
124
- ).to(be_equivalent_to(xmlpp(output)))
125
- end
126
- end
127
-
128
- context "A simple hash" do
129
- let(:example_content) do
130
- { "name" => "Lorem ipsum", "desc" => "dolor sit amet" }
131
- end
132
- let(:input) do
133
- <<~TEXT
134
- = Document title
135
- Author
136
- :docfile: test.adoc
137
- :nodoc:
138
- :novalid:
139
- :no-isobib:
140
- :imagesdir: spec/assets
141
-
142
- [#{extention}2text,#{example_file},my_item]
143
- ----
144
- === {my_item.name}
145
-
146
- {my_item.desc}
147
- ----
148
- TEXT
149
- end
150
- let(:output) do
151
- <<~TEXT
152
- #{BLANK_HDR}
153
- <sections>
154
- <clause id="_" inline-header="false" obligation="normative">
155
- <title>Lorem ipsum</title>
156
- <p id='_'>dolor sit amet</p>
157
- </clause>
158
- </sections>
159
- </standard-document>
160
- TEXT
161
- end
162
-
163
- it "correctly renders input" do
164
- expect(
165
- xmlpp(
166
- strip_guid(
167
- Asciidoctor.convert(input,
168
- backend: :standoc,
169
- header_footer: true),
170
- ),
171
- ),
172
- ).to(be_equivalent_to(xmlpp(output)))
173
- end
174
- end
175
-
176
- context "A simple hash with free keys" do
177
- let(:example_content) do
178
- { "name" => "Lorem ipsum", "desc" => "dolor sit amet" }
179
- end
180
- let(:input) do
181
- <<~TEXT
182
- = Document title
183
- Author
184
- :docfile: test.adoc
185
- :nodoc:
186
- :novalid:
187
- :no-isobib:
188
- :imagesdir: spec/assets
189
-
190
- [#{extention}2text,#{example_file},my_item]
191
- ----
192
- {my_item.*,key,EOI}
193
- === {key}
194
-
195
- {my_item[key]}
196
-
197
- {EOI}
198
- ----
199
- TEXT
200
- end
201
- let(:output) do
202
- <<~TEXT
203
- #{BLANK_HDR}
204
- <sections>
205
- <clause id="_" inline-header="false" obligation="normative">
206
- <title>name</title>
207
- <p id='_'>Lorem ipsum</p>
208
- </clause>
209
- <clause id='_' inline-header='false' obligation='normative'>
210
- <title>desc</title>
211
- <p id='_'>dolor sit amet</p>
212
- </clause>
213
- </sections>
214
- </standard-document>
215
- TEXT
216
- end
217
-
218
- it "correctly renders input" do
219
- expect(
220
- xmlpp(
221
- strip_guid(
222
- Asciidoctor.convert(input,
223
- backend: :standoc,
224
- header_footer: true),
225
- ),
226
- ),
227
- ).to(be_equivalent_to(xmlpp(output)))
228
- end
229
- end
230
-
231
- context "An array of hashes" do
232
- let(:example_content) do
233
- [{ "name" => "Lorem", "desc" => "ipsum", "nums" => [2] },
234
- { "name" => "dolor", "desc" => "sit", "nums" => [] },
235
- { "name" => "amet", "desc" => "lorem", "nums" => [2, 4, 6] }]
236
- end
237
- let(:input) do
238
- <<~TEXT
239
- = Document title
240
- Author
241
- :docfile: test.adoc
242
- :nodoc:
243
- :novalid:
244
- :no-isobib:
245
- :imagesdir: spec/assets
246
-
247
- [#{extention}2text,#{example_file},ar]
248
- ----
249
- {ar.*,item,EOF}
250
-
251
- {item.name}:: {item.desc}
252
-
253
- {item.nums.*,num,EON}
254
- - {item.name}: {num}
255
- {EON}
256
-
257
- {EOF}
258
- ----
259
- TEXT
260
- end
261
- let(:output) do
262
- <<~TEXT
263
- #{BLANK_HDR}
264
- <sections>
265
- <dl id='_'>
266
- <dt>Lorem</dt>
267
- <dd>
268
- <p id='_'>ipsum</p>
269
- <ul id='_'>
270
- <li>
271
- <p id='_'>Lorem: 2</p>
272
- </li>
273
- </ul>
274
- </dd>
275
- <dt>dolor</dt>
276
- <dd>
277
- <p id='_'>sit</p>
278
- </dd>
279
- <dt>amet</dt>
280
- <dd>
281
- <p id='_'>lorem</p>
282
- <ul id='_'>
283
- <li>
284
- <p id='_'>amet: 2</p>
285
- </li>
286
- <li>
287
- <p id='_'>amet: 4</p>
288
- </li>
289
- <li>
290
- <p id='_'>amet: 6</p>
291
- </li>
292
- </ul>
293
- </dd>
294
- </dl>
295
- </sections>
296
- </standard-document>
297
- TEXT
298
- end
299
-
300
- it "correctly renders input" do
301
- expect(
302
- xmlpp(
303
- strip_guid(
304
- Asciidoctor.convert(input,
305
- backend: :standoc,
306
- header_footer: true),
307
- ),
308
- ),
309
- ).to(be_equivalent_to(xmlpp(output)))
310
- end
311
- end
312
-
313
- context "An array with interpolated file names, etc. \
314
- for Asciidoc's consumption" do
315
- let(:example_content) do
316
- { "prefix" => "doc-", "items" => ["lorem", "ipsum", "dolor"] }
317
- end
318
- let(:input) do
319
- <<~TEXT
320
- = Document title
321
- Author
322
- :docfile: test.adoc
323
- :nodoc:
324
- :novalid:
325
- :no-isobib:
326
- :imagesdir: spec/assets
327
-
328
- [#{extention}2text,#{example_file},#{extention}]
329
- ------
330
- First item is {#{extention}.items[0]}.
331
- Last item is {#{extention}.items[-1]}.
332
-
333
- {#{extention}.items.*,s,EOS}
334
- === {s.#} -> {s.# + 1} {s} == {#{extention}.items[s.#]}
335
-
336
- [source,ruby]
337
- ----
338
- include::{#{extention}.prefix}{s.#}.rb[]
339
- ----
340
-
341
- {EOS}
342
- ------
343
- TEXT
344
- end
345
- let(:output) do
346
- <<~TEXT
347
- #{BLANK_HDR}
348
- <preface>
349
- <foreword id='_' obligation='informative'>
350
- <title>Foreword</title>
351
- <p id='_'>First item is lorem. Last item is dolor.</p>
352
- </foreword>
353
- </preface>
354
- <sections>
355
- <clause id='_' inline-header='false' obligation='normative'>
356
- <title>0 → 1 lorem == lorem</title>
357
- <sourcecode lang='ruby' id='_'>link:doc-0.rb[role=include]</sourcecode>
358
- </clause>
359
- <clause id='_' inline-header='false' obligation='normative'>
360
- <title>1 → 2 ipsum == ipsum</title>
361
- <sourcecode lang='ruby' id='_'>link:doc-1.rb[role=include]</sourcecode>
362
- </clause>
363
- <clause id='_' inline-header='false' obligation='normative'>
364
- <title>2 → 3 dolor == dolor</title>
365
- <sourcecode lang='ruby' id='_'>link:doc-2.rb[role=include]</sourcecode>
366
- </clause>
367
- </sections>
368
- </standard-document>
369
- TEXT
370
- end
371
-
372
- it "correctly renders input" do
373
- expect(
374
- xmlpp(
375
- strip_guid(
376
- Asciidoctor.convert(input,
377
- backend: :standoc,
378
- header_footer: true),
379
- ),
380
- ),
381
- ).to(be_equivalent_to(xmlpp(output)))
382
- end
383
- end
384
-
385
- context "Array of language codes" do
386
- let(:example_content) do
387
- YAML.safe_load(
388
- File.read(File.expand_path("../../assets/codes.yml", __dir__)),
389
- )
390
- end
391
- let(:input) do
392
- <<~TEXT
393
- = Document title
394
- Author
395
- :docfile: test.adoc
396
- :nodoc:
397
- :novalid:
398
- :no-isobib:
399
- :imagesdir: spec/assets
400
-
401
- [#{extention}2text,#{example_file},ar]
402
- ----
403
- {ar.*,item,EOF}
404
- .{item.values[1]}
405
- [%noheader,cols="h,1"]
406
- |===
407
- {item.*,key,EOK}
408
- | {key} | {item[key]}
409
-
410
- {EOK}
411
- |===
412
- {EOF}
413
- ----
414
- TEXT
415
- end
416
- let(:output) do
417
- <<~TEXT
418
- #{BLANK_HDR}
419
- <sections>
420
- #{File.read(File.expand_path('../../examples/codes_table.html', __dir__))}
421
- </sections>
422
- </standard-document>
423
- TEXT
424
- end
425
-
426
- it "correctly renders input" do
427
- expect(
428
- xmlpp(
429
- strip_guid(
430
- Asciidoctor.convert(input,
431
- backend: :standoc,
432
- header_footer: true),
433
- ),
434
- ),
435
- ).to(be_equivalent_to(xmlpp(output)))
436
- end
437
- end
438
-
439
- context "Nested hash dot notation" do
440
- let(:example_content) do
441
- { "data" =>
442
- { "acadsin-zho-hani-latn-2002" =>
443
- { "code" => "acadsin-zho-hani-latn-2002",
444
- "name" => {
445
- "en" => "Academica Sinica -- Chinese Tongyong Pinyin (2002)",
446
- },
447
- "authority" => "acadsin",
448
- "lang" => { "system" => "iso-639-2", "code" => "zho" },
449
- "source_script" => "Hani",
450
- "target_script" => "Latn",
451
- "system" =>
452
- { "id" => "2002",
453
- "specification" =>
454
- "Academica Sinica -- Chinese Tongyong Pinyin (2002)" },
455
- "notes" =>
456
- "NOTE: OGC 11-122r1 code `zho_Hani2Latn_AcadSin_2002`" } } }
457
- end
458
- let(:input) do
459
- <<~TEXT
460
- = Document title
461
- Author
462
- :docfile: test.adoc
463
- :nodoc:
464
- :novalid:
465
- :no-isobib:
466
- :imagesdir: spec/assets
467
-
468
- [#{extention}2text,#{example_file},authorities]
469
- ----
470
- [cols="a,a,a,a",options="header"]
471
- |===
472
- | Script conversion system authority code | Name in English | Notes | Name en
473
-
474
- {authorities.data.*,key,EOI}
475
- | {key} | {authorities.data[key]['code']} | {authorities.data[key]['notes']} | {authorities.data[key].name.en}
476
- {EOI}
477
-
478
- |===
479
- ----
480
- TEXT
481
- end
482
- let(:output) do
483
- <<~TEXT
484
- #{BLANK_HDR}
485
- <sections>
486
- <table id='_'>
487
- <thead>
488
- <tr>
489
- <th valign="top" align='left'>Script conversion system authority code</th>
490
- <th valign="top" align='left'>Name in English</th>
491
- <th valign="top" align='left'>Notes</th>
492
- <th valign="top" align='left'>Name en</th>
493
- </tr>
494
- </thead>
495
- <tbody>
496
- <tr>
497
- <td valign="top" align='left'>
498
- <p id='_'>acadsin-zho-hani-latn-2002</p>
499
- </td>
500
- <td valign="top" align='left'>
501
- <p id='_'>acadsin-zho-hani-latn-2002</p>
502
- </td>
503
- <td valign="top" align='left'>
504
- <note id='_'>
505
- <p id='_'>
506
- OGC 11-122r1 code
507
- <tt>zho_Hani2Latn_AcadSin_2002</tt>
508
- </p>
509
- </note>
510
- </td>
511
- <td valign="top" align='left'>
512
- <p id='_'>Academica Sinica — Chinese Tongyong Pinyin (2002)</p>
513
- </td>
514
- </tr>
515
- </tbody>
516
- </table>
517
- </sections>
518
- </standard-document>
519
- TEXT
520
- end
521
-
522
- it "correctly renders input" do
523
- expect(
524
- xmlpp(
525
- strip_guid(
526
- Asciidoctor.convert(input,
527
- backend: :standoc,
528
- header_footer: true),
529
- ),
530
- ),
531
- ).to(be_equivalent_to(xmlpp(output)))
532
- end
533
- end
534
-
535
- context "Liquid code snippets" do
536
- let(:example_content) do
537
- [{ "name" => "One", "show" => true },
538
- { "name" => "Two", "show" => true },
539
- { "name" => "Three", "show" => false }]
540
- end
541
- let(:input) do
542
- <<~TEXT
543
- = Document title
544
- Author
545
- :docfile: test.adoc
546
- :nodoc:
547
- :novalid:
548
- :no-isobib:
549
- :imagesdir: spec/assets
550
-
551
- [#{extention}2text,#{example_file},my_context]
552
- ----
553
- {% for item in my_context %}
554
- {% if item.show %}
555
- {{ item.name | upcase }}
556
- {{ item.name | size }}
557
- {% endif %}
558
- {% endfor %}
559
- ----
560
- TEXT
561
- end
562
- let(:output) do
563
- <<~TEXT
564
- #{BLANK_HDR}
565
- <sections>
566
- <p id='_'>ONE 3</p>
567
- <p id='_'>TWO 3</p>
568
- </sections>
569
- </standard-document>
570
- TEXT
571
- end
572
-
573
- it "renders liquid markup" do
574
- expect(
575
- xmlpp(
576
- strip_guid(
577
- Asciidoctor.convert(input,
578
- backend: :standoc,
579
- header_footer: true),
580
- ),
581
- ),
582
- ).to(be_equivalent_to(xmlpp(output)))
583
- end
584
- end
585
-
586
- context "Date time objects support" do
587
- let(:example_content) do
588
- {
589
- "date" => Date.parse("1889-09-28"),
590
- "time" => Time.gm(2020, 10, 15, 5, 34),
591
- }
592
- end
593
- let(:input) do
594
- <<~TEXT
595
- = Document title
596
- Author
597
- :docfile: test.adoc
598
- :nodoc:
599
- :novalid:
600
- :no-isobib:
601
- :imagesdir: spec/assets
602
-
603
- [#{extention}2text,#{example_file},my_context]
604
- ----
605
- {{my_context.time}}
606
-
607
- {{my_context.date}}
608
- ----
609
- TEXT
610
- end
611
- let(:output) do
612
- <<~TEXT
613
- #{BLANK_HDR}
614
- <sections>
615
- <p id='_'>1889-09-28</p>
616
- <p id='_'>2020-10-15 05:34:00 UTC</p>
617
- </sections>
618
- </standard-document>
619
- TEXT
620
- end
621
-
622
- it "renders liquid markup" do
623
- expect(
624
- xmlpp(
625
- strip_guid(
626
- Asciidoctor.convert(input,
627
- backend: :standoc,
628
- header_footer: true),
629
- ),
630
- ),
631
- ).to(be_equivalent_to(xmlpp(output)))
632
- end
633
- end
634
-
635
- context "Nested files support" do
636
- let(:example_content) do
637
- {
638
- "date" => Date.parse("1889-09-28"),
639
- "time" => Time.gm(2020, 10, 15, 5, 34),
640
- }
641
- end
642
- let(:parent_file) { "parent_file.#{extention}" }
643
- let(:parent_file_content) { [nested_file, nested_file_2] }
644
- let(:parent_file_2) { "parent_file_2.#{extention}" }
645
- let(:parent_file_2_content) { ["name", "description"] }
646
- let(:parent_file_3) { "parent_file_3.#{extention}" }
647
- let(:parent_file_3_content) { ["one", "two"] }
648
- let(:nested_file) { "nested_file.#{extention}" }
649
- let(:nested_file_content) do
650
- {
651
- "name" => "nested file-main",
652
- "description" => "nested description-main",
653
- "one" => "nested one-main",
654
- "two" => "nested two-main",
655
- }
656
- end
657
- let(:nested_file_2) { "nested_file_2.#{extention}" }
658
- let(:nested_file_2_content) do
659
- {
660
- "name" => "nested2 name-main",
661
- "description" => "nested2 description-main",
662
- "one" => "nested2 one-main",
663
- "two" => "nested2 two-main",
664
- }
665
- end
666
- let(:input) do
667
- <<~TEXT
668
- = Document title
669
- Author
670
- :docfile: test.adoc
671
- :nodoc:
672
- :novalid:
673
- :no-isobib:
674
- :imagesdir: spec/assets
675
-
676
- [#{extention}2text,#{parent_file},paths]
677
- ----
678
- {% for path in paths %}
679
-
680
- [#{extention}2text,#{parent_file_2},attribute_names]
681
- ---
682
- {% for name in attribute_names %}
683
-
684
- [#{extention}2text,{{ path }},data]
685
- --
686
-
687
- == {{ data[name] | split: "-" | last }}: {{ data[name] }}
688
-
689
- --
690
-
691
- {% endfor %}
692
- ---
693
-
694
- [#{extention}2text,#{parent_file_3},attribute_names]
695
- ---
696
- {% for name in attribute_names %}
697
-
698
- [#{extention}2text,{{ path }},data]
699
- --
700
-
701
- == {{ data[name] }}
702
-
703
- --
704
-
705
- {% endfor %}
706
- ---
707
-
708
- {% endfor %}
709
- ----
710
- TEXT
711
- end
712
- let(:output) do
713
- <<~TEXT
714
- #{BLANK_HDR}
715
- <sections>
716
- <clause id='_' inline-header='false' obligation='normative'>
717
- <title>main: nested file-main</title>
718
- </clause>
719
- <clause id='_' inline-header='false' obligation='normative'>
720
- <title>main: nested description-main</title>
721
- </clause>
722
- <clause id='_' inline-header='false' obligation='normative'>
723
- <title>nested one-main</title>
724
- </clause>
725
- <clause id='_' inline-header='false' obligation='normative'>
726
- <title>nested two-main</title>
727
- </clause>
728
- <clause id='_' inline-header='false' obligation='normative'>
729
- <title>main: nested2 name-main</title>
730
- </clause>
731
- <clause id='_' inline-header='false' obligation='normative'>
732
- <title>main: nested2 description-main</title>
733
- </clause>
734
- <clause id='_' inline-header='false' obligation='normative'>
735
- <title>nested2 one-main</title>
736
- </clause>
737
- <clause id='_' inline-header='false' obligation='normative'>
738
- <title>nested2 two-main</title>
739
- </clause>
740
- </sections>
741
- </standard-document>
742
- TEXT
743
- end
744
- let(:file_list) do
745
- {
746
- parent_file => parent_file_content,
747
- parent_file_2 => parent_file_2_content,
748
- parent_file_3 => parent_file_3_content,
749
- nested_file => nested_file_content,
750
- nested_file_2 => nested_file_2_content,
751
- }
752
- end
753
-
754
- before do
755
- file_list.each_pair do |file, content|
756
- File.open(file, "w") do |n|
757
- n.puts(transform_to_type(content))
758
- end
759
- end
760
- end
761
-
762
- after do
763
- file_list.keys.each do |file|
764
- FileUtils.rm_rf(file)
765
- end
766
- end
767
-
768
- it "renders liquid markup" do
769
- expect(
770
- xmlpp(
771
- strip_guid(
772
- Asciidoctor.convert(input,
773
- backend: :standoc,
774
- header_footer: true),
775
- ),
776
- ),
777
- ).to(be_equivalent_to(xmlpp(output)))
778
- end
779
- end
780
- end
781
- end