metanorma-iec 2.0.8 → 2.1.2

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.
@@ -10,12 +10,14 @@ module IsoDoc
10
10
  @meta = Metadata.new(lang, script, labels)
11
11
  end
12
12
 
13
- def xref_init(lang, script, klass, labels, options)
14
- @xrefs = Xref.new(lang, script, HtmlConvert.new(language: lang, script: script), labels, options)
13
+ def xref_init(lang, script, _klass, labels, options)
14
+ @xrefs = Xref.new(lang, script,
15
+ HtmlConvert.new(language: lang, script: script),
16
+ labels, options)
15
17
  end
16
18
 
17
- def i18n_init(lang, script, i18nyaml = nil)
18
- @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
19
+ def i18n_init(lang, script, i18nyaml = nil)
20
+ @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
19
21
  end
20
22
 
21
23
  def convert1(docxml, filename, dir)
@@ -26,4 +28,3 @@ module IsoDoc
26
28
  end
27
29
  end
28
30
  end
29
-
@@ -3,7 +3,7 @@ require "metanorma-iso"
3
3
 
4
4
  module IsoDoc
5
5
  module Iec
6
- class Metadata < IsoDoc::Iso::Metadata
6
+ class Metadata < IsoDoc::Iso::Metadata
7
7
  def docstatus(isoxml, _out)
8
8
  docstatus = isoxml.at(ns("//bibdata/status/stage"))
9
9
  substage = isoxml.at(ns("//bibdata/status/substage"))
@@ -22,7 +22,7 @@ module IsoDoc
22
22
 
23
23
  def doctype(isoxml, _out)
24
24
  super
25
- b = isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}"))&.text
25
+ b = isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}"))&.text
26
26
  b1 = isoxml&.at(ns("//bibdata/ext/doctype[@language = 'en']"))&.text || b
27
27
  b1 and set(:doctype_en, status_print(b1))
28
28
  b1 = isoxml&.at(ns("//bibdata/ext/doctype[@language = 'fr']"))&.text || b
@@ -7,8 +7,8 @@ module IsoDoc
7
7
  def i18n_init(lang, script, i18nyaml = nil)
8
8
  super
9
9
  @i18n_lg = {}
10
- @i18n_lg["en"] = I18n.new("en", "Latn", i18nyaml || @i18nyaml)
11
- @i18n_lg["fr"] = I18n.new("fr", "Latn", i18nyaml || @i18nyaml)
10
+ @i18n_lg["en"] = I18n.new("en", "Latn", i18nyaml: i18nyaml || @i18nyaml)
11
+ @i18n_lg["fr"] = I18n.new("fr", "Latn", i18nyaml: i18nyaml || @i18nyaml)
12
12
  @i18n_lg["default"] = @i18n
13
13
  end
14
14
 
@@ -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
 
@@ -89,7 +91,7 @@ module IsoDoc
89
91
  fr = docxml.at(ns("//term[@language = 'fr'][@tag = '#{en['tag']}']"))
90
92
  merge_fr_into_en_term1(en, fr) if fr
91
93
  end
92
- @xrefs.parse docxml
94
+ @xrefs.parse_inclusions(clauses: true).parse docxml
93
95
  docxml.xpath(ns("//term/name")).each(&:remove)
94
96
  term(docxml)
95
97
  end
@@ -58,7 +58,7 @@ module IsoDoc
58
58
  <span lang="EN-GB"><span
59
59
  style='mso-element:field-begin'></span><span
60
60
  style='mso-spacerun:yes'>&#xA0;</span>TOC
61
- \\h \\z \\t &quot;TableTitle,tabletitle&quot; <span
61
+ \\h \\z \\t "TableTitle,tabletitle" <span
62
62
  style='mso-element:field-separator'></span></span>
63
63
  TOC
64
64
 
@@ -66,7 +66,7 @@ module IsoDoc
66
66
  <span lang="EN-GB"><span
67
67
  style='mso-element:field-begin'></span><span
