metanorma-iso 2.0.8.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +169 -0
  3. data/lib/isodoc/iso/base_convert.rb +11 -1
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +7 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +407 -427
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +482 -438
  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 +3 -1
  14. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +26 -13
  15. data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
  16. data/lib/isodoc/iso/html/word_iso_titlepage.html +16 -6
  17. data/lib/isodoc/iso/html/wordstyle-dis.css +168 -48
  18. data/lib/isodoc/iso/html/wordstyle-dis.scss +158 -43
  19. data/lib/isodoc/iso/html_convert.rb +7 -2
  20. data/lib/isodoc/iso/i18n-en.yaml +33 -4
  21. data/lib/isodoc/iso/i18n-fr.yaml +30 -3
  22. data/lib/isodoc/iso/i18n-ru.yaml +33 -4
  23. data/lib/isodoc/iso/i18n-zh-Hans.yaml +33 -3
  24. data/lib/isodoc/iso/i18n.rb +1 -1
  25. data/lib/isodoc/iso/init.rb +17 -1
  26. data/lib/isodoc/iso/iso.amendment.xsl +1711 -367
  27. data/lib/isodoc/iso/iso.international-standard.xsl +1711 -367
  28. data/lib/isodoc/iso/metadata.rb +72 -78
  29. data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
  30. data/lib/isodoc/iso/presentation_xml_convert.rb +52 -100
  31. data/lib/isodoc/iso/presentation_xref.rb +132 -0
  32. data/lib/isodoc/iso/sections.rb +3 -3
  33. data/lib/isodoc/iso/word_cleanup.rb +17 -0
  34. data/lib/isodoc/iso/word_convert.rb +32 -12
  35. data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
  36. data/lib/isodoc/iso/word_dis_convert.rb +122 -0
  37. data/lib/isodoc/iso/xref.rb +78 -29
  38. data/lib/metanorma/iso/base.rb +20 -1
  39. data/lib/metanorma/iso/biblio.rng +69 -42
  40. data/lib/metanorma/iso/boilerplate-fr.xml +4 -1
  41. data/lib/metanorma/iso/boilerplate-ru.xml +4 -3
  42. data/lib/metanorma/iso/boilerplate.xml +4 -3
  43. data/lib/metanorma/iso/cleanup.rb +29 -1
  44. data/lib/metanorma/iso/front.rb +31 -6
  45. data/lib/metanorma/iso/front_id.rb +2 -0
  46. data/lib/metanorma/iso/isodoc.rng +65 -0
  47. data/lib/metanorma/iso/isostandard.rng +30 -12
  48. data/lib/metanorma/iso/macros.rb +29 -0
  49. data/lib/metanorma/iso/version.rb +1 -1
  50. data/lib/metanorma-iso.rb +1 -0
  51. data/lib/relaton/render/config.yml +4 -0
  52. data/lib/relaton/render/general.rb +13 -0
  53. data/metanorma-iso.gemspec +1 -1
  54. data/spec/isodoc/amd_spec.rb +35 -60
  55. data/spec/isodoc/blocks_spec.rb +783 -179
  56. data/spec/isodoc/i18n_spec.rb +331 -100
  57. data/spec/isodoc/inline_spec.rb +35 -42
  58. data/spec/isodoc/iso_spec.rb +51 -170
  59. data/spec/isodoc/metadata_spec.rb +240 -99
  60. data/spec/isodoc/postproc_spec.rb +68 -7
  61. data/spec/isodoc/ref_spec.rb +66 -69
  62. data/spec/isodoc/section_spec.rb +88 -80
  63. data/spec/isodoc/table_spec.rb +2 -2
  64. data/spec/isodoc/terms_spec.rb +2 -2
  65. data/spec/isodoc/word_dis_spec.rb +1886 -0
  66. data/spec/isodoc/xref_spec.rb +138 -64
  67. data/spec/metanorma/amd_spec.rb +53 -1
  68. data/spec/metanorma/base_spec.rb +195 -20
  69. data/spec/metanorma/blocks_spec.rb +54 -0
  70. data/spec/metanorma/lists_spec.rb +2 -2
  71. data/spec/metanorma/section_spec.rb +2 -2
  72. data/spec/spec_helper.rb +23 -4
  73. data/spec/vcr_cassettes/withdrawn_iso.yml +25 -25
  74. metadata +15 -10
  75. data/docs/asciiiso-syntax.adoc +0 -307
  76. data/docs/guidance.adoc +0 -487
  77. data/docs/navigation.adoc +0 -23
  78. data/docs/quickstart.adoc +0 -179
  79. data/spec/vcr_cassettes/docrels.yml +0 -385
