metanorma-iso 2.1.0 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +145 -10
  3. data/lib/isodoc/iso/base_convert.rb +11 -1
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +216 -278
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +294 -288
  7. data/lib/isodoc/iso/html/isodoc.css +38 -13
  8. data/lib/isodoc/iso/html/isodoc.scss +38 -12
  9. data/lib/isodoc/iso/html/style-human.css +14 -1
  10. data/lib/isodoc/iso/html/style-human.scss +10 -1
  11. data/lib/isodoc/iso/html/style-iso.css +35 -23
  12. data/lib/isodoc/iso/html/style-iso.scss +31 -23
  13. data/lib/isodoc/iso/html/word_iso_intro-dis.html +1 -6
  14. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +24 -13
  15. data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
  16. data/lib/isodoc/iso/html/word_iso_titlepage.html +10 -6
  17. data/lib/isodoc/iso/html/wordstyle-dis.css +12 -62
  18. data/lib/isodoc/iso/html/wordstyle-dis.scss +7 -56
  19. data/lib/isodoc/iso/html_convert.rb +7 -2
  20. data/lib/isodoc/iso/i18n-en.yaml +32 -4
  21. data/lib/isodoc/iso/i18n-fr.yaml +29 -3
  22. data/lib/isodoc/iso/i18n-ru.yaml +32 -4
  23. data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
  24. data/lib/isodoc/iso/i18n.rb +1 -1
  25. data/lib/isodoc/iso/iso.amendment.xsl +1570 -246
  26. data/lib/isodoc/iso/iso.international-standard.xsl +1570 -246
  27. data/lib/isodoc/iso/metadata.rb +67 -67
  28. data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
  29. data/lib/isodoc/iso/presentation_xml_convert.rb +16 -5
  30. data/lib/isodoc/iso/presentation_xref.rb +10 -4
  31. data/lib/isodoc/iso/sections.rb +3 -3
  32. data/lib/isodoc/iso/word_cleanup.rb +3 -0
  33. data/lib/isodoc/iso/word_convert.rb +8 -5
  34. data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
  35. data/lib/isodoc/iso/word_dis_convert.rb +48 -100
  36. data/lib/isodoc/iso/xref.rb +34 -6
  37. data/lib/metanorma/iso/base.rb +20 -1
  38. data/lib/metanorma/iso/biblio.rng +134 -39
  39. data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
  40. data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
  41. data/lib/metanorma/iso/boilerplate.xml +3 -0
  42. data/lib/metanorma/iso/cleanup.rb +49 -11
  43. data/lib/metanorma/iso/front.rb +38 -6
  44. data/lib/metanorma/iso/front_id.rb +2 -0
  45. data/lib/metanorma/iso/isodoc.rng +16 -0
  46. data/lib/metanorma/iso/isostandard.rng +30 -12
  47. data/lib/metanorma/iso/macros.rb +29 -0
  48. data/lib/metanorma/iso/validate_section.rb +0 -12
  49. data/lib/metanorma/iso/version.rb +1 -1
  50. data/spec/isodoc/amd_spec.rb +20 -46
  51. data/spec/isodoc/blocks_spec.rb +499 -2
  52. data/spec/isodoc/i18n_spec.rb +145 -80
  53. data/spec/isodoc/iso_spec.rb +50 -169
  54. data/spec/isodoc/metadata_spec.rb +240 -99
  55. data/spec/isodoc/postproc_spec.rb +43 -7
  56. data/spec/isodoc/section_spec.rb +9 -9
  57. data/spec/isodoc/word_dis_spec.rb +1332 -146
  58. data/spec/isodoc/xref_spec.rb +87 -13
  59. data/spec/metanorma/amd_spec.rb +39 -23
  60. data/spec/metanorma/base_spec.rb +174 -44
  61. data/spec/metanorma/blocks_spec.rb +54 -0
  62. data/spec/metanorma/lists_spec.rb +2 -2
  63. data/spec/metanorma/section_spec.rb +2 -2
  64. data/spec/metanorma/validate_spec.rb +8 -19
  65. data/spec/spec_helper.rb +17 -7
  66. data/spec/vcr_cassettes/withdrawn_iso.yml +30 -30
  67. metadata +7 -8
  68. data/docs/asciiiso-syntax.adoc +0 -307
  69. data/docs/guidance.adoc +0 -487
  70. data/docs/navigation.adoc +0 -23
  71. data/docs/quickstart.adoc +0 -179
  72. data/lib/isodoc/iso/presentation_inline.rb +0 -90