68
68
  style='mso-spacerun:yes'>&#xA0;</span>TOC
69
- \\h \\z \\t &quot;FigureTitle,figuretitle&quot; <span
69
+ \\h \\z \\t "FigureTitle,figuretitle" <span
70
70
  style='mso-element:field-separator'></span></span>
71
71
  TOC
72
72
 
@@ -93,7 +93,7 @@ module IsoDoc
93
93
  <span lang="EN-GB"><span
94
94
  style='mso-element:field-begin'></span><span
95
95
  style='mso-spacerun:yes'>&#xA0;</span>TOC
96
- \\o &quot;1-#{level}&quot; \\h \\z \\u <span
96
+ \\o "1-#{level}" \\h \\z \\u <span
97
97
  style='mso-element:field-separator'></span></span>
98
98
  TOC
99
99
  end
@@ -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)
@@ -17,10 +17,14 @@ module IsoDoc
17
17
  super
18
18
  return unless @is_iev
19
19
 
20
+ if @parse_settings.empty? || @parse_settings[:clauses]
20
21
  terms_iev_names(docxml)
22
+ end
23
+ if @parse_settings.empty?
21
24
  middle_section_asset_names(docxml)
22
25
  termnote_anchor_names(docxml)
23
26
  termexample_anchor_names(docxml)
27
+ end
24
28
  end
25
29
 
26
30
  def terms_iev_names(docxml)
@@ -614,12 +614,12 @@
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
623
  <zeroOrMore>
624
624
  <ref name="bsource"/>
625
625
  </zeroOrMore>
@@ -851,17 +851,46 @@
851
851
  </define>
852
852
  <define name="bplace">
853
853
  <element name="place">
854
- <optional>
855
- <attribute name="uri">
856
- <data type="anyURI"/>
857
- </attribute>
858
- </optional>
859
- <optional>
860
- <attribute name="region"/>
861
- </optional>
854
+ <choice>
855
+ <text/>
856
+ <group>
857
+ <ref name="bibliocity"/>
858
+ <zeroOrMore>
859
+ <ref name="biblioregion"/>
860
+ </zeroOrMore>
861
+ <zeroOrMore>
862
+ <ref name="bibliocountry"/>
863
+ </zeroOrMore>
864
+ </group>
865
+ </choice>
866
+ </element>
867
+ </define>
868
+ <define name="bibliocity">
869
+ <element name="city">
862
870
  <text/>
863
871
  </element>
864
872
  </define>
873
+ <define name="biblioregion">
874
+ <element name="region">
875
+ <ref name="RegionType"/>
876
+ </element>
877
+ </define>
878
+ <define name="bibliocountry">
879
+ <element name="country">
880
+ <ref name="RegionType"/>
881
+ </element>
882
+ </define>
883
+ <define name="RegionType">
884
+ <optional>
885
+ <attribute name="iso"/>
886
+ </optional>
887
+ <optional>
888
+ <attribute name="recommended">
889
+ <data type="boolean"/>
890
+ </attribute>
891
+ </optional>
892
+ <text/>
893
+ </define>
865
894
  <define name="bprice">
866
895
  <element name="price">
867
896
  <attribute name="currency"/>
@@ -957,36 +986,34 @@
957
986
  <ref name="SeriesType"/>
958
987
  </attribute>
959
988
  </optional>
960
- <choice>
989
+ <optional>
961
990
  <ref name="formattedref"/>
962
- <group>
963
- <ref name="btitle"/>
964
- <optional>
965
- <ref name="bplace"/>
966
- </optional>
967
- <optional>
968
- <ref name="seriesorganization"/>
969
- </optional>
970
- <optional>
971
- <ref name="abbreviation"/>
972
- </optional>
973
- <optional>
974
- <ref name="seriesfrom"/>
975
- </optional>
976
- <optional>
977
- <ref name="seriesto"/>
978
- </optional>
979
- <optional>
980
- <ref name="seriesnumber"/>
981
- </optional>
982
- <optional>
983
- <ref name="seriespartnumber"/>
984
- </optional>
985
- <optional>
986
- <ref name="seriesrun"/>
987
- </optional>
988
- </group>
989
- </choice>
991
+ </optional>
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>
990
1017
  </element>