@@ -37,6 +37,25 @@ RSpec.describe Metanorma::ISO do
37
37
  :workgroup-number_2: 31
38
38
  :workgroup-type_2: C1
39
39
  :secretariat: SECRETARIAT
40
+ :approval-technical-committee: TCa
41
+ :approval-technical-committee-number: 1a
42
+ :approval-technical-committee-type: Aa
43
+ :approval-subcommittee: SCa
44
+ :approval-subcommittee-number: 2a
45
+ :approval-subcommittee-type: Ba
46
+ :approval-workgroup: WGa
47
+ :approval-workgroup-number: 3a
48
+ :approval-workgroup-type: Ca
49
+ :approval-technical-committee_2: TC1a
50
+ :approval-technical-committee-number_2: 11a
51
+ :approval-technical-committee-type_2: A1a
52
+ :approval-subcommittee_2: SC1a
53
+ :approval-subcommittee-number_2: 21a
54
+ :approval-subcommittee-type_2: B1a
55
+ :approval-workgroup_2: WG1a
56
+ :approval-workgroup-number_2: 31a
57
+ :approval-workgroup-type_2: C1a
58
+ :approval-agency: ISO/IEC
40
59
  :docstage: 20
41
60
  :docsubstage: 20
42
61
  :iteration: 3
@@ -105,9 +124,10 @@ RSpec.describe Metanorma::ISO do
105
124
  </owner>
106
125
  </copyright>
107
126
  <ext>
108
- <doctype>article</doctype>
127
+ <doctype>standard</doctype>
109
128
  <horizontal>true</horizontal>
110
129
  <editorialgroup>
130
+ <agency>ISO</agency>
111
131
  <technical-committee number="1" type="A">TC</technical-committee>
112
132
  <technical-committee number="11" type="A1">TC1</technical-committee>
113
133
  <subcommittee number="2" type="B">SC</subcommittee>
@@ -116,6 +136,16 @@ RSpec.describe Metanorma::ISO do
116
136
  <workgroup number="31" type="C1">WG1</workgroup>
117
137
  <secretariat>SECRETARIAT</secretariat>
118
138
  </editorialgroup>
139
+ <approvalgroup>
140
+ <agency>ISO</agency>
141
+ <agency>IEC</agency>
142
+ <technical-committee number="1a" type="Aa">TCa</technical-committee>
143
+ <technical-committee number="11a" type="A1a">TC1a</technical-committee>
144
+ <subcommittee number="2a" type="Ba">SCa</subcommittee>
145
+ <subcommittee number="21a" type="B1a">SC1a</subcommittee>
146
+ <workgroup number="3a" type="Ca">WGa</workgroup>
147
+ <workgroup number="31a" type="C1a">WG1a</workgroup>
148
+ </approvalgroup>
119
149
  <ics>
120
150
  <code>1</code>
121
151
  </ics>
@@ -150,7 +180,7 @@ RSpec.describe Metanorma::ISO do
150
180
  :language: el
151
181
  :script: Grek
152
182
  :publisher: IEC;IETF;ISO
153
- :copyright-holder: ISO;IETF
183
+ :copyright-holder: IETF;ISO
154
184
  :copyright-year: 2001
155
185
  :doctype: technical-report
