metanorma-iso 2.1.1 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +145 -10
  3. data/lib/isodoc/iso/base_convert.rb +10 -0
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +173 -257
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +173 -249
  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 +6 -2
  17. data/lib/isodoc/iso/html_convert.rb +5 -0
  18. data/lib/isodoc/iso/i18n-en.yaml +32 -4
  19. data/lib/isodoc/iso/i18n-fr.yaml +29 -3
  20. data/lib/isodoc/iso/i18n-ru.yaml +32 -4
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
  22. data/lib/isodoc/iso/i18n.rb +1 -1
  23. data/lib/isodoc/iso/iso.amendment.xsl +750 -307
  24. data/lib/isodoc/iso/iso.international-standard.xsl +750 -307
  25. data/lib/isodoc/iso/metadata.rb +63 -63
  26. data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
  27. data/lib/isodoc/iso/presentation_xml_convert.rb +15 -4
  28. data/lib/isodoc/iso/presentation_xref.rb +8 -2
  29. data/lib/isodoc/iso/sections.rb +1 -1
  30. data/lib/isodoc/iso/word_cleanup.rb +3 -0
  31. data/lib/isodoc/iso/word_convert.rb +6 -3
  32. data/lib/isodoc/iso/word_dis_cleanup.rb +243 -0
  33. data/lib/isodoc/iso/word_dis_convert.rb +47 -108
  34. data/lib/isodoc/iso/xref.rb +34 -6
  35. data/lib/metanorma/iso/base.rb +14 -1
  36. data/lib/metanorma/iso/biblio.rng +134 -39
  37. data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
  38. data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
  39. data/lib/metanorma/iso/boilerplate.xml +3 -0
  40. data/lib/metanorma/iso/cleanup.rb +53 -13
  41. data/lib/metanorma/iso/front.rb +38 -6
  42. data/lib/metanorma/iso/front_id.rb +2 -0
  43. data/lib/metanorma/iso/isodoc.rng +32 -0
  44. data/lib/metanorma/iso/isostandard.rng +32 -12
  45. data/lib/metanorma/iso/validate_section.rb +0 -12
  46. data/lib/metanorma/iso/version.rb +1 -1
  47. data/spec/isodoc/amd_spec.rb +4 -30
  48. data/spec/isodoc/blocks_spec.rb +499 -2
  49. data/spec/isodoc/i18n_spec.rb +145 -80
  50. data/spec/isodoc/iso_spec.rb +50 -169
  51. data/spec/isodoc/metadata_spec.rb +223 -83
  52. data/spec/isodoc/postproc_spec.rb +41 -5
  53. data/spec/isodoc/section_spec.rb +9 -9
  54. data/spec/isodoc/word_dis_spec.rb +1332 -146
  55. data/spec/isodoc/xref_spec.rb +87 -13
  56. data/spec/metanorma/amd_spec.rb +39 -23
  57. data/spec/metanorma/base_spec.rb +174 -44
  58. data/spec/metanorma/blocks_spec.rb +21 -0
  59. data/spec/metanorma/cleanup_spec.rb +196 -196
  60. data/spec/metanorma/lists_spec.rb +2 -2
  61. data/spec/metanorma/section_spec.rb +2 -2
  62. data/spec/metanorma/validate_spec.rb +8 -19
  63. data/spec/spec_helper.rb +10 -7
  64. data/spec/vcr_cassettes/withdrawn_iso.yml +30 -30
  65. metadata +6 -8
  66. data/docs/asciiiso-syntax.adoc +0 -307
  67. data/docs/guidance.adoc +0 -487
  68. data/docs/navigation.adoc +0 -23
  69. data/docs/quickstart.adoc +0 -179
  70. 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,9 +99,7 @@ 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",
102
+ :approvalgroup=>["TC 34a", "SC 4a", "WG 3a"],
100
103
  :createddate=>"2010&#x2013;2011",
101
104
  :docnumber=>"ISO/PreCD3 17301-1",
102
105
  :docnumber_lang=>"ISO/PreCD3 17301-1 (E)",
@@ -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,10 @@ 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
+ <workgroup number="3" type="GHI">Rice Group</workgroup>
213
+ </approvalgroup>
221
214
  <ics><code>1.2.3</code></ics>
222
215
  <ics><code>1.2.3</code></ics>
223
216
  <structuredidentifier>
@@ -229,19 +222,11 @@ RSpec.describe IsoDoc::Iso::Metadata do
229
222
  </iso-standard>