@@ -82,6 +82,11 @@ RSpec.describe IsoDoc::Iso::Metadata do
82
82
  <workgroup number="3">Rice Group</workgroup>
83
83
  <secretariat>GB</secretariat>
84
84
  </editorialgroup>
85
+ <approvalgroup>
86
+ <technical-committee number="34a">Food products A</technical-committee>
87
+ <subcommittee number="4a">Cereals and pulses A</subcommittee>
88
+ <workgroup number="3a">Rice Group A</workgroup>
89
+ </approvalgroup>
85
90
  <structuredidentifier>
86
91
  <project-number part="1">ISO/PreCD3 17301</project-number>
87
92
  </structuredidentifier>
@@ -94,24 +99,22 @@ RSpec.describe IsoDoc::Iso::Metadata do
94
99
  {:accesseddate=>"2012",
95
100
  :activateddate=>"2013",
96
101
  :agency=>"ISO",
97
- :circulateddate=>"XXX",
98
- :confirmeddate=>"XXX",
99
- :copieddate=>"XXX",
100
- :createddate=>"2010&ndash;2011",
102
+ :approvalgroup=>["TC 34a", "SC 4a", "WG 3a"],
103
+ :createddate=>"2010&#x2013;2011",
101
104
  :docnumber=>"ISO/PreCD3 17301-1",
102
105
  :docnumber_lang=>"ISO/PreCD3 17301-1 (E)",
103
106
  :docnumber_reference=>"ISO/PreCD3 17301-1:2000 (E)",
104
107
  :docnumeric=>"1730",
105
- :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz",
108
+ :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&#xa0;&#x2014; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&#xa0;&#x2014; Partie&#xa0;1: Riz",
106
109
  :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
107
110
  :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
108
111
  :docsubtitlepart=>"Riz",
109
- :docsubtitlepartlabel=>"Partie&nbsp;1",
110
- :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice",
112
+ :docsubtitlepartlabel=>"Partie&#xa0;1",
113
+ :doctitle=>"Cereals and pulses&#xa0;&#x2014; Specifications and test methods&#xa0;&#x2014; Part&#xa0;1: Rice",
111
114
  :doctitleintro=>"Cereals and pulses",
112
115
  :doctitlemain=>"Specifications and test methods",
113
116
  :doctitlepart=>"Rice",
114
- :doctitlepartlabel=>"Part&nbsp;1",
117
+ :doctitlepartlabel=>"Part&#xa0;1",
115
118
  :doctype=>"International Standard",
116
119
  :doctype_display=>"International Standard",
117
120
  :docyear=>"2016",
@@ -120,14 +123,11 @@ RSpec.describe IsoDoc::Iso::Metadata do
120
123
  :edition=>"2",
121
124
  :editorialgroup=>["TC 34", "SC 4", "WG 3"],
122
125
  :horizontal=>"true",
123
- :implementeddate=>"XXX",
124
- :issueddate=>"XXX",
125
126
  :keywords=>["kw2", "kw1"],
126
127
  :lang=>"en",
127
128
  :obsoleteddate=>"2014",
128
129
  :publisheddate=>"2011",
129
130
  :publisher=>"International Organization for Standardization",
130
- :receiveddate=>"XXX",
131
131
  :revdate=>"2016-05-01",
132
132
  :revdate_monthyear=>"May 2016",
133
133
  :sc=>"SC 4",
@@ -137,14 +137,10 @@ RSpec.describe IsoDoc::Iso::Metadata do
137
137
  :stage_int=>30,
138
138
  :stageabbr=>"CD",
139
139
  :statusabbr=>"PreCD3",
140
+ :substage_int=>"92",
140
141
  :tc=>"TC 34",
141
142
  :tc_docnumber=>["17301", "17302"],
142
- :transmitteddate=>"XXX",
143
- :unchangeddate=>"XXX",
144
143
  :unpublished=>true,
145
- :updateddate=>"XXX",
146
- :vote_endeddate=>"XXX",
147
- :vote_starteddate=>"XXX",
148
144
  :wg=>"WG 3"}
149
145
  OUTPUT