991
1018
  </define>
992
1019
  <define name="SeriesType">
@@ -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
@@ -14,6 +14,7 @@
14
14
  <value>international-workshop-agreement</value>
15
15
  <value>guide</value>
16
16
  <value>industry-technical-agreement</value>
17
+ <value>system-reference-delivrabble</value>
17
18
  </choice>
18
19
  </define>
19
20
  <define name="BibDataExtensionType">
@@ -32,6 +32,43 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="admonition">
36
+ <element name="admonition">
37
+ <attribute name="type">
38
+ <ref name="AdmonitionType"/>
39
+ </attribute>
40
+ <optional>
41
+ <attribute name="class"/>
42
+ </optional>
43
+ <attribute name="id">
44
+ <data type="ID"/>
45
+ </attribute>
46
+ <optional>
47
+ <attribute name="uri">
48
+ <data type="anyURI"/>
49
+ </attribute>
50
+ </optional>
51
+ <optional>
52
+ <attribute name="coverpage">
53
+ <data type="boolean"/>
54
+ </attribute>
55
+ </optional>
56
+ <optional>
57
+ <attribute name="notag">
58
+ <data type="boolean"/>
59
+ </attribute>
60
+ </optional>
61
+ <optional>
62
+ <ref name="tname"/>
63
+ </optional>
64
+ <zeroOrMore>
65
+ <ref name="paragraph-with-footnote"/>
66
+ </zeroOrMore>
67
+ <zeroOrMore>
68
+ <ref name="note"/>
69
+ </zeroOrMore>
70
+ </element>
71
+ </define>
35
72
  <define name="index">
36
73
  <element name="index">
37
74
  <optional>
@@ -245,6 +282,9 @@
245
282
  <ref name="MultilingualRenderingType"/>
246
283
  </attribute>
247
284
  </optional>
285
+ <optional>
286
+ <ref name="tname"/>
287
+ </optional>
248
288
  <oneOrMore>
249
289
  <ref name="ul_li"/>
250
290
  </oneOrMore>
@@ -287,6 +327,9 @@
287
327
  </choice>
288
328
  </attribute>
289
329
  </optional>
330
+ <optional>
331
+ <ref name="tname"/>
332
+ </optional>
290
333
  <oneOrMore>
291
334
  <ref name="li"/>
292
335
  </oneOrMore>
@@ -323,6 +366,9 @@
323
366
  <ref name="MultilingualRenderingType"/>
324
367
  </attribute>
325
368
  </optional>
369
+ <optional>
370
+ <ref name="tname"/>
371
+ </optional>
326
372
  <oneOrMore>
327
373
  <ref name="dt"/>
328
374
  <ref name="dd"/>
@@ -851,6 +897,16 @@
851
897
  <ref name="MultilingualRenderingType"/>
852
898
  </attribute>
853
899
  </optional>
900
+ <optional>
901
+ <attribute name="coverpage">
902
+ <data type="boolean"/>
903
+ </attribute>
904
+ </optional>
905
+ <optional>
906
+ <attribute name="notag">
907
+ <data type="boolean"/>
908
+ </attribute>
909
+ </optional>
854
910
  <oneOrMore>
855
911
  <choice>
856
912
  <ref name="paragraph"/>
@@ -1178,6 +1234,7 @@
1178
1234
  <ref name="concept"/>
1179
1235
  <ref name="add"/>
1180
1236
  <ref name="del"/>
1237
+ <ref name="span"/>
1181
1238
  </choice>
1182
1239
  </define>
1183
1240
  <define name="add">
@@ -1204,6 +1261,14 @@
1204
1261
  </choice>
1205
1262
  </element>