156
186
  :pub-address: 1 Infinity Loop + \
@@ -161,16 +191,25 @@ RSpec.describe Metanorma::ISO do
161
191
  :pub-uri: http://www.example.com
162
192
  :docstage:
163
193
  :docsubstage:
194
+ :technical-committee: TC
195
+ :technical-committee-number: 1
196
+ :technical-committee-type: A
197
+ :subcommittee: SC
198
+ :subcommittee-number: 2
199
+ :subcommittee-type: B
200
+ :workgroup: WG
201
+ :workgroup-number: 3
202
+ :workgroup-type: C
164
203
  INPUT
165
204
  expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
166
205
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
167
206
  <?xml version="1.0" encoding="UTF-8"?>
168
207
  <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
169
208
  <bibdata type="standard">
170
- <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
171
- <docidentifier type='iso-undated'>ISO/IEC/IETF/TR 1000-1-1</docidentifier>
172
- <docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
173
- <docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
209
+ <docidentifier type='ISO'>IEC/IETF/ISO/TR 1000-1-1:2001</docidentifier>
210
+ <docidentifier type='iso-undated'>IEC/IETF/ISO/TR 1000-1-1</docidentifier>
211
+ <docidentifier type='iso-with-lang'>IEC/IETF/ISO/TR 1000-1-1:2001(X)</docidentifier>
212
+ <docidentifier type='iso-reference'>IEC/IETF/ISO/TR 1000-1-1:2001(X)</docidentifier>
174
213
  <docidentifier type="iso-tc">2000</docidentifier>
175
214
  <docidentifier type="iso-tc">2003</docidentifier>
176
215
  <docnumber>1000</docnumber>
@@ -245,8 +284,7 @@ RSpec.describe Metanorma::ISO do
245
284
  <from>2001</from>
246
285
  <owner>
247
286
  <organization>
248
- <name>International Organization for Standardization</name>
249
- <abbreviation>ISO</abbreviation>
287
+ <name>IETF</name>
250
288
  <address>
251
289
  <formattedAddress>1 Infinity Loop + California</formattedAddress>
252
290
  </address>
@@ -257,11 +295,12 @@ RSpec.describe Metanorma::ISO do
257
295
  </organization>
258
296
  </owner>
259
297
  </copyright>
260
- <copyright>
298
+ <copyright>
261
299
  <from>2001</from>
262
300
  <owner>
263
301
  <organization>
264
- <name>IETF</name>
302
+ <name>International Organization for Standardization</name>
303
+ <abbreviation>ISO</abbreviation>
265
304
  <address>
266
305
  <formattedAddress>1 Infinity Loop + California</formattedAddress>
267
306
  </address>
@@ -274,13 +313,22 @@ RSpec.describe Metanorma::ISO do
274
313
  </copyright>
275
314
  <ext>
276
315
  <doctype>technical-report</doctype>
277
- <editorialgroup>
278
- <technical-committee/>
279
- <subcommittee/>
280
- <workgroup/>
281
- </editorialgroup>
316
+ <editorialgroup>
317
+ <agency>IEC</agency>
318
+ <agency>IETF</agency>
319
+ <agency>ISO</agency>
320
+ <technical-committee number='1' type='A'>TC</technical-committee>
321
+ <subcommittee number='2' type='B'>SC</subcommittee>
322
+ <workgroup number='3' type='C'>WG</workgroup>
323
+ </editorialgroup>
324
+ <approvalgroup>
325
+ <agency>ISO</agency>
326
+ <technical-committee number='1' type='A'>TC</technical-committee>
327
+ <subcommittee number='2' type='B'>SC</subcommittee>
328
+ <workgroup number='3' type='C'>WG</workgroup>
329
+ </approvalgroup>
282
330
  <structuredidentifier>
283
- <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
331
+ <project-number part="1" subpart="1">IEC/IETF/ISO 1000</project-number>
284
332
  </structuredidentifier>
