metanorma-iso 1.3.26 → 1.3.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -362,6 +362,9 @@
362
362
  <data type="boolean"/>
363
363
  </attribute>
364
364
  </optional>
365
+ <optional>
366
+ <attribute name="number"/>
367
+ </optional>
365
368
  <optional>
366
369
  <attribute name="subsequence"/>
367
370
  </optional>
@@ -30,9 +30,22 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
33
36
  <optional>
34
37
  <attribute name="subsequence"/>
35
38
  </optional>
39
+ <optional>
40
+ <attribute name="keep-with-next">
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ <optional>
45
+ <attribute name="keep-lines-together">
46
+ <data type="boolean"/>
47
+ </attribute>
48
+ </optional>
36
49
  <attribute name="id">
37
50
  <data type="ID"/>
38
51
  </attribute>
@@ -141,6 +154,16 @@
141
154
  <data type="boolean"/>
142
155
  </attribute>
143
156
  </optional>
157
+ <optional>
158
+ <attribute name="keep-with-next">
159
+ <data type="boolean"/>
160
+ </attribute>
161
+ </optional>
162
+ <optional>
163
+ <attribute name="keep-lines-together">
164
+ <data type="boolean"/>
165
+ </attribute>
166
+ </optional>
144
167
  <oneOrMore>
145
168
  <ref name="BasicBlock"/>
146
169
  </oneOrMore>
@@ -57,15 +57,15 @@ module Asciidoctor
57
57
 
58
58
  def replace_automatic_generated_ids_terms
59
59
  xmldoc.xpath('//term').each.with_object({}) do |term_node, res|
60
- next if AUTOMATIC_GENERATED_ID_REGEXP.match(term_node['id']).nil?
61
-
62
60
  normalize_id_and_memorize(term_node, res, './preferred')
63
61
  end
64
62
  end
65
63
 
66
64
  def normalize_id_and_memorize(term_node, res_table, text_selector)
67
65
  term_text = normalize_ref_id(term_node.at(text_selector).text)
66
+ unless AUTOMATIC_GENERATED_ID_REGEXP.match(term_node['id']).nil?
68
67
  term_node['id'] = unique_text_id(term_text)
68
+ end
69
69
  res_table[term_text] = term_node['id']
70
70
  end
71
71
 
@@ -170,11 +170,7 @@ module Asciidoctor
170
170
 
171
171
  def bibitem_validate(xmldoc)
172
172
  xmldoc.xpath("//bibitem[date/on = '–']").each do |b|
173
- found = false
174
- b.xpath("./note").each do |n|
175
- found = true if /^ISO DATE:/.match n.text
176
- end
177
- found or
173
+ b.at("./note[@type = 'ISO DATE']") or
178
174
  @log.add("Style", b,
179
175
  "Reference #{b&.at("./@id")&.text} does not have an "\
180
176
  "associated footnote indicating unpublished status")
@@ -36,7 +36,7 @@ module Asciidoctor
36
36
 
37
37
  # ISO/IEC DIR 2, 11.4
38
38
  def title_subpart_validate(root)
39
- docid = root.at("//bibdata/docidentifier[@type = 'iso']")
39
+ docid = root.at("//bibdata/docidentifier[@type = 'ISO']")
40
40
  subpart = /-\d+-\d+/.match docid
