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
@@ -81,11 +81,42 @@ module Metanorma
81
81
  end
82
82
 
83
83
  def metadata_committee(node, xml)
84
+ metadata_editorial_committee(node, xml)
85
+ metadata_approval_committee(node, xml)
86
+ end
87
+
88
+ def metadata_editorial_committee(node, xml)
84
89
  xml.editorialgroup do |a|
85
- committee_component("technical-committee", node, a)
86
- committee_component("subcommittee", node, a)
87
- committee_component("workgroup", node, a)
88
- node.attr("secretariat") && a.secretariat(node.attr("secretariat"))
90
+ %w(technical-committee subcommittee workgroup).each do |v|
91
+ node.attr("#{v}-number") and committee_component(v, node, a)
92
+ end
93
+ node.attr("secretariat") and a.secretariat(node.attr("secretariat"))
94
+ end
95
+ end
96
+
97
+ def metadata_approval_committee(node, xml)
98
+ types = metadata_approval_committee_types(node)
99
+ xml.approvalgroup do |a|
100
+ metadata_approval_agency(a, node.attr("approval-agency")
101
+ &.split(%r{[/,;]}))
102
+ types.each do |v|
103
+ node.attr("#{v}-number") and committee_component(v, node, a)
104
+ end
105
+ end
106
+ end
107
+
108
+ def metadata_approval_committee_types(node)
109
+ types = %w(technical-committee subcommittee workgroup)
110
+ node.attr("approval-technical-committee-number") and
111
+ types = %w(approval-technical-committee approval-subcommittee
112
+ approval-workgroup)
113
+ types
114
+ end
115
+
116
+ def metadata_approval_agency(xml, list)
117
+ list = ["ISO"] if list.nil? || list.empty?
118
+ list.each do |v|
119
+ xml.agency v
89
120
  end
90
121
  end
91
122
 
@@ -146,7 +177,8 @@ module Metanorma
146
177
  end
147
178
 
148
179
  def relaton_relations
149
- super + %w(obsoletes successor-of manifestation-of related annotation-of)
180
+ super + %w(obsoletes successor-of manifestation-of related
181
+ annotation-of)
150
182
  end
151
183
 
152
184
  def relaton_relation_descriptions
@@ -162,7 +194,7 @@ module Metanorma
162
194
  "identical-adopted-from" => "adoptedFrom",
163
195
  "modified-adopted-from" => "adoptedFrom",
164
196
  "related-directive" => "related",
165
- "related-mandate" => "related",
197
+ "related-mandate" => "related"
166
198
  )
167
199
  end
168
200
  end
@@ -202,6 +202,8 @@ module Metanorma
202
202
  %w(40 50).include?(stage) && i = node.attr("iteration") and
203
203
  itersuffix = ".#{i}"
204
204
  return docnum if abbr.nil? || abbr.empty? # prefixes added in cleanup
205
+
206
+ typeabbr = "" if %w(DTS FDTS).include?(abbr.sub(/\s+$/, ""))
205
207
  return "/#{abbr}#{typeabbr} #{docnum}#{itersuffix}" unless @amd
206
208
 
207
209
  a = docnum.split(%r{/})
@@ -69,6 +69,17 @@
69
69
  </zeroOrMore>
70
70
  </element>
71
71
  </define>
72
+ <define name="AdmonitionType">
73
+ <choice>
74
+ <value>warning</value>
75
+ <value>note</value>
76
+ <value>tip</value>
77
+ <value>important</value>
78
+ <value>caution</value>
79
+ <value>statement</value>
80
+ <value>editorial</value>
81
+ </choice>
82
+ </define>
72
83
  <define name="index">
73
84
  <element name="index">
74
85
  <optional>
@@ -116,6 +127,11 @@
116
127
  <data type="boolean"/>
117
128
  </attribute>
118
129
  </optional>
130
+ <optional>
131
+ <attribute name="suppress_identifier">
132
+ <data type="boolean"/>
133
+ </attribute>
134
+ </optional>
119
135
  <ref name="BibliographicItem"/>
120
136
  </element>
121
137
  </define>
@@ -282,6 +298,9 @@
282
298
  <ref name="MultilingualRenderingType"/>
283
299
  </attribute>
284
300
  </optional>
301
+ <optional>
302
+ <ref name="tname"/>
303
+ </optional>
285
304
  <oneOrMore>
286
305
  <ref name="ul_li"/>
287
306
  </oneOrMore>