285
333
  <stagename>International standard</stagename>
286
334
  </ext>
@@ -290,6 +338,84 @@ RSpec.describe Metanorma::ISO do
290
338
  OUTPUT
291
339
  end
292
340
 
341
+ it "processes tech specification identifier" do
342
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
343
+ = Document title
344
+ Author
345
+ :docfile: test.adoc
346
+ :nodoc:
347
+ :novalid:
348
+ :no-isobib:
349
+ :docnumber: 1000
350
+ :partnumber: 1-1
351
+ :copyright-year: 2001
352
+ :doctype: technical-specification
353
+ :docstage: 50
354
+ :docsubstage:
355
+ INPUT
356
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
357
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
358
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type='semantic' version="#{Metanorma::ISO::VERSION}">
359
+ <bibdata type='standard'>
360
+ <docidentifier type='ISO'>ISO/FDTS 1000-1-1</docidentifier>
361
+ <docidentifier type='iso-undated'>ISO/FDTS 1000-1-1</docidentifier>
362
+ <docidentifier type='iso-with-lang'>ISO/FDTS 1000-1-1(E)</docidentifier>
363
+ <docidentifier type='iso-reference'>ISO/FDTS 1000-1-1:2001(E)</docidentifier>
364
+ <docnumber>1000</docnumber>
365
+ <contributor>
366
+ <role type='author'/>
367
+ <organization>
368
+ <name>International Organization for Standardization</name>
369
+ <abbreviation>ISO</abbreviation>
370
+ </organization>
371
+ </contributor>
372
+ <contributor>
373
+ <role type='publisher'/>
374
+ <organization>
375
+ <name>International Organization for Standardization</name>
376
+ <abbreviation>ISO</abbreviation>
377
+ </organization>
378
+ </contributor>
379
+ <language>en</language>
380
+ <script>Latn</script>
381
+ <status>
382
+ <stage abbreviation='FDTS TS'>50</stage>
383
+ <substage>00</substage>
384
+ </status>
385
+ <copyright>
386
+ <from>2001</from>
387
+ <owner>
388
+ <organization>
389
+ <name>International Organization for Standardization</name>
390
+ <abbreviation>ISO</abbreviation>
391
+ </organization>
392
+ </owner>
393
+ </copyright>
394
+ <ext>
395
+ <doctype>technical-specification</doctype>
396
+ <editorialgroup>
397
+ <agency>ISO</agency>
398
+ <technical-committee/>
399
+ <subcommittee/>
400
+ <workgroup/>
401
+ </editorialgroup>
402
+ <approvalgroup>
403
+ <agency>ISO</agency>
404
+ <technical-committee/>
405
+ <subcommittee/>
406
+ <workgroup/>
407
+ </approvalgroup>
408
+ <structuredidentifier>
409
+ <project-number part='1' subpart='1'>ISO 1000</project-number>
410
+ </structuredidentifier>
411
+ <stagename>Final draft</stagename>
412
+ </ext>
413
+ </bibdata>
414
+ <sections> </sections>
415
+ </iso-standard>
416
+ OUTPUT
417
+ end
418
+
293
419
  it "processes Russian titles" do
294
420
  output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
295
421
  = Document title
@@ -381,13 +507,20 @@ RSpec.describe Metanorma::ISO do
381
507
  </owner>
382
508
  </copyright>
383
509
  <ext>
384
- <doctype>article</doctype>
510
+ <doctype>standard</doctype>
385
511
  <horizontal>true</horizontal>
386
512
  <editorialgroup>
513
+ <agency>ISO</agency>
387
514
  <technical-committee/>
388
515
  <subcommittee/>
389
516
  <workgroup/>
390
517
  </editorialgroup>
518
+ <approvalgroup>
519
+ <agency>ISO</agency>
520
+ <technical-committee/>
521
+ <subcommittee/>
522
+ <workgroup/>
523
+ </approvalgroup>
391
524
  <structuredidentifier>
