metanorma-iec 2.1.1 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,18 +37,20 @@ module IsoDoc
37
37
  .call(elem)
38
38
  end
39
39
 
40
- DICT_PATHS = { doctype_dict: "./ext/doctype", stage_dict: "./status/stage",
40
+ DICT_PATHS = { doctype_dict: "./ext/doctype",
41
41
  substage_dict: "./status/substage",
42
42
  function_dict: "./ext/function",
43
43
  horizontal_dict: "./ext/horizontal" }.freeze
44
44
 
45
45
  def bibdata_i18n(bib)
46
- fr = IsoDoc::Iec::I18n.new("fr", "Latn")
47
- en = IsoDoc::Iec::I18n.new("en", "Latn")
48
- [{ lang: "en", i18n: en }, { lang: "fr", i18n: fr }].each do |v|
46
+ [{ lang: "en", i18n: IsoDoc::Iec::I18n.new("en", "Latn") },
47
+ { lang: "fr", i18n: IsoDoc::Iec::I18n.new("fr", "Latn") }].each do |v|
49
48
  DICT_PATHS.each do |lbl, xpath|
50
49
  hash_translate(bib, v[:i18n].get[lbl.to_s], xpath, v[:lang])
51
50
  end
51
+ bibdata_i18n_stage(bib, bib.at(ns("./status/stage")),
52
+ bib.at(ns("./ext/doctype")),
53
+ lang: v[:lang], i18n: v[:i18n])
52
54
  end
53
55
  end
54
56
 
@@ -113,7 +113,7 @@ module IsoDoc
113
113
  ret = super
114
114
  css_class =
115
115
  cell.name == "th" || header ? "TABLE-col-heading" : "TABLE-cell"
116
- ret.merge("class": css_class)
116
+ ret.merge(class: css_class)
117
117
  end
118
118
 
119
119
  def tr_parse(node, out, ord, totalrows, header)
@@ -614,12 +614,103 @@
614
614
  <optional>
615
615
  <ref name="fetched"/>
616
616
  </optional>
617
- <choice>
618
- <oneOrMore>
619
- <ref name="btitle"/>
620
- </oneOrMore>
617
+ <optional>
621
618
  <ref name="formattedref"/>
622
- </choice>
619
+ </optional>
620
+ <oneOrMore>
621
+ <ref name="btitle"/>
622
+ </oneOrMore>
623
+ <zeroOrMore>
624
+ <ref name="bsource"/>
625
+ </zeroOrMore>
626
+ <oneOrMore>
627
+ <ref name="docidentifier"/>
628
+ </oneOrMore>
629
+ <optional>
630
+ <ref name="docnumber"/>
631
+ </optional>
632
+ <zeroOrMore>
633
+ <ref name="bdate"/>
634
+ </zeroOrMore>
635
+ <zeroOrMore>
636
+ <ref name="contributor"/>
637
+ </zeroOrMore>
638
+ <optional>
639
+ <ref name="edition"/>
640
+ </optional>
641
+ <zeroOrMore>
642
+ <ref name="version"/>
643
+ </zeroOrMore>
644
+ <zeroOrMore>
645
+ <ref name="biblionote"/>
646
+ </zeroOrMore>
647
+ <zeroOrMore>
648
+ <ref name="language"/>
649
+ </zeroOrMore>
650
+ <zeroOrMore>
651
+ <ref name="script"/>
652
+ </zeroOrMore>
653
+ <zeroOrMore>
654
+ <ref name="bibabstract"/>
655
+ </zeroOrMore>
656
+ <optional>
657
+ <ref name="status"/>
658
+ </optional>
659
+ <zeroOrMore>
660
+ <ref name="copyright"/>
661
+ </zeroOrMore>
662
+ <zeroOrMore>
663
+ <ref name="docrelation"/>
664
+ </zeroOrMore>
665
+ <zeroOrMore>
666
+ <ref name="series"/>
667
+ </zeroOrMore>
668
+ <optional>
669
+ <ref name="medium"/>
670
+ </optional>
671
+ <zeroOrMore>
672
+ <ref name="bplace"/>
673
+ </zeroOrMore>
674
+ <zeroOrMore>
675
+ <ref name="bprice"/>
676
+ </zeroOrMore>
677
+ <zeroOrMore>
678
+ <ref name="extent"/>
679
+ </zeroOrMore>
680
+ <optional>
681
+ <ref name="bibliographic_size"/>
682
+ </optional>
683
+ <zeroOrMore>
684
+ <ref name="accesslocation"/>
685
+ </zeroOrMore>
686
+ <zeroOrMore>
687
+ <ref name="license"/>
688
+ </zeroOrMore>
689
+ <zeroOrMore>
690
+ <ref name="bclassification"/>
691
+ </zeroOrMore>
692
+ <zeroOrMore>
693
+ <ref name="bkeyword"/>
694
+ </zeroOrMore>
695
+ <optional>
696
+ <ref name="validity"/>
697
+ </optional>
698
+ </define>
699
+ <define name="ReducedBibliographicItem">
700
+ <optional>
701
+ <attribute name="type">
702
+ <ref name="BibItemType"/>
703
+ </attribute>
704
+ </optional>
705
+ <optional>
706
+ <ref name="fetched"/>
707
+ </optional>
708
+ <optional>
709
+ <ref name="formattedref"/>
710
+ </optional>
711
+ <zeroOrMore>
712
+ <ref name="btitle"/>
713
+ </zeroOrMore>
623
714
  <zeroOrMore>
624
715
  <ref name="bsource"/>
625
716
  </zeroOrMore>
@@ -638,9 +729,9 @@
638
729
  <optional>
639
730
  <ref name="edition"/>
640
731
  </optional>
641
- <optional>
732
+ <zeroOrMore>
642
733
  <ref name="version"/>
643
- </optional>
734
+ </zeroOrMore>
644
735
  <zeroOrMore>
645
736
  <ref name="biblionote"/>
646
737
  </zeroOrMore>
@@ -833,6 +924,12 @@
833
924
  <data type="boolean"/>
834
925
  </attribute>
835
926
  </optional>
927
+ <optional>
928
+ <attribute name="language"/>
929
+ </optional>
930
+ <optional>
931
+ <attribute name="script"/>
932
+ </optional>
836
933
  <text/>
837
934
  </element>
838
935
  </define>
@@ -986,36 +1083,34 @@
986
1083
  <ref name="SeriesType"/>
987
1084
  </attribute>
988
1085
  </optional>
989
- <choice>
1086
+ <optional>
990
1087
  <ref name="formattedref"/>
991
- <group>
992
- <ref name="btitle"/>
993
- <optional>
994
- <ref name="bplace"/>
995
- </optional>
996
- <optional>
997
- <ref name="seriesorganization"/>
998
- </optional>
999
- <optional>
1000
- <ref name="abbreviation"/>
1001
- </optional>
1002
- <optional>
1003
- <ref name="seriesfrom"/>
1004
- </optional>
1005
- <optional>
1006
- <ref name="seriesto"/>
1007
- </optional>
1008
- <optional>
1009
- <ref name="seriesnumber"/>
1010
- </optional>
1011
- <optional>
1012
- <ref name="seriespartnumber"/>
1013
- </optional>
1014
- <optional>
1015
- <ref name="seriesrun"/>
1016
- </optional>
1017
- </group>
1018
- </choice>
1088
+ </optional>
1089
+ <ref name="btitle"/>
1090
+ <optional>
1091
+ <ref name="bplace"/>
1092
+ </optional>
1093
+ <optional>
1094
+ <ref name="seriesorganization"/>
1095
+ </optional>
1096
+ <optional>
1097
+ <ref name="abbreviation"/>
1098
+ </optional>
1099
+ <optional>
1100
+ <ref name="seriesfrom"/>
1101
+ </optional>
1102
+ <optional>
1103
+ <ref name="seriesto"/>
1104
+ </optional>
1105
+ <optional>
1106
+ <ref name="seriesnumber"/>
1107
+ </optional>
1108
+ <optional>
1109
+ <ref name="seriespartnumber"/>
1110
+ </optional>
1111
+ <optional>
1112
+ <ref name="seriesrun"/>
1113
+ </optional>
1019
1114
  </element>
1020
1115
  </define>
1021
1116
  <define name="SeriesType">
@@ -1174,7 +1269,7 @@
1174
1269
  </element>
1175
1270
  </optional>
1176
1271
  <element name="bibitem">
1177
- <ref name="BibliographicItem"/>
1272
+ <ref name="ReducedBibliographicItem"/>
1178
1273
  </element>
1179
1274
  <choice>
1180
1275
  <zeroOrMore>
@@ -1199,9 +1294,9 @@
1199
1294
  <optional>
1200
1295
  <ref name="revision-date"/>
1201
1296
  </optional>
1202
- <zeroOrMore>
1297
+ <optional>
1203
1298
  <ref name="draft"/>
1204
- </zeroOrMore>
1299
+ </optional>
1205
1300
  </element>
1206
1301
  </define>
1207
1302
  <define name="vedition">
@@ -131,6 +131,11 @@ module Metanorma
131
131
  "#{t.children.to_xml}</variant-title>"
132
132
  end
133
133
  end
134
+
135
+ def ol_attrs(node)
136
+ attr_code(keep_attrs(node)
137
+ .merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
138
+ end
134
139
  end
135
140
  end
136
141
  end
@@ -213,6 +213,8 @@ module Metanorma
213
213
  a = node.attr("secretary") and xml.secretary a
214
214
  a = node.attr("interest-to-committees") and xml.interest_to_committees a
215
215
  end
216
+
217
+ def metadata_approval_committee(node, xml); end
216
218
  end
217
219
  end
218
220
  end
@@ -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
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.1.1".freeze
3
+ VERSION = "2.1.4".freeze
4
4
  end
5
5
  end
6
6
 
@@ -160,4 +160,41 @@ RSpec.describe IsoDoc::Iec do
160
160
  .gsub(%r{</body>.*}m, "</body>")))