41
41
  iec = root.at("//bibdata/contributor[role/@type = 'publisher']/"\
42
42
  "organization[abbreviation = 'IEC' or "\
@@ -1,6 +1,7 @@
1
1
  require "isodoc"
2
2
  require_relative "metadata"
3
3
  require_relative "sections"
4
+ require_relative "xref"
4
5
  require "fileutils"
5
6
 
6
7
  module IsoDoc
@@ -20,35 +21,10 @@ module IsoDoc
20
21
  super
21
22
  end
22
23
 
23
- def anchor_names(docxml)
24
- if @amd
25
- back_anchor_names(docxml)
26
- note_anchor_names(docxml.xpath(ns("//annex//table | //annex//figure")))
27
- note_anchor_names(docxml.xpath(ns("//annex")))
28
- example_anchor_names(docxml.xpath(ns("//annex")))
29
- list_anchor_names(docxml.xpath(ns("//annex")))
30
- else
31
- super
32
- end
33
- end
34
-
35
24
  def implicit_reference(b)
36
25
  b&.at(ns("./docidentifier"))&.text == "IEV"
37
26
  end
38
27
 
39
- def initial_anchor_names(d)
40
- super
41
- introduction_names(d.at(ns("//introduction")))
42
- end
43
-
44
- # we can reference 0-number clauses in introduction
45
- def introduction_names(clause)
46
- return if clause.nil?
47
- clause.xpath(ns("./clause")).each_with_index do |c, i|
48
- section_names1(c, "0.#{i + 1}", 2)
49
- end
50
- end
51
-
52
28
  # terms not defined in standoc
53
29
  def error_parse(node, out)
54
30
  case node.name
@@ -58,36 +34,6 @@ module IsoDoc
58
34
  end
59
35
  end
60
36
 
61
- def annex_names(clause, num)
62
- appendix_names(clause, num)
63
- super
64
- end
65
-
66
- def appendix_names(clause, num)
67
- clause.xpath(ns("./appendix")).each_with_index do |c, i|
68
- @anchors[c["id"]] = anchor_struct(i + 1, nil, @appendix_lbl, "clause")
69
- @anchors[c["id"]][:level] = 2
70
- @anchors[c["id"]][:container] = clause["id"]
71
- end
72
- end
73
-
74
- def section_names1(clause, num, level)
75
- @anchors[clause["id"]] =
76
- { label: num, level: level, xref: num }
77
- # subclauses are not prefixed with "Clause"
78
- clause.xpath(ns("./clause | ./terms | ./term | ./definitions | ./references")).
79
- each_with_index do |c, i|
80
- section_names1(c, "#{num}.#{i + 1}", level + 1)
81
- end
82
- end
83
-
84
- def annex_names1(clause, num, level)
85
- @anchors[clause["id"]] = { label: num, xref: num, level: level }
86
- clause.xpath(ns("./clause | ./references")).each_with_index do |c, i|
87
- annex_names1(c, "#{num}.#{i + 1}", level + 1)
88
- end
89
- end
90
-
91
37
  def eref_localities1_zh(target, type, from, to, delim)
92
38
  subsection = from&.text&.match(/\./)
93
39
  ret = (delim == ";") ? ";" : (type == "list") ? "" : delim
@@ -101,6 +47,7 @@ module IsoDoc
101
47
  end
102
48
 
103
49
  def eref_localities1(target, type, from, to, delim, lang = "en")
50
+ return "" if type == "anchor"
104
51
  subsection = from&.text&.match(/\./)
105
52
  type = type.downcase
106
53
  return l10n(eref_localities1_zh(target, type, from, to, delim)) if lang == "zh"
@@ -198,10 +145,6 @@ module IsoDoc
198
145
  sub(/ \(All Parts\)/i, "") }
199
146
  end
200
147
 
201
- def table_footnote_reference_format(a)
202
- a.content = a.content + ")"
203
- end
204
-
205
148
  def cleanup(docxml)
206
149
  super
207
150
  table_th_center(docxml)
@@ -215,16 +158,59 @@ module IsoDoc
215
158
  end
216
159
  end
217
160
 