392
525
  <project-number part='1'>ISO 1000</project-number>
393
526
  </structuredidentifier>
@@ -491,10 +624,17 @@ RSpec.describe Metanorma::ISO do
491
624
  <ext>
492
625
  <doctype>this-is-a-doctype</doctype>
493
626
  <editorialgroup>
627
+ <agency>SD</agency>
494
628
  <technical-committee/>
495
629
  <subcommittee/>
496
630
  <workgroup/>
497
631
  </editorialgroup>
632
+ <approvalgroup>
633
+ <agency>ISO</agency>
634
+ <technical-committee/>
635
+ <subcommittee/>
636
+ <workgroup/>
637
+ </approvalgroup>
498
638
  <structuredidentifier>
499
639
  <project-number part="1" subpart="1">SD 1000</project-number>
500
640
  </structuredidentifier>
@@ -562,10 +702,17 @@ RSpec.describe Metanorma::ISO do
562
702
  <ext>
563
703
  <doctype>international-standard</doctype>
564
704
  <editorialgroup>
705
+ <agency>ISO</agency>
565
706
  <technical-committee/>
566
707
  <subcommittee/>
567
708
  <workgroup/>
568
709
  </editorialgroup>
710
+ <approvalgroup>
711
+ <agency>ISO</agency>
712
+ <technical-committee/>
713
+ <subcommittee/>
714
+ <workgroup/>
715
+ </approvalgroup>
569
716
  <structuredidentifier>
570
717
  <project-number>ISO 1000</project-number>
571
718
  </structuredidentifier>
@@ -629,12 +776,19 @@ RSpec.describe Metanorma::ISO do
629
776
  </owner>
630
777
  </copyright>
631
778
  <ext>
632
- <doctype>article</doctype>
779
+ <doctype>standard</doctype>
633
780
  <editorialgroup>
781
+ <agency>ISO</agency>
634
782
  <technical-committee/>
635
783
  <subcommittee/>
636
784
  <workgroup/>
637
785
  </editorialgroup>
786
+ <approvalgroup>
787
+ <agency>ISO</agency>
788
+ <technical-committee/>
789
+ <subcommittee/>
790
+ <workgroup/>
791
+ </approvalgroup>
638
792
  <structuredidentifier>
639
793
  <project-number>ISO 1000</project-number>
640
794
  </structuredidentifier>
@@ -698,12 +852,19 @@ RSpec.describe Metanorma::ISO do
698
852
  </owner>
699
853
  </copyright>
700
854
  <ext>
701
- <doctype>article</doctype>
855
+ <doctype>standard</doctype>
702
856
  <editorialgroup>
857
+ <agency>ISO</agency>
703
858
  <technical-committee/>
704
859
  <subcommittee/>
705
860
  <workgroup/>
706
861
  </editorialgroup>
862
+ <approvalgroup>
863
+ <agency>ISO</agency>
864
+ <technical-committee/>
865
+ <subcommittee/>
866
+ <workgroup/>
867
+ </approvalgroup>
707
868
  <structuredidentifier>
708
869
  <project-number>ISO 1000</project-number>
709
870
  </structuredidentifier>
@@ -768,10 +929,17 @@ RSpec.describe Metanorma::ISO do
768
929
  <ext>
769
930
  <doctype>directive</doctype>
770
931
  <editorialgroup>
932
+ <agency>ISO</agency>
771
933
  <technical-committee/>
772
934
  <subcommittee/>
773
935
  <workgroup/>
774
936
  </editorialgroup>
937
+ <approvalgroup>
938
+ <agency>ISO</agency>
939
+ <technical-committee/>
940
+ <subcommittee/>
941
+ <workgroup/>
942
+ </approvalgroup>
775
943
  <structuredidentifier>
776
944
  <project-number>ISO 1000</project-number>
777
945
  </structuredidentifier>
@@ -1142,12 +1310,19 @@ RSpec.describe Metanorma::ISO do
1142
1310
  </bibitem>