@@ -324,6 +343,9 @@
324
343
  </choice>
325
344
  </attribute>
326
345
  </optional>
346
+ <optional>
347
+ <ref name="tname"/>
348
+ </optional>
327
349
  <oneOrMore>
328
350
  <ref name="li"/>
329
351
  </oneOrMore>
@@ -360,6 +382,9 @@
360
382
  <ref name="MultilingualRenderingType"/>
361
383
  </attribute>
362
384
  </optional>
385
+ <optional>
386
+ <ref name="tname"/>
387
+ </optional>
363
388
  <oneOrMore>
364
389
  <ref name="dt"/>
365
390
  <ref name="dd"/>
@@ -694,6 +719,9 @@
694
719
  <optional>
695
720
  <attribute name="tag"/>
696
721
  </optional>
722
+ <optional>
723
+ <attribute name="type"/>
724
+ </optional>
697
725
  <optional>
698
726
  <attribute name="multilingual-rendering">
699
727
  <ref name="MultilingualRenderingType"/>
@@ -729,6 +757,9 @@
729
757
  <optional>
730
758
  <attribute name="tag"/>
731
759
  </optional>
760
+ <optional>
761
+ <attribute name="type"/>
762
+ </optional>
732
763
  <optional>
733
764
  <attribute name="multilingual-rendering">
734
765
  <ref name="MultilingualRenderingType"/>
@@ -2050,6 +2081,7 @@
2050
2081
  <value>compare</value>
2051
2082
  <value>contrast</value>
2052
2083
  <value>see</value>
2084
+ <value>seealso</value>
2053
2085
  </choice>
2054
2086
  </define>
2055
2087
  <define name="deprecates">
@@ -45,6 +45,9 @@
45
45
  <ref name="horizontal"/>
46
46
  </optional>
47
47
  <ref name="editorialgroup"/>
48
+ <optional>
49
+ <ref name="approvalgroup"/>
50
+ </optional>
48
51
  <zeroOrMore>
49
52
  <ref name="ics"/>
50
53
  </zeroOrMore>
@@ -249,6 +252,7 @@
249
252
  <value>warning</value>
250
253
  <value>important</value>
251
254
  <value>safety precautions</value>
255
+ <value>editorial</value>
252
256
  </choice>
253
257
  </define>
254
258
  <define name="preface">
@@ -308,18 +312,7 @@
308
312
  </define>
309
313
  <define name="editorialgroup">
310
314
  <element name="editorialgroup">
311
- <oneOrMore>
312
- <ref name="technical-committee"/>
313
- </oneOrMore>
314
- <zeroOrMore>
315
- <ref name="subcommittee"/>
316
- </zeroOrMore>
317
- <zeroOrMore>
318
- <ref name="workgroup"/>
319
- </zeroOrMore>
320
- <optional>
321
- <ref name="secretariat"/>
322
- </optional>
315
+ <ref name="ISOProjectGroup"/>
323
316
  </element>
324
317
  </define>
325
318
  <define name="Content-Section">
@@ -367,6 +360,33 @@
367
360
  </define>
368
361
  </include>
369
362
  <!-- end overrides -->
363
+ <define name="ISOProjectGroup">
364
+ <zeroOrMore>
365
+ <ref name="agency"/>
366
+ </zeroOrMore>
367
+ <oneOrMore>
368
+ <ref name="technical-committee"/>
369
+ </oneOrMore>
370
+ <zeroOrMore>
371
+ <ref name="subcommittee"/>
372
+ </zeroOrMore>
373
+ <zeroOrMore>
374
+ <ref name="workgroup"/>
375
+ </zeroOrMore>
376
+ <optional>
377
+ <ref name="secretariat"/>
378
+ </optional>
379
+ </define>
380
+ <define name="approvalgroup">
381
+ <element name="approvalgroup">
382
+ <ref name="ISOProjectGroup"/>
383
+ </element>
384
+ </define>
385
+ <define name="agency">
386
+ <element name="agency">
387
+ <text/>
388
+ </element>
389
+ </define>
370
390
  <!--
371
391
  We display the Normative References between scope and terms; but to keep the
372
392
  grammar simple, we keep the references together
@@ -202,18 +202,6 @@ module Metanorma
202
202
  end
203
203
  end
204
204
 