218
- def hierarchical_formula_names(clause, num)
219
- c = IsoDoc::Function::XrefGen::Counter.new
220
- clause.xpath(ns(".//formula")).each do |t|
221
- next if t["id"].nil? || t["id"].empty?
222
- @anchors[t["id"]] =
223
- anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
224
- t["inequality"] ? @inequality_lbl : @formula_lbl,
225
- "formula", t["unnumbered"])
161
+ def formula_where(dl, out)
162
+ return if dl.nil?
163
+ return super unless (dl&.xpath(ns("./dt"))&.size == 1 &&
164
+ dl&.at(ns("./dd"))&.elements&.size == 1 &&
165
+ dl&.at(ns("./dd/p")))
166
+ out.span **{ class: "zzMoveToFollowing" } do |s|
167
+ s << "#{@where_lbl} "
168
+ dl.at(ns("./dt")).children.each { |n| parse(n, s) }
169
+ s << " "
170
+ end
171
+ parse(dl.at(ns("./dd/p")), out)
172
+ end
173
+
174
+ def admonition_parse(node, out)
175
+ type = node["type"]
176
+ name = admonition_name(node, type)
177
+ out.div **{ id: node["id"], class: admonition_class(node) } do |div|
178
+ node.first_element_child.name == "p" ?
179
+ admonition_p_parse(node, div, name) : admonition_parse1(node, div, name)
180
+ end
181
+ end
182
+
183
+ def admonition_parse1(node, div, name)
184
+ div.p do |p|
185
+ admonition_name_parse(node, p, name) if name
186
+ end
187
+ node.children.each { |n| parse(n, div) unless n.name == "name" }
188
+ end
189
+
190
+ def admonition_p_parse(node, div, name)
191
+ div.p do |p|
192
+ admonition_name_parse(node, p, name) if name
193
+ node.first_element_child.children.each { |n| parse(n, p) }
226
194
  end
195
+ node.element_children[1..-1].each { |n| parse(n, div) }
227
196
  end
197
+
198
+ def admonition_name_parse(_node, div, name)
199
+ name.children.each { |n| parse(n, div) }
200
+ div << " &mdash; "
201
+ end
202
+
203
+ def figure_name_parse(node, div, name)
204
+ lbl = anchor(node['id'], :label, false)
205
+ lbl = nil if labelled_ancestor(node) && node.ancestors("figure").empty?
206
+ return if lbl.nil? && name.nil?
207
+ div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
208
+ figname = node.parent.name == "figure" ? "" : "#{@figure_lbl} "
209
+ lbl.nil? or p << l10n("#{figname}#{lbl}")
210
+ name and !lbl.nil? and p << "&nbsp;&mdash; "
211
+ name and name.children.each { |n| parse(n, div) }
212
+ end
213
+ end
228
214
  end
229
215
  end
230
216
  end
@@ -619,6 +619,10 @@ table.figdl
619
619
  margin-right: 0cm;
620
620
  }
621
621
 
622
+ div.figdl p, table.figdl p {
623
+ font-size: 10.0pt;
624
+ }
625
+
622
626
  table.formula_dl {
623
627
  margin-left:20.15pt;
624
628
  }
@@ -507,6 +507,9 @@ pre {
507
507
  @include blockTitle()
508
508
  }
509
509
 
510
+ .figure dl {
511
+ }
512
+
510
513
  /*
511
514
  3.7 Notes
512
515
  */
@@ -537,6 +537,9 @@ pre {
537
537
  @include blockTitle()
538
538
  }
539
539
 
540
+ .figure dl {
541
+ }
542
+
540
543
  /*
541
544
  3.7 Notes
542
545
  */
@@ -5,6 +5,10 @@ margin-left:5.1pt;margin-right:5.1pt'>
5
5
  <div id="boilerplate-copyright-destination"/>
6
6
  </div>
7
7
 