230
223
  INPUT
231
224
  output = <<~OUTPUT
232
- {:accesseddate=>"XXX",
233
- :agency=>"ISO/IEC",
234
- :circulateddate=>"XXX",
235
- :confirmeddate=>"XXX",
236
- :copieddate=>"XXX",
237
- :createddate=>"XXX",
225
+ {:agency=>"ISO/IEC",
226
+ :approvalgroup=>["ABC 34", "GHI 3"],
238
227
  :docnumber=>"ISO/IEC/CD 17301-1-3",
239
228
  :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
240
229
  :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
241
- :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&#x2013;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
230
  :docsubtitlepartlabel=>"Partie&#xa0;1&#x2013;3",
246
231
  :doctitle=>"Cereals and pulses&#xa0;&#x2014; Specifications and test methods&#xa0;&#x2014; Part&#xa0;1&#x2013;3: Rice",
247
232
  :doctitleintro=>"Cereals and pulses",
@@ -253,29 +238,19 @@ RSpec.describe IsoDoc::Iso::Metadata do
253
238
  :docyear=>"2016",
254
239
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
255
240
  :ics=>"1.2.3, 1.2.3",
256
- :implementeddate=>"XXX",
257
- :issueddate=>"XXX",
258
241
  :lang=>"en",
259
- :obsoleteddate=>"XXX",
260
242
  :obsoletes=>"IEC 8121",
261
243
  :obsoletes_part=>"3.1",
262
- :publisheddate=>"XXX",
263
244
  :publisher=>"International Organization for Standardization and International Electrotechnical Commission",
264
- :receiveddate=>"XXX",
265
245
  :sc=>"DEF 4",
266
246
  :script=>"Latn",
267
- :secretariat=>"XXX",
268
247
  :stage=>"60",
269
248
  :stage_int=>60,
270
249
  :statusabbr=>"IS",
250
+ :substage_int=>"92",
271
251
  :tc=>"ABC 34",
272
252
  :tc_docnumber=>["17301"],
273
- :transmitteddate=>"XXX",
274
- :unchangeddate=>"XXX",
275
253
  :unpublished=>false,
276
- :updateddate=>"XXX",
277
- :vote_endeddate=>"XXX",
278
- :vote_starteddate=>"XXX",
279
254
  :wg=>"GHI 3"}
280
255
  OUTPUT
281
256
  expect(metadata(c.info(Nokogiri::XML(input),
@@ -294,16 +269,12 @@ RSpec.describe IsoDoc::Iso::Metadata do
294
269
  input = <<~INPUT
295
270
  <iso-standard xmlns="http://riboseinc.com/isoxml">
296
271
  <bibdata type="standard">
297
- <title>
298
272
  <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
299
273
  <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
300
274
  <title type="title-part" language="en" format="text/plain">Rice</title>
301
- </title>
302
- <title>
303
275
  <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
304
276
  <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
305
277
  <title type="title-part" language="fr" format="text/plain">Riz</title>
306
- </title>
307
278
  <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
308
279
  <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
309
280
  <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
@@ -365,12 +336,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
365
336
  </iso-standard>
366
337
  INPUT
367
338
  output = <<~OUTPUT
368
- {:accesseddate=>"XXX",
369
- :agency=>"ISO/IEC",
370
- :circulateddate=>"XXX",
371
- :confirmeddate=>"XXX",
372
- :copieddate=>"XXX",
373
- :createddate=>"XXX",
339
+ {:agency=>"ISO/IEC",
374
340
  :docnumber=>"ISO/IEC/CD 17301-1-3",
375
341
  :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
376
342
  :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
@@ -389,29 +355,19 @@ RSpec.describe IsoDoc::Iso::Metadata do
389
355
  :docyear=>"2016",
390
356
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
391
357
  :ics=>"1.2.3, 1.2.3",
392
- :implementeddate=>"XXX",
393
- :issueddate=>"XXX",
394
358
  :lang=>"fr",
395
- :obsoleteddate=>"XXX",
396
359
  :obsoletes=>"IEC 8121",
397
360
  :obsoletes_part=>"3.1",
398
- :publisheddate=>"XXX",
399
361
  :publisher=>"International Organization for Standardization et International Electrotechnical Commission",
400
- :receiveddate=>"XXX",
401
362
  :sc=>"DEF 4",
402
363
  :script=>"Latn",
403
- :secretariat=>"XXX",
404
364
  :stage=>"60",
405
365
  :stage_int=>60,
406
366
  :statusabbr=>"IS",
367
+ :substage_int=>"92",
407
368
  :tc=>"ABC 34",
408
369
  :tc_docnumber=>["17301"],
409
- :transmitteddate=>"XXX",
410
- :unchangeddate=>"XXX",
411
370
  :unpublished=>false,
412
- :updateddate=>"XXX",
413
- :vote_endeddate=>"XXX",
414
- :vote_starteddate=>"XXX",
415
371
  :wg=>"GHI 3"}
416
372
  OUTPUT
417
373
  expect(metadata(c.info(Nokogiri::XML(input),
@@ -430,21 +386,15 @@ RSpec.describe IsoDoc::Iso::Metadata do
430
386
  input = <<~INPUT
431
387
  <iso-standard xmlns="http://riboseinc.com/isoxml">
432
388
  <bibdata type="standard">
433
- <title>
434
389
  <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
435
390
  <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
436
391
  <title type="title-part" language="en" format="text/plain">Rice</title>
437
- </title>
438
- <title>
439
392
  <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
440
393
  <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
441
394
  <title type="title-part" language="fr" format="text/plain">Riz</title>
442
- </title>
443
- <title>
444
395
  <title type="title-intro" language="ru" format="text/plain">Зерновые и бобовые</title>
445
396
  <title type="title-main" language="ru" format="text/plain">Технические характеристики и методы испытаний</title>
446
397
  <title type="title-part" language="ru" format="text/plain">Рис</title>
447
- </title>
448
398
  <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
449
399
  <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
450
400
  <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
@@ -506,12 +456,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
506
456
  </iso-standard>
507
457
  INPUT
508
458
  output = <<~OUTPUT
509
- {:accesseddate=>"XXX",
510
- :agency=>"ISO/IEC",
511
- :circulateddate=>"XXX",
512
- :confirmeddate=>"XXX",
513
- :copieddate=>"XXX",
514
- :createddate=>"XXX",
459
+ {:agency=>"ISO/IEC",
515
460
  :docnumber=>"ISO/IEC/CD 17301-1-3",
516
461
  :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
517
462
  :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
@@ -530,32 +475,227 @@ RSpec.describe IsoDoc::Iso::Metadata do
530
475
  :docyear=>"2016",
531
476
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
532
477
  :ics=>"1.2.3, 1.2.3",
533
- :implementeddate=>"XXX",
534
- :issueddate=>"XXX",
535
478
  :lang=>"ru",
536
- :obsoleteddate=>"XXX",
537
479
  :obsoletes=>"IEC 8121",
538
480
  :obsoletes_part=>"3.1",
539
- :publisheddate=>"XXX",
540
481
  :publisher=>"International Organization for Standardization &#x438; International Electrotechnical Commission",
541
- :receiveddate=>"XXX",
542
482
  :sc=>"DEF 4",
543
483
  :script=>"Latn",
544
- :secretariat=>"XXX",
545
484
  :stage=>"60",
546
485
  :stage_int=>60,
547
486
  :statusabbr=>"IS",
487
+ :substage_int=>"92",
548
488
  :tc=>"ABC 34",
549
489
  :tc_docnumber=>["17301"],
550
- :transmitteddate=>"XXX",
551
- :unchangeddate=>"XXX",
552
490
  :unpublished=>false,
553
- :updateddate=>"XXX",
554
- :vote_endeddate=>"XXX",
555
- :vote_starteddate=>"XXX",
556
491
  :wg=>"GHI 3"}
557
492
  OUTPUT
558
493
  expect(metadata(c.info(Nokogiri::XML(input),
559
494
  nil))).to be_equivalent_to output
560
495
  end
496
+
497
+ it "warns of missing Secretariat" do
498
+ input = <<~INPUT
499
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
500
+ <bibdata type="standard">
501
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
502
+ <status><stage abbreviation="CD">30</stage></status>
503
+ <date type="published">2000</date>
504
+ <ext>
505
+ <editorialgroup>
506
+ </editorialgroup>
507
+ </ext>
508
+ </bibdata>
509
+ <sections>
510
+ <clause>
511
+ <title>Clause 1</title>
512
+ </clause>
513
+ </sections>
514
+ </iso-standard>
515
+ INPUT
516
+ output = <<~OUTPUT
517
+ <sections>
518
+ <clause displayorder="1">
519
+ <title depth="1">
520
+ <review date="#{Date.today}" reviewer="Metanorma" id="_">
521
+ <p>
522
+ <strong>
523
+ Metadata warnings:
524
+ <strong/>
525
+ <p>Secretariat is missing.</p>
526
+ </strong>
527
+ </p>
528
+ </review>
529
+ Clause 1
530
+ </title>
531
+ </clause>
532
+ </sections>
533
+ OUTPUT
534
+ expect(xmlpp(strip_guid(Nokogiri::XML(
535
+ IsoDoc::Iso::PresentationXMLConvert.new({})
536
+ .convert("test", input, true),
537
+ )
538
+ .at("//xmlns:sections").to_xml)))
539
+ .to be_equivalent_to xmlpp(output)
540
+ end
541
+
542
+ it "warns of missing publication date" do
543
+ input = <<~INPUT
544
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
545
+ <bibdata type="standard">
546
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
547
+ <status><stage abbreviation="CD">30</stage></status>
548
+ <ext>
549
+ <editorialgroup>
550
+ </editorialgroup>
551
+ <secretariat>BSI</secretariat>
552
+ </ext>
553
+ </bibdata>
554
+ <sections>
555
+ <clause>
556
+ <title>Clause 1</title>
557
+ </clause>
558
+ </sections>
559
+ </iso-standard>
560
+ INPUT
561
+ output = <<~OUTPUT
562
+ <sections>
563
+ <clause displayorder="1">
564
+ <title depth="1">
565
+ <review date="#{Date.today}" reviewer="Metanorma" id="_">
566
+ <p>
567
+ <strong>
568
+ Metadata warnings:
569
+ <strong/>
570
+ <p>Document date is missing.</p>
571
+ </strong>
572
+ </p>
573
+ </review>
574
+ Clause 1
575
+ </title>
576
+ </clause>
577
+ </sections>
578
+ OUTPUT
579
+ expect(strip_guid(xmlpp(Nokogiri::XML(
580
+ IsoDoc::Iso::PresentationXMLConvert.new({})
581
+ .convert("test", input, true),
582
+ )
583
+ .at("//xmlns:sections")
584
+ .at("//xmlns:sections").to_xml)))
585
+ .to be_equivalent_to xmlpp(output)
586
+ end
587
+
588
+ it "warns of missing editorial groups" do
589
+ input = <<~INPUT
590
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
591
+ <bibdata type="standard">
592
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
593
+ <status><stage abbreviation="CD">30</stage></status>
594
+ <date type="published">2000</date>
595
+ <ext>
596
+ <secretariat>BSI</secretariat>
597
+ </ext>
598
+ </bibdata>
599
+ <sections>
600
+ <clause>
601
+ <title>Clause 1</title>
602
+ </clause>
603
+ </sections>
604
+ </iso-standard>
605
+ INPUT
606
+ output = <<~OUTPUT
607
+ <sections>
608
+ <clause displayorder="1">
609
+ <title depth="1">
610
+ <review date="#{Date.today}" reviewer="Metanorma" id="_">
611
+ <p>
612
+ <strong>
613
+ Metadata warnings:
614
+ <strong/>
615
+ <p>Editorial groups are missing.</p>
616
+ </strong>
617
+ </p>
618
+ </review>
619
+ Clause 1
620
+ </title>
621
+ </clause>
622
+ </sections>
623
+ OUTPUT
624
+ expect(strip_guid(xmlpp(Nokogiri::XML(
625
+ IsoDoc::Iso::PresentationXMLConvert.new({})
626
+ .convert("test", input, true),
627
+ )
628
+ .at("//xmlns:sections")
629
+ .at("//xmlns:sections").to_xml)))
630
+ .to be_equivalent_to xmlpp(output)
631
+ end
632
+
633
+ it "does not warn of missing metadata in compliant document" do
634
+ input = <<~INPUT
635
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
636
+ <bibdata type="standard">
637
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
638
+ <status><stage abbreviation="CD">30</stage></status>
639
+ <date type="published">2000</date>
640
+ <ext>
641
+ <editorialgroup>
642
+ </editorialgroup>
643
+ <secretariat>BSI</secretariat>
644
+ </ext>
645
+ </bibdata>
646
+ <sections>
647
+ <clause>
648
+ <title>Clause 1</title>
649
+ </clause>
650
+ </sections>
651
+ </iso-standard>
652
+ INPUT
653
+ output = <<~OUTPUT
654
+ <sections>
655
+ <clause displayorder='1'>
656
+ <title depth='1'>Clause 1</title>
657
+ </clause>
658
+ </sections>
659
+ OUTPUT
660
+ expect(strip_guid(xmlpp(Nokogiri::XML(
661
+ IsoDoc::Iso::PresentationXMLConvert.new({})
662
+ .convert("test", input, true),
663
+ )
664
+ .at("//xmlns:sections").to_xml)))
665
+ .to be_equivalent_to xmlpp(output)
666
+ end
667
+
668
+ it "does not warn of missing metadata in published document" do
669
+ input = <<~INPUT
670
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
671
+ <bibdata type="standard">
672
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
673
+ <status><stage abbreviation="CD">90</stage></status>
674
+ <ext>
675
+ <editorialgroup>
676
+ </editorialgroup>
677
+ <secretariat>BSI</secretariat>
678
+ </ext>
679
+ </bibdata>
680
+ <sections>
681
+ <clause>
682
+ <title>Clause 1</title>
683
+ </clause>
684
+ </sections>
685
+ </iso-standard>
686
+ INPUT
687
+ output = <<~OUTPUT
688
+ <sections>
689
+ <clause displayorder='1'>
690
+ <title depth='1'>Clause 1</title>
691
+ </clause>
692
+ </sections>
693
+ OUTPUT
694
+ expect(strip_guid(xmlpp(Nokogiri::XML(
695
+ IsoDoc::Iso::PresentationXMLConvert.new({})
696
+ .convert("test", input, true),
697
+ )
698
+ .at("//xmlns:sections").to_xml)))
699
+ .to be_equivalent_to xmlpp(output)
700
+ end
561
701
  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,7 +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>")
384
- .gsub(/<o:p>&#xA0;<\/o:p>/, "")
380
+ .gsub(/<o:p>&#xA0;<\/o:p>/, "")
385
381
 
386
382
  expect(xmlpp("<div>#{word.gsub(/_Toc\d\d+/, '_Toc')}"))
387
383
  .to be_equivalent_to xmlpp(<<~'OUTPUT')
@@ -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">
@@ -526,7 +526,7 @@ RSpec.describe IsoDoc do
526
526
 
527
527
  it "processes multiple terms & definitions sections" do
528
528
  input = <<~INPUT
529
- #{BLANK_HDR.sub(%r{<doctype>article</doctype>}, '<doctype>article</doctype><subdoctype>vocabulary</subdoctype>')}
529
+ #{BLANK_HDR.sub(%r{<doctype>standard</doctype>}, '<doctype>standard</doctype><subdoctype>vocabulary</subdoctype>')}
530
530
  <sections>
531
531
  <terms id='A' obligation='normative'>
532
532
  <title>Terms and definitions</title>
@@ -561,8 +561,7 @@ RSpec.describe IsoDoc do
561
561
  <language current='true'>en</language>
562
562
  <script current='true'>Latn</script>
563
563
  <status>
564
- <stage abbreviation='IS' language=''>60</stage>
565
- <stage abbreviation='IS' language='en'>International standard</stage>
564
+ <stage abbreviation='IS'>60</stage>
566
565
  <substage>60</substage>
567
566
  </status>
568
567
  <copyright>
@@ -575,13 +574,14 @@ RSpec.describe IsoDoc do
575
574
  </owner>
576
575
  </copyright>
577
576
  <ext>
578
- <doctype>article</doctype>
577
+ <doctype>standard</doctype>
579
578
  <subdoctype>vocabulary</subdoctype>
580
- <editorialgroup>
581
- <technical-committee/>
582
- <subcommittee/>
583
- <workgroup/>
579
+ <editorialgroup identifier='ISO'>
580
+ <agency>ISO</agency>
584
581
  </editorialgroup>
582
+ <approvalgroup identifier='ISO'>
583
+ <agency>ISO</agency>
584
+ </approvalgroup>
585
585
  <stagename>International standard</stagename>
586
586
  </ext>
587
587
  </bibdata>
@@ -708,7 +708,7 @@ RSpec.describe IsoDoc do
708
708
  </div>
709
709
  <p><br clear="all" class="section"/></p>
710
710
  <div class="WordSection3">
711
- <p class="zzSTDTitle1"/>
711
+ <p class="zzSTDTitle"/>
712
712
  </div>
713
713
  <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
714
714
  <div class="colophon"/>