metanorma-standoc 2.2.5 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/html/htmlstyle.css +1 -1
  3. data/lib/metanorma/standoc/base.rb +4 -5
  4. data/lib/metanorma/standoc/basicdoc.rng +0 -27
  5. data/lib/metanorma/standoc/biblio-standoc.rng +164 -0
  6. data/lib/metanorma/standoc/biblio.rng +50 -18
  7. data/lib/metanorma/standoc/cleanup.rb +18 -17
  8. data/lib/metanorma/standoc/cleanup_amend.rb +2 -2
  9. data/lib/metanorma/standoc/cleanup_asciibib.rb +110 -0
  10. data/lib/metanorma/standoc/cleanup_biblio.rb +7 -112
  11. data/lib/metanorma/standoc/cleanup_block.rb +7 -6
  12. data/lib/metanorma/standoc/cleanup_boilerplate.rb +6 -6
  13. data/lib/metanorma/standoc/cleanup_inline.rb +2 -2
  14. data/lib/metanorma/standoc/cleanup_maths.rb +12 -4
  15. data/lib/metanorma/standoc/cleanup_section.rb +19 -9
  16. data/lib/metanorma/standoc/cleanup_symbols.rb +14 -7
  17. data/lib/metanorma/standoc/cleanup_text.rb +19 -6
  18. data/lib/metanorma/standoc/cleanup_toc.rb +1 -2
  19. data/lib/metanorma/standoc/cleanup_xref.rb +55 -14
  20. data/lib/metanorma/standoc/inline.rb +29 -12
  21. data/lib/metanorma/standoc/isodoc-compile.rng +7 -0
  22. data/lib/metanorma/standoc/isodoc.rng +69 -207
  23. data/lib/metanorma/standoc/ref_utility.rb +1 -0
  24. data/lib/metanorma/standoc/render.rb +10 -1
  25. data/lib/metanorma/standoc/section.rb +10 -3
  26. data/lib/metanorma/standoc/utils.rb +6 -1
  27. data/lib/metanorma/standoc/validate.rb +9 -9
  28. data/lib/metanorma/standoc/version.rb +1 -1
  29. data/metanorma-standoc.gemspec +5 -3
  30. metadata +7 -141
  31. data/.github/workflows/rake.yml +0 -15
  32. data/.github/workflows/release.yml +0 -24
  33. data/Rakefile +0 -8
  34. data/bin/rspec +0 -18
  35. data/spec/assets/a1.adoc +0 -8
  36. data/spec/assets/a2.adoc +0 -10
  37. data/spec/assets/a3.adoc +0 -9
  38. data/spec/assets/a3a.adoc +0 -7
  39. data/spec/assets/a4.adoc +0 -4
  40. data/spec/assets/boilerplate.xml +0 -4
  41. data/spec/assets/codes.yml +0 -695
  42. data/spec/assets/correct.png +0 -0
  43. data/spec/assets/corrupt.png +0 -0
  44. data/spec/assets/header.html +0 -7
  45. data/spec/assets/html-override.css +0 -1
  46. data/spec/assets/html.scss +0 -13
  47. data/spec/assets/htmlcover.html +0 -4
  48. data/spec/assets/htmlintro.html +0 -5
  49. data/spec/assets/i18n.yaml +0 -17
  50. data/spec/assets/iso.adoc +0 -10
  51. data/spec/assets/iso.headless.html +0 -33
  52. data/spec/assets/iso.xml +0 -8
  53. data/spec/assets/iso123.rxl +0 -107
  54. data/spec/assets/rice_image1.png +0 -0
  55. data/spec/assets/scripts.html +0 -3
  56. data/spec/assets/std.css +0 -2
  57. data/spec/assets/word-override.css +0 -1
  58. data/spec/assets/word.scss +0 -13
  59. data/spec/assets/wordcover.html +0 -3
  60. data/spec/assets/wordintro.html +0 -4
  61. data/spec/assets/xref_error.adoc +0 -8
  62. data/spec/examples/103_01_02.html +0 -247
  63. data/spec/examples/codes_table.html +0 -3174
  64. data/spec/examples/datamodel/address_class_profile.adoc +0 -5
  65. data/spec/examples/datamodel/address_class_profile.presentation.xml +0 -14
  66. data/spec/examples/datamodel/address_component_profile.adoc +0 -5
  67. data/spec/examples/datamodel/blank_definition_profile.adoc +0 -5
  68. data/spec/examples/datamodel/common_models_diagram.adoc +0 -5
  69. data/spec/examples/datamodel/models/models/AddressClassProfile.yml +0 -90
  70. data/spec/examples/datamodel/models/models/AddressComponentProfile.yml +0 -63
  71. data/spec/examples/datamodel/models/models/AddressComponentSpecification.yml +0 -15
  72. data/spec/examples/datamodel/models/models/AddressProfile.yml +0 -36
  73. data/spec/examples/datamodel/models/models/AttributeProfile.yml +0 -32
  74. data/spec/examples/datamodel/models/models/InterchangeAddressClassProfile.yml +0 -79
  75. data/spec/examples/datamodel/models/models/Localization copy.yml +0 -23
  76. data/spec/examples/datamodel/models/models/Localization.yml +0 -23
  77. data/spec/examples/datamodel/models/models/ProfileCompliantAddress.yml +0 -36
  78. data/spec/examples/datamodel/models/models/ProfileCompliantAddressComponent.yml +0 -15
  79. data/spec/examples/datamodel/models/models/Signature.yml +0 -20
  80. data/spec/examples/datamodel/models/models/SignatureBlankDefinition.yml +0 -20
  81. data/spec/examples/datamodel/models/models/TextDirectionCode copy.yml +0 -16
  82. data/spec/examples/datamodel/models/models/TextDirectionCode.yml +0 -16
  83. data/spec/examples/datamodel/models/models/Validity.yml +0 -14
  84. data/spec/examples/datamodel/models/models/iso19160-1/Address.yml +0 -22
  85. data/spec/examples/datamodel/models/models/iso19160-1/AddressComponent.yml +0 -2
  86. data/spec/examples/datamodel/models/style.uml.inc +0 -37
  87. data/spec/examples/datamodel/models/views/CommonModels.yml +0 -9
  88. data/spec/examples/datamodel/models/views/TopDown.yml +0 -62
  89. data/spec/examples/datamodel/top_down_diagram.adoc +0 -5
  90. data/spec/examples/english.yaml +0 -69
  91. data/spec/examples/iso_123_.xml +0 -46
  92. data/spec/examples/iso_123_all_parts.xml +0 -46
  93. data/spec/examples/iso_123_no_year_note.xml +0 -47
  94. data/spec/examples/iso_124_.xml +0 -42
  95. data/spec/examples/iso_216_.xml +0 -48
  96. data/spec/examples/iso_iec_12382_.xml +0 -49
  97. data/spec/examples/rice.adoc +0 -715
  98. data/spec/examples/rice.preview.html +0 -1877
  99. data/spec/examples/rice.sh +0 -4
  100. data/spec/examples/rice_images/rice_image1.png +0 -0
  101. data/spec/examples/rice_images/rice_image2.png +0 -0
  102. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  103. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  104. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  105. data/spec/fixtures/action_schemaexpg1.svg +0 -122
  106. data/spec/fixtures/datamodel_description_sections_tree.xml +0 -327
  107. data/spec/fixtures/diagram_definitions.lutaml +0 -22
  108. data/spec/fixtures/macros_datamodel/address_class_profile.xml +0 -149
  109. data/spec/fixtures/macros_datamodel/address_component_profile.xml +0 -71
  110. data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +0 -51
  111. data/spec/fixtures/macros_datamodel/common_models_diagram.xml +0 -7
  112. data/spec/fixtures/macros_datamodel/top_down_diagram.xml +0 -7
  113. data/spec/fixtures/test.exp +0 -121
  114. data/spec/fixtures/test.xmi +0 -9250
  115. data/spec/metanorma/base_spec.rb +0 -1125
  116. data/spec/metanorma/biblio_spec.rb +0 -1004
  117. data/spec/metanorma/blank_spec.rb +0 -37
  118. data/spec/metanorma/blocks_spec.rb +0 -1784
  119. data/spec/metanorma/cleanup_blocks_spec.rb +0 -1099
  120. data/spec/metanorma/cleanup_sections_spec.rb +0 -1850
  121. data/spec/metanorma/cleanup_spec.rb +0 -1920
  122. data/spec/metanorma/cleanup_terms_spec.rb +0 -1543
  123. data/spec/metanorma/datamodel/attributes_table_preprocessor_spec.rb +0 -111
  124. data/spec/metanorma/datamodel/diagram_preprocessor_spec.rb +0 -72
  125. data/spec/metanorma/inline_spec.rb +0 -724
  126. data/spec/metanorma/isobib_cache_spec.rb +0 -742
  127. data/spec/metanorma/lists_spec.rb +0 -232
  128. data/spec/metanorma/macros_concept_spec.rb +0 -1052
  129. data/spec/metanorma/macros_json2text_spec.rb +0 -10
  130. data/spec/metanorma/macros_plantuml_spec.rb +0 -402
  131. data/spec/metanorma/macros_spec.rb +0 -1183
  132. data/spec/metanorma/macros_yaml2text_spec.rb +0 -10
  133. data/spec/metanorma/processor_spec.rb +0 -96
  134. data/spec/metanorma/refs_spec.rb +0 -2807
  135. data/spec/metanorma/reqt_spec.rb +0 -130
  136. data/spec/metanorma/section_spec.rb +0 -1325
  137. data/spec/metanorma/table_spec.rb +0 -474
  138. data/spec/metanorma/validate_spec.rb +0 -886
  139. data/spec/spec_helper.rb +0 -290
  140. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +0 -781
  141. data/spec/vcr_cassettes/bsi16341.yml +0 -488
  142. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +0 -611
  143. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +0 -149
  144. data/spec/vcr_cassettes/hide_refs.yml +0 -587
  145. data/spec/vcr_cassettes/isobib_get_123.yml +0 -149
  146. data/spec/vcr_cassettes/isobib_get_123_1.yml +0 -295
  147. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +0 -385
  148. data/spec/vcr_cassettes/isobib_get_123_2.yml +0 -295
  149. data/spec/vcr_cassettes/isobib_get_123_2001.yml +0 -149
  150. data/spec/vcr_cassettes/isobib_get_124.yml +0 -149
  151. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +0 -351
  152. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +0 -560
  153. data/spec/vcr_cassettes/std-link.yml +0 -149