8
+ {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
9
+ {% else %}
10
+
8
11
  <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
9
12
 
10
13
  WORDTOC
14
+ {% endif %}
@@ -53,7 +53,7 @@ module IsoDoc
53
53
  end
54
54
 
55
55
  def docid(isoxml, _out)
56
- dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso']"))
56
+ dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ISO']"))
57
57
  set(:docnumber, dn&.text)
58
58
  tcdn = isoxml.xpath(ns("//bibdata/docidentifier[@type = 'iso-tc']"))
59
59
  set(:tc_docnumber, tcdn.map { |n| n.text })
@@ -0,0 +1,105 @@
1
+ module IsoDoc
2
+ module Iso
3
+ module BaseConvert
4
+ def anchor_names(docxml)
5
+ if @amd
6
+ back_anchor_names(docxml)
7
+ note_anchor_names(docxml.xpath(ns("//annex//table | //annex//figure")))
8
+ note_anchor_names(docxml.xpath(ns("//annex")))
9
+ example_anchor_names(docxml.xpath(ns("//annex")))
10
+ list_anchor_names(docxml.xpath(ns("//annex")))
11
+ else
12
+ super
13
+ end
14
+ end
15
+
16
+ def initial_anchor_names(d)
17
+ super
18
+ introduction_names(d.at(ns("//introduction")))
19
+ end
20
+
21
+ # we can reference 0-number clauses in introduction
22
+ def introduction_names(clause)
23
+ return if clause.nil?
24
+ clause.xpath(ns("./clause")).each_with_index do |c, i|
25
+ section_names1(c, "0.#{i + 1}", 2)
26
+ end
27
+ end
28
+
29
+ def annex_names(clause, num)
30
+ appendix_names(clause, num)
31
+ super
32
+ end
33
+
34
+ def appendix_names(clause, num)
35
+ clause.xpath(ns("./appendix")).each_with_index do |c, i|
36
+ @anchors[c["id"]] = anchor_struct(i + 1, nil, @appendix_lbl, "clause")
37
+ @anchors[c["id"]][:level] = 2
38
+ @anchors[c["id"]][:container] = clause["id"]
39
+ end
40
+ end
41
+
42
+ def section_names1(clause, num, level)
43
+ @anchors[clause["id"]] =
44
+ { label: num, level: level, xref: num }
45
+ # subclauses are not prefixed with "Clause"
46
+ clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
47
+ "./references")).
48
+ each_with_index do |c, i|
49
+ section_names1(c, "#{num}.#{i + 1}", level + 1)
50
+ end
51
+ end
52
+
53
+ def annex_names1(clause, num, level)
54
+ @anchors[clause["id"]] = { label: num, xref: num, level: level }
55
+ clause.xpath(ns("./clause | ./references")).each_with_index do |c, i|
56
+ annex_names1(c, "#{num}.#{i + 1}", level + 1)
57
+ end
58
+ end
59
+
60
+ def hierarchical_formula_names(clause, num)
61
+ c = IsoDoc::Function::XrefGen::Counter.new
62
+ clause.xpath(ns(".//formula")).each do |t|
63
+ next if t["id"].nil? || t["id"].empty?
64
+ @anchors[t["id"]] =
65
+ anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
66
+ t["inequality"] ? @inequality_lbl : @formula_lbl,
67
+ "formula", t["unnumbered"])
68
+ end
69
+ end
70
+
71
+ def figure_anchor(t, sublabel, label)
72
+ @anchors[t["id"]] = anchor_struct(
73
+ (sublabel ? "#{label} #{sublabel}" : label),
74
+ nil, @figure_lbl, "figure", t["unnumbered"])
75
+ sublabel && t["unnumbered"] != "true" and
76
+ @anchors[t["id"]][:label] = sublabel
77
+ end
78
+
79
+ def sequential_figure_names(clause)
80
+ c = IsoDoc::Function::XrefGen::Counter.new
81
+ j = 0
82
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
83
+ each do |t|
84
+ j = subfigure_increment(j, c, t)
85
+ sublabel = j.zero? ? nil : "#{(j+96).chr})"
86
+ next if t["id"].nil? || t["id"].empty?
87
+ figure_anchor(t, sublabel, c.print)
88
+ end
89
+ end
90
+
91
+ def hierarchical_figure_names(clause, num)
92
+ c = IsoDoc::Function::XrefGen::Counter.new
93
+ j = 0
94
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
95
+ each do |t|
96
+ j = subfigure_increment(j, c, t)
97
+ label = "#{num}#{hiersep}#{c.print}"
98
+ sublabel = j.zero? ? nil : "#{(j+96).chr})"
99
+ next if t["id"].nil? || t["id"].empty?
100
+ figure_anchor(t, sublabel, label)
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.3.26".freeze
3
+ VERSION = "1.3.27".freeze
4
4
  end
5
5
  end
@@ -241,7 +241,7 @@ OUTPUT
241
241
  d’échantillon et recommandations relatives aux conditions d’entreposage et