150
146
  expect(metadata(c.info(Nokogiri::XML(input),
@@ -159,16 +155,9 @@ RSpec.describe IsoDoc::Iso::Metadata do
159
155
  input = <<~INPUT
160
156
  <iso-standard xmlns="http://riboseinc.com/isoxml">
161
157
  <bibdata type="standard">
162
- <title>
163
158
  <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
164
159
  <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
165
160
  <title type="title-part" language="en" format="text/plain">Rice</title>
166
- </title>
167
- <title>
168
- <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
169
- <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
170
- <title type="title-part" language="fr" format="text/plain">Riz</title>
171
- </title>
172
161
  <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
173
162
  <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
174
163
  <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
@@ -218,6 +207,11 @@ RSpec.describe IsoDoc::Iso::Metadata do
218
207
  <subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
219
208
  <workgroup number="3" type="GHI">Rice Group</workgroup>
220
209
  </editorialgroup>
210
+ <approvalgroup>
211
+ <technical-committee number="34" type="ABC">Food products</technical-committee>
212
+ <subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
213
+ <workgroup number="3" type="GHI">Rice Group</workgroup>
214
+ </approvalgroup>
221
215
  <ics><code>1.2.3</code></ics>
222
216
  <ics><code>1.2.3</code></ics>
223
217
  <structuredidentifier>
@@ -229,53 +223,35 @@ RSpec.describe IsoDoc::Iso::Metadata do
229
223
  </iso-standard>
230
224
  INPUT
231
225
  output = <<~OUTPUT
232
- {:accesseddate=>"XXX",
233
- :agency=>"ISO/IEC",
234
- :circulateddate=>"XXX",
235
- :confirmeddate=>"XXX",
236
- :copieddate=>"XXX",
237
- :createddate=>"XXX",
226
+ {:agency=>"ISO/IEC",
227
+ :approvalgroup=>["ABC 34", "DEF 4", "GHI 3"],
238
228
  :docnumber=>"ISO/IEC/CD 17301-1-3",
239
229
  :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
240
230
  :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
241
- :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz",
242
- :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
243
- :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
244
- :docsubtitlepart=>"Riz",
245
- :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3",
246
- :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice",
231
+ :docsubtitlepartlabel=>"Partie&#xa0;1&#x2013;3",
232
+ :doctitle=>"Cereals and pulses&#xa0;&#x2014; Specifications and test methods&#xa0;&#x2014; Part&#xa0;1&#x2013;3: Rice",
247
233
  :doctitleintro=>"Cereals and pulses",
248
234
  :doctitlemain=>"Specifications and test methods",
249
235
  :doctitlepart=>"Rice",
250
- :doctitlepartlabel=>"Part&nbsp;1&ndash;3",
236
+ :doctitlepartlabel=>"Part&#xa0;1&#x2013;3",
251
237
  :doctype=>"International Standard",
252
238
  :doctype_display=>"International Standard",
253
239
  :docyear=>"2016",
254
240
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
255
241
  :ics=>"1.2.3, 1.2.3",
256
- :implementeddate=>"XXX",
257
- :issueddate=>"XXX",
258
242
  :lang=>"en",
259
- :obsoleteddate=>"XXX",
260
243
  :obsoletes=>"IEC 8121",
261
244
  :obsoletes_part=>"3.1",
262
- :publisheddate=>"XXX",
263
245
  :publisher=>"International Organization for Standardization and International Electrotechnical Commission",
264
- :receiveddate=>"XXX",
265
246
  :sc=>"DEF 4",
266
247
  :script=>"Latn",
267
- :secretariat=>"XXX",
268
248
  :stage=>"60",
269
249
  :stage_int=>60,
270
250
  :statusabbr=>"IS",
251
+ :substage_int=>"92",
271
252
  :tc=>"ABC 34",
272
253
  :tc_docnumber=>["17301"],
273
- :transmitteddate=>"XXX",
274
- :unchangeddate=>"XXX",
275
254
  :unpublished=>false,
276
- :updateddate=>"XXX",
277
- :vote_endeddate=>"XXX",
278
- :vote_starteddate=>"XXX",
279
255
  :wg=>"GHI 3"}
280
256
  OUTPUT
281
257
  expect(metadata(c.info(Nokogiri::XML(input),
@@ -294,16 +270,12 @@ RSpec.describe IsoDoc::Iso::Metadata do
294
270
  input = <<~INPUT
295
271
  <iso-standard xmlns="http://riboseinc.com/isoxml">
296
272
  <bibdata type="standard">
297
- <title>
298
273
  <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
299
274
  <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
300
275
  <title type="title-part" language="en" format="text/plain">Rice</title>
301
- </title>
302
- <title>
303
276
  <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
304
277
  <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
305
278
  <title type="title-part" language="fr" format="text/plain">Riz</title>
306
- </title>
307
279
  <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
308
280
  <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
309
281
  <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
@@ -365,53 +337,38 @@ RSpec.describe IsoDoc::Iso::Metadata do
365
337
  </iso-standard>
366
338
  INPUT
367
339
  output = <<~OUTPUT
368
- {:accesseddate=>"XXX",
369
- :agency=>"ISO/IEC",
370
- :circulateddate=>"XXX",
371
- :confirmeddate=>"XXX",
372
- :copieddate=>"XXX",
373
- :createddate=>"XXX",
340
+ {:agency=>"ISO/IEC",
374
341
  :docnumber=>"ISO/IEC/CD 17301-1-3",
375
342
  :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
376
343
  :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
377
- :docsubtitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice",
344
+ :docsubtitle=>"Cereals and pulses&#xa0;&#x2014; Specifications and test methods&#xa0;&#x2014; Part&#xa0;1&#x2013;3: Rice",
378
345
  :docsubtitleintro=>"Cereals and pulses",
379
346
  :docsubtitlemain=>"Specifications and test methods",
380
347
  :docsubtitlepart=>"Rice",
381
- :docsubtitlepartlabel=>"Part&nbsp;1&ndash;3",
382
- :doctitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz",
348
+ :docsubtitlepartlabel=>"Part&#xa0;1&#x2013;3",
349
+ :doctitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&#xa0;&#x2014; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&#xa0;&#x2014; Partie&#xa0;1&#x2013;3: Riz",
383
350
  :doctitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
384
351
  :doctitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
385
352
  :doctitlepart=>"Riz",
386
- :doctitlepartlabel=>"Partie&nbsp;1&ndash;3",
353
+ :doctitlepartlabel=>"Partie&#xa0;1&#x2013;3",
387
354
  :doctype=>"International Standard",
388
355
  :doctype_display=>"Standard International",
389
356
  :docyear=>"2016",
390
357
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
391
358
  :ics=>"1.2.3, 1.2.3",
392
- :implementeddate=>"XXX",
393
- :issueddate=>"XXX",
394
359
  :lang=>"fr",
395
- :obsoleteddate=>"XXX",
396
360
  :obsoletes=>"IEC 8121",
397
361
  :obsoletes_part=>"3.1",
398
- :publisheddate=>"XXX",
399
362
  :publisher=>"International Organization for Standardization et International Electrotechnical Commission",
400
- :receiveddate=>"XXX",
401
363
  :sc=>"DEF 4",
402
364
  :script=>"Latn",
403
- :secretariat=>"XXX",
404
365
  :stage=>"60",
405
366
  :stage_int=>60,
406
367
  :statusabbr=>"IS",
368
+ :substage_int=>"92",
407
369
  :tc=>"ABC 34",
408
370
  :tc_docnumber=>["17301"],
409
- :transmitteddate=>"XXX",
410
- :unchangeddate=>"XXX",
411
371
  :unpublished=>false,
412
- :updateddate=>"XXX",
413
- :vote_endeddate=>"XXX",
414
- :vote_starteddate=>"XXX",
415
372
  :wg=>"GHI 3"}
416
373
  OUTPUT
417
374
  expect(metadata(c.info(Nokogiri::XML(input),
@@ -430,21 +387,15 @@ RSpec.describe IsoDoc::Iso::Metadata do
430
387
  input = <<~INPUT
431
388
  <iso-standard xmlns="http://riboseinc.com/isoxml">
432
389
  <bibdata type="standard">
433
- <title>
434
390
  <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
435
391
  <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
436
392
  <title type="title-part" language="en" format="text/plain">Rice</title>
437
- </title>
438
- <title>
439
393
  <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
440
394
  <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
441
395
  <title type="title-part" language="fr" format="text/plain">Riz</title>
442
- </title>
443
- <title>
444
396
  <title type="title-intro" language="ru" format="text/plain">Зерновые и бобовые</title>
445
397
  <title type="title-main" language="ru" format="text/plain">Технические характеристики и методы испытаний</title>
446
398
  <title type="title-part" language="ru" format="text/plain">Рис</title>
447
- </title>
448
399
  <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
449
400
  <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
450
401
  <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
@@ -506,56 +457,246 @@ RSpec.describe IsoDoc::Iso::Metadata do
506
457
  </iso-standard>
507
458
  INPUT
508
459
  output = <<~OUTPUT
509
- {:accesseddate=>"XXX",
510
- :agency=>"ISO/IEC",
511
- :circulateddate=>"XXX",
512
- :confirmeddate=>"XXX",
513
- :copieddate=>"XXX",
514
- :createddate=>"XXX",
460
+ {:agency=>"ISO/IEC",
515
461
  :docnumber=>"ISO/IEC/CD 17301-1-3",
516
462
  :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
517
463
  :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
518
- :docsubtitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice",
464
+ :docsubtitle=>"Cereals and pulses&#xa0;&#x2014; Specifications and test methods&#xa0;&#x2014; Part&#xa0;1&#x2013;3: Rice",
519
465
  :docsubtitleintro=>"Cereals and pulses",
520
466
  :docsubtitlemain=>"Specifications and test methods",
521
467
  :docsubtitlepart=>"Rice",
522
- :docsubtitlepartlabel=>"Part&nbsp;1&ndash;3",
523
- :doctitle=>"&#x417;&#x435;&#x440;&#x43d;&#x43e;&#x432;&#x44b;&#x435; &#x438; &#x431;&#x43e;&#x431;&#x43e;&#x432;&#x44b;&#x435;&nbsp;&mdash; &#x422;&#x435;&#x445;&#x43d;&#x438;&#x447;&#x435;&#x441;&#x43a;&#x438;&#x435; &#x445;&#x430;&#x440;&#x430;&#x43a;&#x442;&#x435;&#x440;&#x438;&#x441;&#x442;&#x438;&#x43a;&#x438; &#x438; &#x43c;&#x435;&#x442;&#x43e;&#x434;&#x44b; &#x438;&#x441;&#x43f;&#x44b;&#x442;&#x430;&#x43d;&#x438;&#x439;&nbsp;&mdash; Часть&nbsp;1&ndash;3: &#x420;&#x438;&#x441;",
468
+ :docsubtitlepartlabel=>"Part&#xa0;1&#x2013;3",
469
+ :doctitle=>"&#x417;&#x435;&#x440;&#x43d;&#x43e;&#x432;&#x44b;&#x435; &#x438; &#x431;&#x43e;&#x431;&#x43e;&#x432;&#x44b;&#x435;&#xa0;&#x2014; &#x422;&#x435;&#x445;&#x43d;&#x438;&#x447;&#x435;&#x441;&#x43a;&#x438;&#x435; &#x445;&#x430;&#x440;&#x430;&#x43a;&#x442;&#x435;&#x440;&#x438;&#x441;&#x442;&#x438;&#x43a;&#x438; &#x438; &#x43c;&#x435;&#x442;&#x43e;&#x434;&#x44b; &#x438;&#x441;&#x43f;&#x44b;&#x442;&#x430;&#x43d;&#x438;&#x439;&#xa0;&#x2014; Часть&#xa0;1&#x2013;3: &#x420;&#x438;&#x441;",
524
470
  :doctitleintro=>"&#x417;&#x435;&#x440;&#x43d;&#x43e;&#x432;&#x44b;&#x435; &#x438; &#x431;&#x43e;&#x431;&#x43e;&#x432;&#x44b;&#x435;",
525
471
  :doctitlemain=>"&#x422;&#x435;&#x445;&#x43d;&#x438;&#x447;&#x435;&#x441;&#x43a;&#x438;&#x435; &#x445;&#x430;&#x440;&#x430;&#x43a;&#x442;&#x435;&#x440;&#x438;&#x441;&#x442;&#x438;&#x43a;&#x438; &#x438; &#x43c;&#x435;&#x442;&#x43e;&#x434;&#x44b; &#x438;&#x441;&#x43f;&#x44b;&#x442;&#x430;&#x43d;&#x438;&#x439;",
526
472
  :doctitlepart=>"&#x420;&#x438;&#x441;",
527
- :doctitlepartlabel=>"Часть&nbsp;1&ndash;3",
473
+ :doctitlepartlabel=>"Часть&#xa0;1&#x2013;3",
528
474
  :doctype=>"International Standard",
529
475
  :doctype_display=>"International Standard",
530
476
  :docyear=>"2016",
531
477
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
532
478
  :ics=>"1.2.3, 1.2.3",
533
- :implementeddate=>"XXX",
534
- :issueddate=>"XXX",
535
479
  :lang=>"ru",
536
- :obsoleteddate=>"XXX",
537
480
  :obsoletes=>"IEC 8121",
538
481
  :obsoletes_part=>"3.1",
539
- :publisheddate=>"XXX",
540
482
  :publisher=>"International Organization for Standardization &#x438; International Electrotechnical Commission",
541
- :receiveddate=>"XXX",
542
483
  :sc=>"DEF 4",
543
484
  :script=>"Latn",
544
- :secretariat=>"XXX",
545
485
  :stage=>"60",
546
486
  :stage_int=>60,
547
487
  :statusabbr=>"IS",
488
+ :substage_int=>"92",
548
489
  :tc=>"ABC 34",
549
490
  :tc_docnumber=>["17301"],
550
- :transmitteddate=>"XXX",
551
- :unchangeddate=>"XXX",
552
491
  :unpublished=>false,
553
- :updateddate=>"XXX",
554
- :vote_endeddate=>"XXX",
555
- :vote_starteddate=>"XXX",
556
492
  :wg=>"GHI 3"}
557
493
  OUTPUT
558
494
  expect(metadata(c.info(Nokogiri::XML(input),
559
495
  nil))).to be_equivalent_to output
560
496
  end
497
+
498
+ it "warns of missing Secretariat" do
499
+ input = <<~INPUT
500
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
501
+ <bibdata type="standard">
502
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
503
+ <status><stage abbreviation="CD">30</stage></status>
504
+ <date type="published">2000</date>
505
+ <ext>
506
+ <editorialgroup>
507
+ </editorialgroup>
508
+ </ext>
509
+ </bibdata>
510
+ <sections>
511
+ <clause>
512
+ <title>Clause 1</title>
513
+ </clause>
514
+ </sections>
515
+ </iso-standard>
516
+ INPUT
517
+ output = <<~OUTPUT
518
+ <sections>
519
+ <clause displayorder="1">
520
+ <title depth="1">
521
+ <review date="#{Date.today}" reviewer="Metanorma" id="_">
522
+ <p>
523
+ <strong>
524
+ Metadata warnings:
525
+ <strong/>
526
+ <p>Secretariat is missing.</p>
527
+ </strong>
528
+ </p>
529
+ </review>
530
+ Clause 1
531
+ </title>
532
+ </clause>
533
+ </sections>
534
+ OUTPUT
535
+ expect(xmlpp(strip_guid(Nokogiri::XML(
536
+ IsoDoc::Iso::PresentationXMLConvert.new({})
537
+ .convert("test", input, true),
538
+ )
539
+ .at("//xmlns:sections").to_xml)))
540
+ .to be_equivalent_to xmlpp(output)
541
+ end
542
+
543
+ it "warns of missing publication date" do
544
+ input = <<~INPUT
545
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
546
+ <bibdata type="standard">
547
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
548
+ <status><stage abbreviation="CD">30</stage></status>
549
+ <ext>
550
+ <editorialgroup>
551
+ </editorialgroup>
552
+ <secretariat>BSI</secretariat>
553
+ </ext>
554
+ </bibdata>
555
+ <sections>
556
+ <clause>
557
+ <title>Clause 1</title>
558
+ </clause>
559
+ </sections>
560
+ </iso-standard>
561
+ INPUT
562
+ output = <<~OUTPUT
563
+ <sections>
564
+ <clause displayorder="1">
565
+ <title depth="1">
566
+ <review date="#{Date.today}" reviewer="Metanorma" id="_">
567
+ <p>
568
+ <strong>
569
+ Metadata warnings:
570
+ <strong/>
571
+ <p>Document date is missing.</p>
572
+ </strong>
573
+ </p>
574
+ </review>
575
+ Clause 1
576
+ </title>
577
+ </clause>
578
+ </sections>
579
+ OUTPUT
580
+ expect(strip_guid(xmlpp(Nokogiri::XML(
581
+ IsoDoc::Iso::PresentationXMLConvert.new({})
582
+ .convert("test", input, true),
583
+ )
584
+ .at("//xmlns:sections")
585
+ .at("//xmlns:sections").to_xml)))
586
+ .to be_equivalent_to xmlpp(output)
587
+ end
588
+
589
+ it "warns of missing editorial groups" do
590
+ input = <<~INPUT
591
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
592
+ <bibdata type="standard">
593
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
594
+ <status><stage abbreviation="CD">30</stage></status>
595
+ <date type="published">2000</date>
596
+ <ext>
597
+ <secretariat>BSI</secretariat>
598
+ </ext>
599
+ </bibdata>
600
+ <sections>
601
+ <clause>
602
+ <title>Clause 1</title>
603
+ </clause>
604
+ </sections>
605
+ </iso-standard>
606
+ INPUT
607
+ output = <<~OUTPUT
608
+ <sections>
609
+ <clause displayorder="1">
610
+ <title depth="1">
611
+ <review date="#{Date.today}" reviewer="Metanorma" id="_">
612
+ <p>
613
+ <strong>
614
+ Metadata warnings:
615
+ <strong/>
616
+ <p>Editorial groups are missing.</p>
617
+ </strong>
618
+ </p>
619
+ </review>
620
+ Clause 1
621
+ </title>
622
+ </clause>
623
+ </sections>
624
+ OUTPUT
625
+ expect(strip_guid(xmlpp(Nokogiri::XML(
626
+ IsoDoc::Iso::PresentationXMLConvert.new({})
627
+ .convert("test", input, true),
628
+ )
629
+ .at("//xmlns:sections")
630
+ .at("//xmlns:sections").to_xml)))
631
+ .to be_equivalent_to xmlpp(output)
632
+ end
633
+
634
+ it "does not warn of missing metadata in compliant document" do
635
+ input = <<~INPUT
636
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
637
+ <bibdata type="standard">
638
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
639
+ <status><stage abbreviation="CD">30</stage></status>
640
+ <date type="published">2000</date>
641
+ <ext>
642
+ <editorialgroup>
643
+ </editorialgroup>
644
+ <secretariat>BSI</secretariat>
645
+ </ext>
646
+ </bibdata>
647
+ <sections>
648
+ <clause>
649
+ <title>Clause 1</title>
650
+ </clause>
651
+ </sections>
652
+ </iso-standard>
653
+ INPUT
654
+ output = <<~OUTPUT
655
+ <sections>
656
+ <clause displayorder='1'>
657
+ <title depth='1'>Clause 1</title>
658
+ </clause>
659
+ </sections>
660
+ OUTPUT
661
+ expect(strip_guid(xmlpp(Nokogiri::XML(
662
+ IsoDoc::Iso::PresentationXMLConvert.new({})
663
+ .convert("test", input, true),
664
+ )
665
+ .at("//xmlns:sections").to_xml)))
666
+ .to be_equivalent_to xmlpp(output)
667
+ end
668
+
669
+ it "does not warn of missing metadata in published document" do
670
+ input = <<~INPUT
671
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
672
+ <bibdata type="standard">
673
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
674
+ <status><stage abbreviation="CD">90</stage></status>
675
+ <ext>
676
+ <editorialgroup>
677
+ </editorialgroup>
678
+ <secretariat>BSI</secretariat>
679
+ </ext>
680
+ </bibdata>
681
+ <sections>
682
+ <clause>
683
+ <title>Clause 1</title>
684
+ </clause>
685
+ </sections>
686
+ </iso-standard>
687
+ INPUT
688
+ output = <<~OUTPUT
689
+ <sections>
690
+ <clause displayorder='1'>
691
+ <title depth='1'>Clause 1</title>
692
+ </clause>
693
+ </sections>
694
+ OUTPUT
695
+ expect(strip_guid(xmlpp(Nokogiri::XML(
696
+ IsoDoc::Iso::PresentationXMLConvert.new({})
697
+ .convert("test", input, true),
698
+ )
699
+ .at("//xmlns:sections").to_xml)))
700
+ .to be_equivalent_to xmlpp(output)
701
+ end
561
702
  end
@@ -30,11 +30,9 @@ RSpec.describe IsoDoc do
30
30
  .convert("test", <<~"INPUT", false)
31
31
  <iso-standard xmlns="http://riboseinc.com/isoxml">
32
32
  <bibdata>
33
- <title>
34
33
  <title format="text/plain" language="en" type="title-intro">Cereals and pulses</title>
35
34
  <title format="text/plain" language="en" type="title-main">Specifications and test methods</title>
36
35
  <title format="text/plain" language="en" type="title-part">Rice</title>
37
- </title>
38
36
  </bibdata>
39
37
  <preface>
40
38
  <foreword>
@@ -59,11 +57,9 @@ RSpec.describe IsoDoc do
59
57
  .convert("test", <<~"INPUT", false)
60
58
  <iso-standard xmlns="http://riboseinc.com/isoxml">
61
59
  <bibdata>
62
- <title>
63
60
  <title format="text/plain" language="en" type="title-intro">Cereals and pulses</title>
64
61
  <title format="text/plain" language="en" type="title-main">Specifications and test methods</title>
65
62
  <title format="text/plain" language="en" type="title-part">Rice</title>
66
- </title>
67
63
  </bibdata>
68
64
  <preface>
69
65
  <foreword>
@@ -381,6 +377,7 @@ RSpec.describe IsoDoc do
381
377
  word = File.read("test.doc", encoding: "UTF-8")
382
378
  .sub(/^.*An empty word intro page\./m, "")
383
379
  .sub(%r{</div>.*$}m, "</div>")
380
+ .gsub(/<o:p>&#xA0;<\/o:p>/, "")
384
381
 
385
382
  expect(xmlpp("<div>#{word.gsub(/_Toc\d\d+/, '_Toc')}"))
386
383
  .to be_equivalent_to xmlpp(<<~'OUTPUT')
@@ -486,7 +483,6 @@ RSpec.describe IsoDoc do
486
483
  <span style="mso-element:field-end"/>
487
484
  </span>
488
485
  <span lang="EN-GB" xml:lang="EN-GB">
489
- <p class="MsoNormal"> </p>
490
486
  </span>
491
487
  </p>
492
488
  <p class="MsoNormal"> </p>
@@ -848,6 +844,46 @@ RSpec.describe IsoDoc do
848
844
  OUTPUT
849
845
  end
850
846
 
847
+ it "processes editorial notes (Word)" do
848
+ IsoDoc::Iso::WordConvert
849
+ .new(WORD_HTML_CSS.dup)
850
+ .convert("test", <<~"INPUT", false)
851
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
852
+ <annex id="P" inline-header="false" obligation="normative">
853
+ <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="editorial">
854
+ <p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>
855
+ Only use paddy or parboiled rice for the
856
+ determination of husked rice yield.
857
+ </p>
858
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
859
+ </admonition>
860
+ </annex>
861
+ </iso-standard>
862
+ INPUT
863
+ word = File.read("test.doc", encoding: "UTF-8")
864
+ .sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
865
+ .sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
866
+ expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
867
+ <div class='WordSection3'>
868
+ <p class='zzSTDTitle1'/>
869
+ <p class='MsoNormal'>
870
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
871
+ </p>
872
+ <div class='Section3'>
873
+ <a name='P' id='P'/>
874
+ <div class='zzHelp'>
875
+ <a name='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a'/>
876
+ <p class='zzHelp'> Only use paddy or parboiled rice for the determination of husked rice yield. </p>
877
+ <p class='zzHelp'>
878
+ <a name='_e94663cc-2473-4ccc-9a72-983a74d989f3' id='_e94663cc-2473-4ccc-9a72-983a74d989f3'/>
879
+ Para 2.
880
+ </p>
881
+ </div>
882
+ </div>
883
+ </div>
884
+ OUTPUT
885
+ end
886
+
851
887
  it "processes boilerplate" do
852
888
  input = <<~INPUT
853
889
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -1030,7 +1066,8 @@ RSpec.describe IsoDoc do
1030
1066
  '<div class="WordSection2">')
1031
1067
  .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
1032
1068
 
1033
- expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc")))
1069
+ expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc")
1070
+ .gsub(/<o:p>&#xA0;<\/o:p>/, "")))
1034
1071
  .to be_equivalent_to xmlpp(<<~'OUTPUT')
1035
1072
  <div class="WordSection2">An empty word intro page.
1036
1073
  <p class="MsoToc1">
@@ -1110,7 +1147,6 @@ RSpec.describe IsoDoc do
1110
1147
  <span style="mso-element:field-end"/>
1111
1148
  </span>
1112
1149
  <span lang="EN-GB" xml:lang="EN-GB">
1113
- <p class="MsoNormal"> </p>
1114
1150
  </span>
1115
1151
  </p>
1116
1152
  <p class="MsoNormal"> </p>