@@ -1,1125 +0,0 @@
1
- require "spec_helper"
2
- require "fileutils"
3
-
4
- RSpec.describe Metanorma::Standoc do
5
- it "has a version number" do
6
- expect(Metanorma::Standoc::VERSION).not_to be nil
7
- end
8
-
9
- it "applies Asciidoctor substitutions" do
10
- expect(Metanorma::Utils.asciidoc_sub("A -- B"))
11
- .to eq "A — B"
12
- expect(Metanorma::Utils.asciidoc_sub("*A* stem:[x]"))
13
- .to eq "<strong>A</strong> <stem type=\"AsciiMath\">x</stem>"
14
- end
15
-
16
- it "processes named entities" do
17
- FileUtils.rm_f "test.doc"
18
- input = <<~INPUT
19
- = Document title
20
- Author
21
- :docfile: test.adoc
22
- :novalid:
23
- :no-pdf:
24
-
25
- Text &times; text
26
- INPUT
27
- output = <<~OUTPUT
28
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
29
- <bibdata type='standard'>
30
- <title language='en' format='text/plain'>Document title</title>
31
- <language>en</language>
32
- <script>Latn</script>
33
- <status>
34
- <stage>published</stage>
35
- </status>
36
- <copyright>
37
- <from>#{Time.now.year}</from>
38
- </copyright>
39
- <ext>
40
- <doctype>standard</doctype>
41
- </ext>
42
- </bibdata>
43
- <sections>
44
- <p id='_'>Text × text</p>
45
- </sections>
46
- </standard-document>
47
- OUTPUT
48
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
49
- .to be_equivalent_to xmlpp(output)
50
- end
51
-
52
- it "assigns default scripts to major languages" do
53
- FileUtils.rm_f "test.doc"
54
- input = <<~INPUT
55
- = Document title
56
- Author
57
- :docfile: test.adoc
58
- :novalid:
59
- :no-pdf:
60
- :language: ar
61
- INPUT
62
- output = <<~OUTPUT
63
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
64
- <bibdata type='standard'>
65
- <title language='en' format='text/plain'>Document title</title>
66
- <language>ar</language>
67
- <script>Arab</script>
68
- <status>
69
- <stage>published</stage>
70
- </status>
71
- <copyright>
72
- <from>#{Time.now.year}</from>
73
- </copyright>
74
- <ext>
75
- <doctype>standard</doctype>
76
- </ext>
77
- </bibdata>
78
- <sections> </sections>
79
- </standard-document>
80
- OUTPUT
81
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
82
- .to be_equivalent_to xmlpp(output)
83
- end
84
-
85
- it "processes publisher abbreviations" do
86
- mock_org_abbrevs
87
- input = <<~INPUT
88
- = Document title
89
- Author
90
- :docfile: test.adoc
91
- :nodoc:
92
- :novalid:
93
- :publisher: International Electrotechnical Commission;IETF;ISO
94
- INPUT
95
- output = <<~OUTPUT
96
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
97
- <bibdata type='standard'>
98
- <title language='en' format='text/plain'>Document title</title>
99
- <contributor>
100
- <role type='author'/>
101
- <organization>
102
- <name>International Electrotechnical Commission</name>
103
- <abbreviation>IEC</abbreviation>
104
- </organization>
105
- </contributor>
106
- <contributor>
107
- <role type='author'/>
108
- <organization>
109
- <name>IETF</name>
110
- </organization>
111
- </contributor>
112
- <contributor>
113
- <role type='author'/>
114
- <organization>
115
- <name>International Standards Organization</name>
116
- <abbreviation>ISO</abbreviation>
117
- </organization>
118
- </contributor>
119
- <contributor>
120
- <role type='publisher'/>
121
- <organization>
122
- <name>International Electrotechnical Commission</name>
123
- <abbreviation>IEC</abbreviation>
124
- </organization>
125
- </contributor>
126
- <contributor>
127
- <role type='publisher'/>
128
- <organization>
129
- <name>IETF</name>
130
- </organization>
131
- </contributor>
132
- <contributor>
133
- <role type='publisher'/>
134
- <organization>
135
- <name>International Standards Organization</name>
136
- <abbreviation>ISO</abbreviation>
137
- </organization>
138
- </contributor>
139
- <language>en</language>
140
- <script>Latn</script>
141
- <status>
142
- <stage>published</stage>
143
- </status>
144
- <copyright>
145
- <from>#{Time.now.year}</from>
146
- <owner>
147
- <organization>
148
- <name>International Electrotechnical Commission</name>
149
- <abbreviation>IEC</abbreviation>
150
- </organization>
151
- </owner>
152
- </copyright>
153
- <copyright>
154
- <from>#{Time.now.year}</from>
155
- <owner>
156
- <organization>
157
- <name>IETF</name>
158
- </organization>
159
- </owner>
160
- </copyright>
161
- <copyright>
162
- <from>#{Time.now.year}</from>
163
- <owner>
164
- <organization>
165
- <name>International Standards Organization</name>
166
- <abbreviation>ISO</abbreviation>
167
- </organization>
168
- </owner>
169
- </copyright>
170
- <ext>
171
- <doctype>standard</doctype>
172
- </ext>
173
- </bibdata>
174
- <sections> </sections>
175
- </standard-document>
176
- OUTPUT
177
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
178
- .to be_equivalent_to xmlpp(output)
179
- end
180
-
181
- it "processes default metadata" do
182
- input = <<~INPUT
183
- = Document title
184
- Author
185
- :docfile: test.adoc
186
- :nodoc:
187
- :novalid:
188
- :docnumber: 1000
189
- :partnumber: 1
190
- :edition: 2
191
- :revdate: 2000-01-01
192
- :published-date: 1000-01-01
193
- :accessed-date: 1001-01-01
194
- :created-date: 1002-01-01
195
- :implemented-date: 1003-01-01
196
- :obsoleted-date: 1004-01-01
197
- :confirmed-date: 1005-01-01
198
- :updated-date: 1006-01-01
199
- :issued-date: 1007-01-01
200
- :circulated-date: 1008-01-01
201
- :unchanged-date: 1009-01-01
202
- :vote-started-date: 1011-01-01
203
- :vote-ended-date: 1012-01-01
204
- :date: Fred 1010-01-01
205
- :date_2: Jack 1010-01-01
206
- :draft: 3.4
207
- :technical-committee: TC
208
- :technical-committee-number: 1
209
- :technical-committee-type: A
210
- :subcommittee: SC
211
- :subcommittee-number: 2
212
- :subcommittee-type: B
213
- :workgroup: WG
214
- :workgroup-number: 3
215
- :workgroup-type: C
216
- :technical-committee_2: TC1
217
- :technical-committee-number_2: 11
218
- :technical-committee-type_2: A1
219
- :subcommittee_2: SC1
220
- :subcommittee-number_2: 21
221
- :subcommittee-type_2: B1
222
- :workgroup_2: WG1
223
- :workgroup-number_2: 31
224
- :workgroup-type_2: C1
225
- :secretariat: SECRETARIAT
226
- :copyright-year: 2001
227
- :docstage: 10
228
- :docsubstage: 20
229
- :iteration: 3
230
- :language: en
231
- :title: Main Title -- Title
232
- :library-ics: 01.040.11,11.060.01
233
- :fullname: Fred Flintstone
234
- :role: author
235
- :affiliation: Slate Rock and Gravel Company
236
- :affiliation_abbrev: SRG
237
- :affiliation_subdiv: Hermeneutics Unit; Exegetical Subunit
238
- :address: 6 Rubble Way, Bedrock
239
- :contributor-uri: http://slate.example.com
240
- :phone: 123
241
- :fax: 456
242
- :surname_2: Rubble
243
- :givenname_2: Barney
244
- :initials_2: B. X.
245
- :role_2: editor
246
- :affiliation_2: Rockhead and Quarry Cave Construction Company
247
- :affiliation_abbrev_2: RQCCC
248
- :affiliation_subdiv_2: Hermeneutics Unit; Exegetical Subunit
249
- :address_2: 6A Rubble Way, + \\
250
- Bedrock
251
- :email_2: barney@rockhead.example.com
252
- :phone_2: 789
253
- :fax_2: 012
254
- :publisher: "Hanna Barbera"; "Cartoon Network"; "Ribose, Inc."
255
- :copyright-holder: "Ribose, Inc."; Hanna Barbera
256
- :part-of: ABC
257
- :translated-from: DEF,GHI;JKL MNO,PQR
258
- :keywords: a, b, c
259
- :pub-address: 1 Infinity Loop + \\
260
- California
261
- :pub-phone: 3333333
262
- :pub-fax: 4444444
263
- :pub-email: x@example.com
264
- :pub-uri: http://www.example.com
265
- :isbn: ISBN-13
266
- :isbn10: ISBN-10
267
- :classification: a:b, c
268
- :toclevels: 2
269
- :doctoclevels: 3
270
- :htmltoclevels: 4
271
- INPUT
272
- output = <<~OUTPUT
273
- <?xml version="1.0" encoding="UTF-8"?>
274
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
275
- <bibdata type="standard">
276
- <title language="en" format="text/plain">Main Title — Title</title>
277
- <docidentifier>1000-1</docidentifier>
278
- <docidentifier type='ISBN'>ISBN-13</docidentifier>
279
- <docidentifier type='ISBN10'>ISBN-10</docidentifier>
280
- <docnumber>1000</docnumber>
281
- <date type="published">
282
- <on>1000-01-01</on>
283
- </date>
284
- <date type="accessed">
285
- <on>1001-01-01</on>
286
- </date>
287
- <date type="created">
288
- <on>1002-01-01</on>
289
- </date>
290
- <date type="implemented">
291
- <on>1003-01-01</on>
292
- </date>
293
- <date type="obsoleted">
294
- <on>1004-01-01</on>
295
- </date>
296
- <date type="confirmed">
297
- <on>1005-01-01</on>
298
- </date>
299
- <date type="updated">
300
- <on>1006-01-01</on>
301
- </date>
302
- <date type="issued">
303
- <on>1007-01-01</on>
304
- </date>
305
- <date type="circulated">
306
- <on>1008-01-01</on>
307
- </date>
308
- <date type="unchanged">
309
- <on>1009-01-01</on>
310
- </date>
311
- <date type='vote-started'>
312
- <on>1011-01-01</on>
313
- </date>
314
- <date type='vote-ended'>
315
- <on>1012-01-01</on>
316
- </date>
317
- <date type="Fred">
318
- <on>1010-01-01</on>
319
- </date>
320
- <date type="Jack">
321
- <on>1010-01-01</on>
322
- </date>
323
- <contributor>
324
- <role type="author"/>
325
- <organization>
326
- <name>Hanna Barbera</name>
327
- </organization>
328
- </contributor>
329
- <contributor>
330
- <role type="author"/>
331
- <organization>
332
- <name>Cartoon Network</name>
333
- </organization>
334
- </contributor>
335
- <contributor>
336
- <role type="author"/>
337
- <organization>
338
- <name>Ribose, Inc.</name>
339
- </organization>
340
- </contributor>
341
- <contributor>
342
- <role type="author"/>
343
- <person>
344
- <name>
345
- <completename>Fred Flintstone</completename>
346
- </name>
347
- <affiliation>
348
- <organization>
349
- <name>Slate Rock and Gravel Company</name>
350
- <abbreviation>SRG</abbreviation>
351
- <subdivision>Hermeneutics Unit</subdivision>
352
- <subdivision>Exegetical Subunit</subdivision>
353
- <address>
354
- <formattedAddress>
355
- 6 Rubble Way, Bedrock
356
- </formattedAddress>
357
- </address>
358
- </organization>
359
- </affiliation>
360
- <phone>123</phone>
361
- <phone type='fax'>456</phone>
362
- <uri>http://slate.example.com</uri>
363
- </person>
364
- </contributor>
365
- <contributor>
366
- <role type="editor"/>
367
- <person>
368
- <name>
369
- <forename>Barney</forename>
370
- <initial>B. X.</initial>
371
- <surname>Rubble</surname>
372
- </name>
373
- <affiliation>
374
- <organization>
375
- <name>Rockhead and Quarry Cave Construction Company</name>
376
- <abbreviation>RQCCC</abbreviation>
377
- <subdivision>Hermeneutics Unit</subdivision>
378
- <subdivision>Exegetical Subunit</subdivision>
379
- <address>
380
- <formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
381
- </address>
382
- </organization>
383
- </affiliation>
384
- <phone>789</phone>
385
- <phone type='fax'>012</phone>
386
- <email>barney@rockhead.example.com</email>
387
- </person>
388
- </contributor>
389
- <contributor>
390
- <role type="publisher"/>
391
- <organization>
392
- <name>Hanna Barbera</name>
393
- <address>
394
- <formattedAddress>
395
- 1 Infinity Loop
396
- <br/>
397
- California
398
- </formattedAddress>
399
- </address>
400
- <phone>3333333</phone>
401
- <phone type='fax'>4444444</phone>
402
- <email>x@example.com</email>
403
- <uri>http://www.example.com</uri>
404
- </organization>
405
- </contributor>
406
- <contributor>
407
- <role type="publisher"/>
408
- <organization>
409
- <name>Cartoon Network</name>
410
- <address>
411
- <formattedAddress>
412
- 1 Infinity Loop
413
- <br/>
414
- California
415
- </formattedAddress>
416
- </address>
417
- <phone>3333333</phone>
418
- <phone type='fax'>4444444</phone>
419
- <email>x@example.com</email>
420
- <uri>http://www.example.com</uri>
421
- </organization>
422
- </contributor>
423
- <contributor>
424
- <role type="publisher"/>
425
- <organization>
426
- <name>Ribose, Inc.</name>
427
- <address>
428
- <formattedAddress>
429
- 1 Infinity Loop
430
- <br/>
431
- California
432
- </formattedAddress>
433
- </address>
434
- <phone>3333333</phone>
435
- <phone type='fax'>4444444</phone>
436
- <email>x@example.com</email>
437
- <uri>http://www.example.com</uri>
438
- </organization>
439
- </contributor>
440
- <edition>2</edition>
441
- <version>
442
- <revision-date>2000-01-01</revision-date>
443
- <draft>3.4</draft>
444
- </version>
445
- <language>en</language>
446
- <script>Latn</script>
447
- <status>
448
- <stage>10</stage>
449
- <substage>20</substage>
450
- <iteration>3</iteration>
451
- </status>
452
- <copyright>
453
- <from>2001</from>
454
- <owner>
455
- <organization>
456
- <name>Ribose, Inc.</name>
457
- <address>
458
- <formattedAddress>
459
- 1 Infinity Loop
460
- <br/>
461
- California
462
- </formattedAddress>
463
- </address>
464
- <phone>3333333</phone>
465
- <phone type='fax'>4444444</phone>
466
- <email>x@example.com</email>
467
- <uri>http://www.example.com</uri>
468
- </organization>
469
- </owner>
470
- </copyright>
471
- <copyright>
472
- <from>2001</from>
473
- <owner>
474
- <organization>
475
- <name>Hanna Barbera</name>
476
- <address>
477
- <formattedAddress>
478
- 1 Infinity Loop
479
- <br/>
480
- California
481
- </formattedAddress>
482
- </address>
483
- <phone>3333333</phone>
484
- <phone type='fax'>4444444</phone>
485
- <email>x@example.com</email>
486
- <uri>http://www.example.com</uri>
487
- </organization>
488
- </owner>
489
- </copyright>
490
- <relation type="partOf">
491
- <bibitem>
492
- <title>--</title>
493
- <docidentifier>ABC</docidentifier>
494
- </bibitem>
495
- </relation>
496
- <relation type="translatedFrom">
497
- <bibitem>
498
- <title>GHI</title>
499
- <docidentifier>DEF</docidentifier>
500
- </bibitem>
501
- </relation>
502
- <relation type="translatedFrom">
503
- <bibitem>
504
- <title>PQR</title>
505
- <docidentifier>JKL MNO</docidentifier>
506
- </bibitem>
507
- </relation>
508
- <classification type='a'>b</classification>
509
- <classification type='default'>c</classification>
510
- <keyword>a</keyword>
511
- <keyword>b</keyword>
512
- <keyword>c</keyword>
513
- <ext>
514
- <doctype>standard</doctype>
515
- <editorialgroup>
516
- <technical-committee number="1" type="A">TC</technical-committee>
517
- <technical-committee number="11" type="A1">TC1</technical-committee>
518
- </editorialgroup>
519
- <ics>
520
- <code>01.040.11</code>
521
- <text>Health care technology (Vocabularies)</text>
522
- </ics>
523
- <ics>
524
- <code>11.060.01</code>
525
- <text>Dentistry in general</text>
526
- </ics>
527
- </ext>
528
- </bibdata>
529
- <misc-container>
530
- <presentation-metadata>
531
- <name>TOC Heading Levels</name>
532
- <value>2</value>
533
- </presentation-metadata>
534
- <presentation-metadata>
535
- <name>TOC Heading Levels</name>
536
- <value>2</value>
537
- </presentation-metadata>
538
- <presentation-metadata>
539
- <name>TOC Heading Levels</name>
540
- <value>2</value>
541
- </presentation-metadata>
542
- </misc-container>
543
- <sections/>
544
- </standard-document>
545
- OUTPUT
546
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
547
- .to be_equivalent_to xmlpp(output)
548
- end
549
-
550
- it "processes complex metadata" do
551
- input = <<~INPUT
552
- = Document title
553
- Author
554
- :docfile: test.adoc
555
- :nodoc:
556
- :novalid:
557
- :revdate: 2000-01
558
- :published-date: 1000-01
559
- :docnumber: 1000
560
- :partnumber: 1-1
561
- :tc-docnumber: 2000
562
- :language: el
563
- :script: Grek
564
- :locale: CY
565
- :publisher: IEC;IETF;ISO
566
- :uri: A
567
- :xml-uri: B
568
- :html-uri: C
569
- :pdf-uri: D
570
- :doc-uri: E
571
- :relaton-uri: F
572
- :title-eo: Dokumenttitolo
573
- :doctype: This is a DocType
574
- :docsubtype: This is a DocSubType
575
- :subdivision: Subdivision
576
- :subdivision-abbr: SD
577
- :fullname: Fred Flintstone
578
- :affiliation: Slate Rock and Gravel Company
579
- :street: 1 Infinity Loop
580
- :city: Cupertino
581
- :state: CA
582
- :country: USA
583
- :postcode: 95014
584
- :fullname_2: Barney Rubble
585
- :affiliation_2: Slate Rock and Gravel Company
586
- :street_2: Pavillon de Breteuil
587
- :city_2: Sèvres CEDEX
588
- :country_2: France
589
- :postcode_2: F-92312
590
- :semantic-metadata-hello-world: A, B, "C, D"
591
- :semantic-metadata-hello: what-not
592
- :presentation-metadata-hello: Hello?
593
- :presentation-metadata-Manifold: "hello, world","yes"
594
-
595
- [abstract]
596
- == Abstract
597
- This is the abstract of the document
598
-
599
- This is the second paragraph of the abstract of the document.
600
-
601
- [language=en]
602
- == Clause 1
603
- INPUT
604
- output = <<~OUTPUT
605
- <?xml version="1.0" encoding="UTF-8"?>
606
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
607
- <bibdata type="standard">
608
- <title language="en" format="text/plain">Document title</title>
609
- <title language="eo" format="text/plain">Dokumenttitolo</title>
610
- <uri>A</uri>
611
- <uri type="xml">B</uri>
612
- <uri type="html">C</uri>
613
- <uri type="pdf">D</uri>
614
- <uri type="doc">E</uri>
615
- <uri type="relaton">F</uri>
616
- <docidentifier>1000-1-1</docidentifier>
617
- <docnumber>1000</docnumber>
618
- <date type='published'>
619
- <on>1000-01</on>
620
- </date>
621
- <contributor>
622
- <role type="author"/>
623
- <organization>
624
- <name>IEC</name>
625
- </organization>
626
- </contributor>
627
- <contributor>
628
- <role type="author"/>
629
- <organization>
630
- <name>IETF</name>
631
- </organization>
632
- </contributor>
633
- <contributor>
634
- <role type="author"/>
635
- <organization>
636
- <name>ISO</name>
637
- </organization>
638
- </contributor>
639
- <contributor>
640
- <role type='author'/>
641
- <person>
642
- <name>
643
- <completename>Fred Flintstone</completename>
644
- </name>
645
- <affiliation>
646
- <organization>
647
- <name>Slate Rock and Gravel Company</name>
648
- <address>
649
- <street>1 Infinity Loop</street>
650
- <city>Cupertino</city>
651
- <state>CA</state>
652
- <country>USA</country>
653
- <postcode>95014</postcode>
654
- </address>
655
- </organization>
656
- </affiliation>
657
- </person>
658
- </contributor>
659
- <contributor>
660
- <role type='author'/>
661
- <person>
662
- <name>
663
- <completename>Barney Rubble</completename>
664
- </name>
665
- <affiliation>
666
- <organization>
667
- <name>Slate Rock and Gravel Company</name>
668
- <address>
669
- <street>Pavillon de Breteuil</street>
670
- <city>S&#232;vres CEDEX</city>
671
- <country>France</country>
672
- <postcode>F-92312</postcode>
673
- </address>
674
- </organization>
675
- </affiliation>
676
- </person>
677
- </contributor>
678
- <contributor>
679
- <role type="publisher"/>
680
- <organization>
681
- <name>IEC</name>
682
- </organization>
683
- </contributor>
684
- <contributor>
685
- <role type="publisher"/>
686
- <organization>
687
- <name>IETF</name>
688
- </organization>
689
- </contributor>
690
- <contributor>
691
- <role type="publisher"/>
692
- <organization>
693
- <name>ISO</name>
694
- </organization>
695
- </contributor>
696
- <version>
697
- <revision-date>2000-01</revision-date>
698
- </version>
699
- <language>el</language>
700
- <locale>CY</locale>
701
- <script>Grek</script>
702
- <abstract><p>This is the abstract of the document</p>
703
- <p>This is the second paragraph of the abstract of the document.</p></abstract>
704
- <status><stage>published</stage></status>
705
- <copyright>
706
- <from>#{Date.today.year}</from>
707
- <owner>
708
- <organization>
709
- <name>IEC</name>
710
- </organization>
711
- </owner>
712
- </copyright>
713
- <copyright>
714
- <from>#{Date.today.year}</from>
715
- <owner>
716
- <organization>
717
- <name>IETF</name>
718
- </organization>
719
- </owner>
720
- </copyright>
721
- <copyright>
722
- <from>#{Date.today.year}</from>
723
- <owner>
724
- <organization>
725
- <name>ISO</name>
726
- </organization>
727
- </owner>
728
- </copyright>
729
- <ext>
730
- <doctype>this-is-a-doctype</doctype>
731
- <subdoctype>This is a DocSubType</subdoctype>
732
- </ext>
733
- </bibdata>
734
- <misc-container>
735
- <semantic-metadata>
736
- <hello-world>A</hello-world>
737
- </semantic-metadata>
738
- <semantic-metadata>
739
- <hello-world>B</hello-world>
740
- </semantic-metadata>
741
- <semantic-metadata>
742
- <hello-world>C, D</hello-world>
743
- </semantic-metadata>
744
- <semantic-metadata>
745
- <hello>what-not</hello>
746
- </semantic-metadata>
747
- <presentation-metadata>
748
- <hello>Hello?</hello>
749
- </presentation-metadata>
750
- <presentation-metadata>
751
- <manifold>hello, world</manifold>
752
- </presentation-metadata>
753
- <presentation-metadata>
754
- <manifold>yes</manifold>
755
- </presentation-metadata>
756
- </misc-container>
757
- <preface>
758
- <abstract id='_'>
759
- <title>Abstract</title>
760
- <p id='_'>This is the abstract of the document</p>
761
- <p id='_'>This is the second paragraph of the abstract of the document.</p>
762
- </abstract>
763
- </preface>
764
- <sections>
765
- <clause id='_' language='en' inline-header='false' obligation='normative'>
766
- <title>Clause 1</title>
767
- </clause>
768
- </sections>
769
- </standard-document>
770
- OUTPUT
771
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
772
- .to be_equivalent_to xmlpp(output)
773
- end
774
-
775
- it "processes formatted address overridding address components" do
776
- input = <<~INPUT
777
- = Document title
778
- Author
779
- :docfile: test.adoc
780
- :nodoc:
781
- :novalid:
782
- :fullname: Fred Flintstone
783
- :affiliation: Slate Rock and Gravel Company
784
- :address: Address
785
- :city: Utopia
786
- :fullname_2: Barney Rubble
787
- :affiliation_2: Slate Rock and Gravel Company
788
- :city_2: Utopia
789
-
790
- INPUT
791
- output = <<~OUTPUT
792
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
793
- <bibdata type='standard'>
794
- <title language='en' format='text/plain'>Document title</title>
795
- <contributor>
796
- <role type='author'/>
797
- <person>
798
- <name>
799
- <completename>Fred Flintstone</completename>
800
- </name>
801
- <affiliation>
802
- <organization>
803
- <name>Slate Rock and Gravel Company</name>
804
- <address>
805
- <formattedAddress>Address</formattedAddress>
806
- </address>
807
- </organization>
808
- </affiliation>
809
- </person>
810
- </contributor>
811
- <contributor>
812
- <role type='author'/>
813
- <person>
814
- <name>
815
- <completename>Barney Rubble</completename>
816
- </name>
817
- <affiliation>
818
- <organization>
819
- <name>Slate Rock and Gravel Company</name>
820
- <address>
821
- <city>Utopia</city>
822
- </address>
823
- </organization>
824
- </affiliation>
825
- </person>
826
- </contributor>
827
- <language>en</language>
828
- <script>Latn</script>
829
- <status>
830
- <stage>published</stage>
831
- </status>
832
- <copyright>
833
- <from>#{Time.now.year}</from>
834
- </copyright>
835
- <ext>
836
- <doctype>standard</doctype>
837
- </ext>
838
- </bibdata>
839
- <sections> </sections>
840
- </standard-document>
841
- OUTPUT
842
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
843
- .to be_equivalent_to xmlpp(output)
844
- end
845
-
846
- it "processes subdivisions" do
847
- mock_default_publisher
848
- input = <<~INPUT
849
- = Document title
850
- Author
851
- :docfile: test.adoc
852
- :nodoc:
853
- :novalid:
854
- :revdate: 2000-01
855
- :published-date: 1000-01
856
- :docnumber: 1000
857
- :partnumber: 1-1
858
- :tc-docnumber: 2000
859
- :language: el
860
- :script: Grek
861
- :subdivision: Subdivision
862
- :subdivision-abbr: SD
863
- :doctype: This is a DocType
864
- :pub-address: 1 Infinity Loop + \\
865
- California
866
- :pub-phone: 3333333
867
- :pub-fax: 4444444
868
- :pub-email: x@example.com
869
- :pub-uri: http://www.example.com
870
-
871
- INPUT
872
- output = <<~OUTPUT
873
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
874
- <bibdata type='standard'>
875
- <title language='en' format='text/plain'>Document title</title>
876
- <docidentifier>1000-1-1</docidentifier>
877
- <docnumber>1000</docnumber>
878
- <date type='published'>
879
- <on>1000-01</on>
880
- </date>
881
- <contributor>
882
- <role type='author'/>
883
- <organization>
884
- <name>International Standards Organization</name>
885
- <subdivision>Subdivision</subdivision>
886
- <abbreviation>SD</abbreviation>
887
- </organization>
888
- </contributor>
889
- <contributor>
890
- <role type='publisher'/>
891
- <organization>
892
- <name>International Standards Organization</name>
893
- <subdivision>Subdivision</subdivision>
894
- <abbreviation>SD</abbreviation>
895
- <address>
896
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
897
- </address>
898
- <phone>3333333</phone>
899
- <phone type='fax'>4444444</phone>
900
- <email>x@example.com</email>
901
- <uri>http://www.example.com</uri>
902
- </organization>
903
- </contributor>
904
- <version>
905
- <revision-date>2000-01</revision-date>
906
- </version>
907
- <language>el</language>
908
- <script>Grek</script>
909
- <status>
910
- <stage>published</stage>
911
- </status>
912
- <copyright>
913
- <from>#{Time.now.year}</from>
914
- <owner>
915
- <organization>
916
- <name>International Standards Organization</name>
917
- <subdivision>Subdivision</subdivision>
918
- <abbreviation>SD</abbreviation>
919
- <address>
920
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
921
- </address>
922
- <phone>3333333</phone>
923
- <phone type='fax'>4444444</phone>
924
- <email>x@example.com</email>
925
- <uri>http://www.example.com</uri>
926
- </organization>
927
- </owner>
928
- </copyright>
929
- <ext>
930
- <doctype>this-is-a-doctype</doctype>
931
- </ext>
932
- </bibdata>
933
- <sections> </sections>
934
- </standard-document>
935
- OUTPUT
936
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
937
- .to be_equivalent_to xmlpp(output)
938
- end
939
-
940
- it "processes document relations by description" do
941
- mock_relaton_relation_descriptions
942
- input = <<~INPUT
943
- = Document title
944
- Author
945
- :docfile: test.adoc
946
- :nodoc:
947
- :novalid:
948
- :normatively-cited-in: ABC
949
-
950
- INPUT
951
- output = <<~OUTPUT
952
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
953
- <bibdata type='standard'>
954
- <title language='en' format='text/plain'>Document title</title>
955
- <language>en</language>
956
- <script>Latn</script>
957
- <status>
958
- <stage>published</stage>
959
- </status>
960
- <copyright>
961
- <from>#{Time.now.year}</from>
962
- </copyright>
963
- <relation type='isCitedIn'>
964
- <description>normatively cited in</description>
965
- <bibitem>
966
- <title>--</title>
967
- <docidentifier>ABC</docidentifier>
968
- </bibitem>
969
- </relation>
970
- <ext>
971
- <doctype>standard</doctype>
972
- </ext>
973
- </bibdata>
974
- <sections> </sections>
975
- </standard-document>
976
- OUTPUT
977
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
978
- .to be_equivalent_to xmlpp(output)
979
- end
980
-
981
- it "reads scripts into blank HTML document" do
982
- FileUtils.rm_f "test.html"
983
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
984
- = Document title
985
- Author
986
- :docfile: test.adoc
987
- :novalid:
988
- :no-pdf:
989
- :scripts: spec/assets/scripts.html
990
- INPUT
991
- html = File.read("test.html", encoding: "utf-8")
992
- expect(html).to match(%r{<script>})
993
- end
994
-
995
- it "uses specified fonts and assets in HTML" do
996
- FileUtils.rm_f "test.html"
997
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
998
- = Document title
999
- Author
1000
- :docfile: test.adoc
1001
- :no-pdf:
1002
- :novalid:
1003
- :script: Hans
1004
- :body-font: Zapf Chancery
1005
- :header-font: Comic Sans
1006
- :monospace-font: Andale Mono
1007
- :htmlstylesheet: spec/assets/html.scss
1008
- :htmlstylesheet-override: spec/assets/html-override.css
1009
- :htmlcoverpage: spec/assets/htmlcover.html
1010
- :htmlintropage: spec/assets/htmlintro.html
1011
- :scripts: spec/assets/scripts.html
1012
- :htmltoclevels: 3
1013
-
1014
- == Level 1
1015
-
1016
- === Level 2
1017
-
1018
- ==== Level 3
1019
- INPUT
1020
- html = File.read("test.html", encoding: "utf-8")
1021
- expect(html).to match(%r[pre[^{]+\{[^{]+font-family: Andale Mono;]m)
1022
- expect(html).to match(%r[p[^{]+\{[^{]+font-family: Zapf Chancery;]m)
1023
- expect(html).to match(%r[h1[^{]+\{[^{]+font-family: Comic Sans;]m)
1024
- expect(html).to match(%r[an empty html cover page])
1025
- expect(html).to match(%r[an empty html intro page])
1026
- expect(html).to match(%r[This is > a script])
1027
- expect(html).to match(%r[html-override])
1028
- end
1029
-
1030
- it "uses specified fonts and assets in Word" do
1031
- FileUtils.rm_f "test.doc"
1032
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1033
- = Document title
1034
- Author
1035
- :docfile: test.adoc
1036
- :novalid:
1037
- :no-pdf:
1038
- :script: Hans
1039
- :body-font: Zapf Chancery
1040
- :header-font: Comic Sans
1041
- :monospace-font: Andale Mono
1042
- :wordstylesheet: spec/assets/word.scss
1043
- :wordstylesheet-override: spec/assets/word-override.css
1044
- :wordcoverpage: spec/assets/wordcover.html
1045
- :wordintropage: spec/assets/wordintro.html
1046
- :header: spec/assets/header.html
1047
- :doctoclevels: 3
1048
-
1049
- == Level 1
1050
-
1051
- === Level 2
1052
-
1053
- ==== Level 3
1054
- INPUT
1055
- html = File.read("test.doc", encoding: "utf-8")
1056
- expect(html).to match(%r[pre[^{]+\{[^{]+font-family: Andale Mono;]m)
1057
- expect(html).to match(%r[p[^{]+\{[^{]+font-family: Zapf Chancery;]m)
1058
- expect(html).to match(%r[h1[^{]+\{[^{]+font-family: Comic Sans;]m)
1059
- expect(html).to match(%r[an empty word cover page])
1060
- expect(html).to match(%r[an empty word intro page])
1061
- expect(html).to match(%r[word-override])
1062
- expect(html).to include('\o "1-3"')
1063
- expect(html).to include(%[Content-ID: <header.html>
1064
- Content-Disposition: inline; filename="header.html"
1065
- Content-Transfer-Encoding: base64
1066
- Content-Type: text/html charset="utf-8"
1067
-
1068
- Ci8qIGFuIGVtcHR5IGhlYWRlciAqLwoKU1RBUlQgRE9DIElEOiA6IEVORCBET0MgSUQKCkZJTEVO
1069
- QU1FOiB0ZXN0Cgo=
1070
- ])
1071
- end
1072
-
1073
- it "test submitting-organizations with delimiter in end" do
1074
- FileUtils.rm_f "test.doc"
1075
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1076
- = Document title
1077
- Author
1078
- :no-pdf:
1079
- :docfile: test.adoc
1080
- :doctype: standard
1081
- :encoding: utf-8
1082
- :lang: en
1083
- :submitting-organizations: Organization One; Organization Two;
1084
- :publisher: "Hanna Barbera", "Cartoon Network", "Ribose, Inc.",
1085
- INPUT
1086
- expect(File.exist?("test.doc")).to be true
1087
- end
1088
-
1089
- it "process mn2pdf attributes" do
1090
- node = Nokogiri::XML("<fake/>").at("fake")
1091
- node[Metanorma::Standoc::Base::FONTS_MANIFEST] =
1092
- "passed/as/font/manifest/to/mn2pdf.jar"
1093
-
1094
- options = Metanorma::Standoc::Converter
1095
- .new(:standoc, header_footer: true)
1096
- .doc_extract_attributes(node)
1097
-
1098
- expect(options[:font_manifest])
1099
- .to eq(node[Metanorma::Standoc::Base::FONTS_MANIFEST])
1100
- end
1101
-
1102
- private
1103
-
1104
- def mock_org_abbrevs
1105
- allow_any_instance_of(::Metanorma::Standoc::Front)
1106
- .to receive(:org_abbrev).and_return(
1107
- { "International Standards Organization" => "ISO",
1108
- "International Electrotechnical Commission" => "IEC" },
1109
- )
1110
- end
1111
-
1112
- def mock_default_publisher
1113
- allow_any_instance_of(::Metanorma::Standoc::Front)
1114
- .to receive(:default_publisher).and_return(
1115
- "International Standards Organization",
1116
- )
1117
- end
1118
-
1119
- def mock_relaton_relation_descriptions
1120
- allow_any_instance_of(::Metanorma::Standoc::Front)
1121
- .to receive(:relaton_relation_descriptions).and_return(
1122
- "normatively-cited-in" => "isCitedIn",
1123
- )
1124
- end
1125
- end