1206
1263
  </define>
1264
+ <define name="span">
1265
+ <element name="span">
1266
+ <attribute name="class"/>
1267
+ <oneOrMore>
1268
+ <ref name="TextElement"/>
1269
+ </oneOrMore>
1270
+ </element>
1271
+ </define>
1207
1272
  <define name="concept">
1208
1273
  <element name="concept">
1209
1274
  <optional>
@@ -45,6 +45,7 @@
45
45
  <ref name="horizontal"/>
46
46
  </optional>
47
47
  <ref name="editorialgroup"/>
48
+ <ref name="approvalgroup"/>
48
49
  <zeroOrMore>
49
50
  <ref name="ics"/>
50
51
  </zeroOrMore>
@@ -249,6 +250,7 @@
249
250
  <value>warning</value>
250
251
  <value>important</value>
251
252
  <value>safety precautions</value>
253
+ <value>editorial</value>
252
254
  </choice>
253
255
  </define>
254
256
  <define name="preface">
@@ -308,18 +310,7 @@
308
310
  </define>
309
311
  <define name="editorialgroup">
310
312
  <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>
313
+ <ref name="ISOProjectGroup"/>
323
314
  </element>
324
315
  </define>
325
316
  <define name="Content-Section">
@@ -367,6 +358,33 @@
367
358
  </define>
368
359
  </include>
369
360
  <!-- end overrides -->
361
+ <define name="ISOProjectGroup">
362
+ <zeroOrMore>
363
+ <ref name="agency"/>
364
+ </zeroOrMore>
365
+ <oneOrMore>
366
+ <ref name="technical-committee"/>
367
+ </oneOrMore>
368
+ <zeroOrMore>
369
+ <ref name="subcommittee"/>
370
+ </zeroOrMore>
371
+ <zeroOrMore>
372
+ <ref name="workgroup"/>
373
+ </zeroOrMore>
374
+ <optional>
375
+ <ref name="secretariat"/>
376
+ </optional>
377
+ </define>
378
+ <define name="approvalgroup">
379
+ <element name="approvalgroup">
380
+ <ref name="ISOProjectGroup"/>
381
+ </element>
382
+ </define>
383
+ <define name="agency">
384
+ <element name="agency">
385
+ <text/>
386
+ </element>
387
+ </define>
370
388
  <!--
371
389
  We display the Normative References between scope and terms; but to keep the
372
390
  grammar simple, we keep the references together
@@ -428,6 +446,11 @@
428
446
  <data type="int"/>
429
447
  </element>
430
448
  </define>
449
+ <define name="approvalgroup">
450
+ <element name="approvalgroup">
451
+ <ref name="IsoWorkgroup"/>
452
+ </element>
453
+ </define>
431
454
  <define name="subcommittee">
432
455
  <element name="subcommittee">
433
456
  <ref name="IsoWorkgroup"/>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.0.8".freeze
3
+ VERSION = "2.1.2".freeze
4
4
  end
5
5
  end
6
6
 
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ["open.source@ribose.com"]
12
12
 
13
13
  spec.summary = "metanorma-iec lets you write IEC standards "\
14
- "in AsciiDoc."
14
+ "in AsciiDoc."
15
15
  spec.description = <<~DESCRIPTION
16
16
  metanorma-iec lets you write IEC standards in AsciiDoc syntax.
17
17
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
29
29
 
30
- spec.add_dependency "metanorma-iso", "~> 2.0.0"
30
+ spec.add_dependency "metanorma-iso", "~> 2.1.1"
31
31
  spec.add_dependency "ruby-jing"
32
32
 
33
33
  spec.add_development_dependency "debug"
@@ -41,4 +41,5 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency "sassc", "2.4.0"
42
42
  spec.add_development_dependency "simplecov", "~> 0.15"
43
43
  spec.add_development_dependency "timecop", "~> 0.9"
44
+ # spec.metadata["rubygems_mfa_required"] = "true"
44
45
  end