242
242
  de transport
243
243
  </title>
244
- <docidentifier type='iso'>ISO 17301-1:2016/PreNP Amd 1</docidentifier>
244
+ <docidentifier type='ISO'>ISO 17301-1:2016/PreNP Amd 1</docidentifier>
245
245
  <docidentifier type='iso-with-lang'>ISO 17301-1:2016/PreNP Amd 1(E)</docidentifier>
246
246
  <docidentifier type='iso-reference'>ISO 17301-1:2016/PreNP Amd 1:2017(E)</docidentifier>
247
247
  <docnumber>17301</docnumber>
@@ -332,7 +332,7 @@ Author
332
332
  INPUT
333
333
  <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
334
334
  <bibdata type='standard'>
335
- <docidentifier type='iso'>ISO 17301-1:2030/CD Amd 1</docidentifier>
335
+ <docidentifier type='ISO'>ISO 17301-1:2030/CD Amd 1</docidentifier>
336
336
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/CD Amd 1(E)</docidentifier>
337
337
  <docidentifier type='iso-reference'>ISO 17301-1:2030/CD Amd 1(E)</docidentifier>
338
338
  <docnumber>17301</docnumber>
@@ -400,7 +400,7 @@ Author
400
400
  INPUT
401
401
  <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
402
402
  <bibdata type='standard'>
403
- <docidentifier type='iso'>ISO 17301-1:2030/DAmd 1</docidentifier>
403
+ <docidentifier type='ISO'>ISO 17301-1:2030/DAmd 1</docidentifier>
404
404
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/DAmd 1(E)</docidentifier>
405
405
  <docidentifier type='iso-reference'>ISO 17301-1:2030/DAmd 1(E)</docidentifier>
406
406
  <docnumber>17301</docnumber>
@@ -467,7 +467,7 @@ Author
467
467
  INPUT
468
468
  <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
469
469
  <bibdata type='standard'>
470
- <docidentifier type='iso'>ISO 17301-1:2030/Amd 1</docidentifier>
470
+ <docidentifier type='ISO'>ISO 17301-1:2030/Amd 1</docidentifier>
471
471
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/Amd 1(E)</docidentifier>
472
472
  <docidentifier type='iso-reference'>ISO 17301-1:2030/Amd 1(E)</docidentifier>
473
473
  <docnumber>17301</docnumber>
@@ -535,7 +535,7 @@ Author
535
535
  INPUT
536
536
  <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
537
537
  <bibdata type='standard'>
538
- <docidentifier type='iso'>ISO 17301-1:2030/CD Cor.3</docidentifier>
538
+ <docidentifier type='ISO'>ISO 17301-1:2030/CD Cor.3</docidentifier>
539
539
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/CD Cor.3(E)</docidentifier>
540
540
  <docidentifier type='iso-reference'>ISO 17301-1:2030/CD Cor.3(E)</docidentifier>
541
541
  <docnumber>17301</docnumber>
@@ -603,7 +603,7 @@ Author
603
603
  INPUT
604
604
  <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
605
605
  <bibdata type='standard'>
606
- <docidentifier type='iso'>ISO 17301-1:2030/FDCor.3</docidentifier>
606
+ <docidentifier type='ISO'>ISO 17301-1:2030/FDCor.3</docidentifier>
607
607
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/FDCor.3(E)</docidentifier>
608
608
  <docidentifier type='iso-reference'>ISO 17301-1:2030/FDCor.3(E)</docidentifier>
609
609
  <docnumber>17301</docnumber>
@@ -670,7 +670,7 @@ Author
670
670
  INPUT
671
671
  <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
672
672
  <bibdata type='standard'>
673
- <docidentifier type='iso'>ISO 17301-1:2030/Cor.3</docidentifier>
673
+ <docidentifier type='ISO'>ISO 17301-1:2030/Cor.3</docidentifier>
674
674
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/Cor.3(E)</docidentifier>
675
675
  <docidentifier type='iso-reference'>ISO 17301-1:2030/Cor.3(E)</docidentifier>
676
676
  <docnumber>17301</docnumber>