1143
1311
  </relation>
1144
1312
  <ext>
1145
- <doctype>article</doctype>
1313
+ <doctype>standard</doctype>
1146
1314
  <editorialgroup>
1315
+ <agency>ISO</agency>
1147
1316
  <technical-committee/>
1148
1317
  <subcommittee/>
1149
1318
  <workgroup/>
1150
1319
  </editorialgroup>
1320
+ <approvalgroup>
1321
+ <agency>ISO</agency>
1322
+ <technical-committee/>
1323
+ <subcommittee/>
1324
+ <workgroup/>
1325
+ </approvalgroup>
1151
1326
  <stagename>International standard</stagename>
1152
1327
  </ext>
1153
1328
  </bibdata>
@@ -228,6 +228,27 @@ RSpec.describe Metanorma::ISO do
228
228
  .to be_equivalent_to xmlpp(output)
229
229
  end
230
230
 
231
+ it "processes editorial notes" do
232
+ input = <<~INPUT
233
+ #{ASCIIDOC_BLANK_HDR}
234
+ [IMPORTANT,type=editorial]
235
+ ====
236
+ Editorial note
237
+ ====
238
+ INPUT
239
+ output = <<~OUTPUT
240
+ #{BLANK_HDR}
241
+ <sections>
242
+ <admonition id="_" type="editorial">
243
+ <p id="_">Editorial note</p>
244
+ </admonition>
245
+ </sections>
246
+ </iso-standard>
247
+ OUTPUT
248
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
249
+ .to be_equivalent_to xmlpp(output)
250
+ end
251
+
231
252
  it "processes complex admonitions with non-Asciidoc names" do
232
253
  input = <<~INPUT
233
254
  #{ASCIIDOC_BLANK_HDR}
@@ -600,4 +621,37 @@ RSpec.describe Metanorma::ISO do
600
621
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
601
622
  .to be_equivalent_to xmlpp(output)
602
623
  end
624
+
625
+ it "processes the macro for editorial notes" do
626
+ input = <<~INPUT
627
+ #{ASCIIDOC_BLANK_HDR}
628
+ EDITOR: Note1
629
+
630
+ [EDITOR]
631
+ ====
632
+ Note2
633
+ ====
634
+
635
+ [EDITOR]
636
+ Note3
637
+ INPUT
638
+ output = <<~OUTPUT
639
+ #{BLANK_HDR}
640
+ <sections>
641
+ <admonition id='_' type='editorial'>
642
+ <p id='_'>Note1</p>
643
+ </admonition>
644
+ <admonition id='_' type='editorial'>
645
+ <p id='_'>Note2</p>
646
+ </admonition>
647
+ <admonition id='_' type='editorial'>
648
+ <p id='_'>Note3</p>
649
+ </admonition>
650
+ </sections>
651
+ </iso-standard>
652
+ OUTPUT
653
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
654
+ .to be_equivalent_to xmlpp(output)
655
+ end
656
+
603
657
  end
@@ -73,7 +73,7 @@ RSpec.describe Metanorma::ISO do
73
73
  [loweralpha]
74
74
  . First
75
75
  . Second
76
- [upperalpha]
76
+ [upperalpha,start=4]
77
77
  .. Third
78
78
  .. Fourth
79
79
  . Fifth
@@ -117,7 +117,7 @@ RSpec.describe Metanorma::ISO do
117
117
  </li>
118
118
  <li>
119
119
  <p id="_">Second</p>
120
- <ol id="_">
120
+ <ol id='_' start='4'>
121
121
  <li>
122
122
  <p id="_">Third</p>
123
123
  </li>
@@ -455,8 +455,8 @@ RSpec.describe Metanorma::ISO do
455
455
 
456
456
  INPUT
457
457
  output = <<~OUTPUT