161
161
  .to be_equivalent_to xmlpp(output)
162
162
  end
163
+
164
+ it "does not ignore intervening ul in numbering ol" do
165
+ input = <<~INPUT
166
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
167
+ <preface><foreword>
168
+ <ul>
169
+ <li>A</li>
170
+ <li>
171
+ <ol>
172
+ <li>List</li>
173
+ </ol>
174
+ </li>
175
+ </ul>
176
+ </foreword></preface>
177
+ </iso-standard>
178
+ INPUT
179
+ presxml = <<~INPUT
180
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
181
+ <preface>
182
+ <foreword displayorder='1'>
183
+ <ul>
184
+ <li>A</li>
185
+ <li>
186
+ <ol type='arabic'>
187
+ <li>List</li>
188
+ </ol>
189
+ </li>
190
+ </ul>
191
+ </foreword>
192
+ </preface>
193
+ </iso-standard>
194
+ INPUT
195
+ expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({})
196
+ .convert("test", input, true)))
197
+ .to be_equivalent_to xmlpp(presxml)
198
+
199
+ end
163
200
  end
@@ -109,7 +109,7 @@ RSpec.describe IsoDoc do
109
109
  </owner>
110
110
  </copyright>
111
111
  <ext>
112
- <doctype>article</doctype>
112
+ <doctype>international-standard</doctype>
113
113
  <editorialgroup>
114
114
  <technical-committee/>
115
115
  <subcommittee/>
@@ -170,7 +170,7 @@ RSpec.describe IsoDoc do
170
170
  <status>
171
171
  <stage language="">60</stage>
172
172
  <stage language='fr'>Norme internationale</stage>
173
- <stage language='en'>International standard</stage>
173
+ <stage language='en'>International Standard</stage>
174
174
  <substage>60</substage>
175
175
  </status>
176
176
  <copyright>
@@ -183,8 +183,10 @@ RSpec.describe IsoDoc do
183
183
  </owner>
184
184
  </copyright>
185
185
  <ext>
186
- <doctype>article</doctype>
187
- <editorialgroup>
186
+ <doctype language=''>international-standard</doctype>
187
+ <doctype language='fr'>Norme internationale</doctype>
188
+ <doctype language='en'>International Standard</doctype>
189
+ <editorialgroup identifier=' / / '>
188
190
  <technical-committee/>
189
191
  <subcommittee/>
190
192
  <workgroup/>