205
- def asset_style(root)
206
- root.xpath("//example | //termexample").each { |e| example_style(e) }
207
- root.xpath("//definition/verbal-definition").each do |e|
208
- definition_style(e)
209
- end
210
- root.xpath("//note").each { |e| note_style(e) }
211
- root.xpath("//fn").each { |e| footnote_style(e) }
212
- root.xpath(ASSETS_TO_STYLE).each { |e| style(e, extract_text(e)) }
213
- norm_bibitem_style(root)
214
- super
215
- end
216
-
217
205
  def subclause_validate(root)
218
206
  root.xpath("//clause/clause/clause/clause/clause/clause/clause/clause")
219
207
  .each do |c|
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "2.1.1".freeze
3
+ VERSION = "2.1.4".freeze
4
4
  end
5
5
  end
@@ -745,11 +745,7 @@ RSpec.describe IsoDoc do
745
745
  </iso-standard>
746
746
  INPUT
747
747
  output = <<~OUTPUT
748
- {:accesseddate=>"XXX",
749
- :agency=>"ISO",
750
- :circulateddate=>"XXX",
751
- :confirmeddate=>"XXX",
752
- :copieddate=>"XXX",
748
+ {:agency=>"ISO",
753
749
  :createddate=>"2016-05-01",
754
750
  :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
755
751
  :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
@@ -779,13 +775,8 @@ RSpec.describe IsoDoc do
779
775
  :edition=>"2",
780
776
  :editorialgroup=>["A 1", "B 2", "C 3"],
781
777
  :ics=>"1, 2, 3",
782
- :implementeddate=>"XXX",
783
- :issueddate=>"XXX",
784
778
  :lang=>"en",
785
- :obsoleteddate=>"XXX",
786
- :publisheddate=>"XXX",
787
779
  :publisher=>"International Organization for Standardization",
788
- :receiveddate=>"XXX",
789
780
  :revdate=>"2000-01-01",
790
781
  :revdate_monthyear=>"January 2000",
791
782
  :sc=>"B 2",
@@ -795,13 +786,9 @@ RSpec.describe IsoDoc do
795
786
  :stage_int=>10,
796
787
  :stageabbr=>"NWIP",
797
788
  :statusabbr=>"PreNWIP3",
789
+ :substage_int=>"20",
798
790
  :tc=>"A 1",
799
- :transmitteddate=>"XXX",
800
- :unchangeddate=>"XXX",
801
791
  :unpublished=>true,
802
- :updateddate=>"XXX",
803
- :vote_endeddate=>"XXX",
804
- :vote_starteddate=>"XXX",
805
792
  :wg=>"C 3"}
806
793
  OUTPUT
807
794
  expect(metadata(c.info(Nokogiri::XML(input), nil)))
@@ -910,11 +897,7 @@ RSpec.describe IsoDoc do
910
897
  </iso-standard>
911
898
  INPUT
912
899
  output = <<~OUTPUT
913
- {:accesseddate=>"XXX",
914
- :agency=>"ISO",
915
- :circulateddate=>"XXX",
916
- :confirmeddate=>"XXX",
917
- :copieddate=>"XXX",
900
+ {:agency=>"ISO",
918
901
  :createddate=>"2016-05-01",
919
902
  :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
920
903
  :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
@@ -944,13 +927,8 @@ RSpec.describe IsoDoc do
944
927
  :edition=>"2",
945
928
  :editorialgroup=>["A 1", "B 2", "C 3"],
946
929
  :ics=>"1, 2, 3",
947
- :implementeddate=>"XXX",
948
- :issueddate=>"XXX",
949
930
  :lang=>"fr",
950
- :obsoleteddate=>"XXX",
951
- :publisheddate=>"XXX",
952
931
  :publisher=>"International Organization for Standardization",
953
- :receiveddate=>"XXX",
954
932
  :revdate=>"2000-01-01",
955
933
  :revdate_monthyear=>"Janvier 2000",
956
934
  :sc=>"B 2",
@@ -960,13 +938,9 @@ RSpec.describe IsoDoc do
960
938
  :stage_int=>10,
961
939
  :stageabbr=>"NWIP",
962
940
  :statusabbr=>"PreNWIP3",
941
+ :substage_int=>"20",
963
942
  :tc=>"A 1",
964
- :transmitteddate=>"XXX",
965
- :unchangeddate=>"XXX",
966
943
  :unpublished=>true,
967
- :updateddate=>"XXX",
968
- :vote_endeddate=>"XXX",
969
- :vote_starteddate=>"XXX",
970
944
  :wg=>"C 3"}
971
945
  OUTPUT
972
946
  expect(metadata(c.info(Nokogiri::XML(input), nil)))