458
- #{BLANK_HDR.sub(%r{<doctype>article</doctype>},
459
- '<doctype>article</doctype><subdoctype>vocabulary</subdoctype>')}
458
+ #{BLANK_HDR.sub(%r{<doctype>standard</doctype>},
459
+ '<doctype>standard</doctype><subdoctype>vocabulary</subdoctype>')}
460
460
  <sections>
461
461
  <terms id='_' obligation='normative'>
462
462
  <title>Terms and Definitions</title>
data/spec/spec_helper.rb CHANGED
@@ -47,7 +47,10 @@ RSpec.configure do |config|
47
47
  end
48
48
 
49
49
  def strip_guid(xml)
50
- xml.gsub(%r{ id="_[^"]+"}, ' id="_"').gsub(%r{ target="_[^"]+"}, ' target="_"')
50
+ xml.gsub(%r{ id=['"]_[^"']+['"]}, ' id="_"')
51
+ .gsub(%r{ target="_[^"]+"}, ' target="_"')
52
+ .gsub(%r{ src="cid:[^.]+.gif"}, ' src="_.gif"')
53
+ .gsub(%r{ src='cid:[^.]+.gif'}, ' src="_.gif"')
51
54
  end
52
55
 
53
56
  def metadata(hash)
@@ -57,6 +60,13 @@ def metadata(hash)
57
60
  end
58
61
 
59
62
  def xmlpp(xml)
63
+ c = HTMLEntities.new
64
+ xml &&= xml.split(/(&\S+?;)/).map do |n|
65
+ if /^&\S+?;$/.match?(n)
66
+ c.encode(c.decode(n), :hexadecimal)
67
+ else n
68
+ end
69
+ end.join
60
70
  s = ""
61
71
  f = REXML::Formatters::Pretty.new(2)
62
72
  f.compact = true
@@ -141,7 +151,8 @@ BOILERPLATE =
141
151
  File.read(ASCIIDOCTOR_ISO_DIR / "boilerplate.xml", encoding: "utf-8")
142
152
  .gsub(/\{\{ agency \}\}/, "ISO")
143
153
  .gsub(/\{\{ docyear \}\}/, Date.today.year.to_s)
144
- .gsub(/\{% if unpublished %\}.*\{% endif %\}/m, "")
154
+ .gsub(/\{% if unpublished %\}.*?\{% endif %\}/m, "")
155
+ .gsub(/\{% if stage_int >= 40 %\}(.*?)\{% endif %\}/m, "\\1")
145
156
  .gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’"),
146
157
  )
147
158
 
@@ -150,7 +161,8 @@ BOILERPLATE_FR =
150
161
  File.read(ASCIIDOCTOR_ISO_DIR / "boilerplate-fr.xml", encoding: "utf-8")
151
162
  .gsub(/\{\{ agency \}\}/, "ISO")
152
163
  .gsub(/\{\{ docyear \}\}/, Date.today.year.to_s)
153
- .gsub(/\{% if unpublished %\}.*\{% endif %\}/m, "")
164
+ .gsub(/\{% if unpublished %\}.*?\{% endif %\}/m, "")
165
+ .gsub(/\{% if stage_int >= 40 %\}(.*?)\{% endif %\}/m, "\\1")
154
166
  .gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’"),
155
167
  )
156
168
 
@@ -188,12 +200,19 @@ BLANK_HDR1 = <<~"HDR".freeze
188
200
  </owner>
189
201
  </copyright>
190
202
  <ext>
191
- <doctype>article</doctype>
203
+ <doctype>standard</doctype>
192
204
  <editorialgroup>
205
+ <agency>ISO</agency>
193
206
  <technical-committee/>
194
207
  <subcommittee/>
195
208
  <workgroup/>
196
209
  </editorialgroup>
210
+ <approvalgroup>
211
+ <agency>ISO</agency>
212
+ <technical-committee/>
213
+ <subcommittee/>
214
+ <workgroup/>
215
+ </approvalgroup>
197
216
  <stagename>International standard</stagename>
198
217
  </ext>
199
218
  </bibdata>