metanorma-iso 2.3.5 → 2.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec56973b9086f25dbaeeb4ec2561b59357fb180a912b7b4a81870c5432e81fb8
4
- data.tar.gz: 9828d23dd60b3ea444e9a23c2ef7caf7e6d819e42090812e5ab22384339794a4
3
+ metadata.gz: 933e6aa82c5ca8cef1a5ead9829cb1b754fd96a4ca96e9949bd3159bb314ae63
4
+ data.tar.gz: f39b54e13cbcd0f15c31808a8d3a94bafbb6d9834e0e6bd7cb73851643b590e7
5
5
  SHA512:
6
- metadata.gz: cff4f259add1f02c6915c4b013150529523a5f4e9b3c6e285061a1e8ae1205d183cc00fdadfb90ecddde9446b29f5350b8d1f1c02c4bef1106111de6065e35c4
7
- data.tar.gz: df7ca4b80cfad19b2171dc8eab675ebd8fb19b244ffdcb889325e9c31f835cd375d3cd2b849ca68e578078a2a80a54b7fc0eb485aff9c6fcc4d221eebfce7580
6
+ metadata.gz: 8f46dc0381b71de56114fa2749729ee78a9a7c3f02d5a11d9c8ac97cead706d7e96a4ebeda77fc4f05843c44585f9c014447c954e519b34ba4337cf00c6af2f3
7
+ data.tar.gz: 4564b27b84fe80c5e15c817f3bb8d33daffb0e0fb0fa590983da1abf11c5fc8e97eff593a3ab3191c589c28f1c34fd5cd26818070d202dfc2f4f1ab96ad14ff8
@@ -35,7 +35,7 @@ class Html2Doc
35
35
  !x.text.strip.empty?
36
36
  end
37
37
 
38
- prev = first_p.xpath("./preceding-sibling::* | "\
38
+ prev = first_p.xpath("./preceding-sibling::* | " \
39
39
  "./preceding-sibling::text()[normalize-space()]")
40
40
  # bullet, tab, paragraph: ignore bullet, tab
41
41
  if prev.empty? then para.replace(para.children)
@@ -76,7 +76,7 @@ class Html2Doc
76
76
  end
77
77
 
78
78
  def unnest_list_paras(docxml)
79
- docxml.xpath("//p[@class = 'ListContinue1' or @class = 'ListNumber1']"\
79
+ docxml.xpath("//p[@class = 'ListContinue1' or @class = 'ListNumber1']" \
80
80
  "[.//p]").each do |p|
81
81
  p.at("./p") and
82
82
  list2para_unnest_para(p, p.at("./p"),
@@ -89,7 +89,7 @@ class Html2Doc
89
89
  end
90
90
 
91
91
  def indent_lists(docxml)
92
- docxml.xpath("//div[@class = 'Note' or @class = 'Example' or "\
92
+ docxml.xpath("//div[@class = 'Note' or @class = 'Example' or " \
93
93
  "@class = 'Quote']").each do |d|
94
94
  d.xpath(".//p").each do |p|
95
95
  indent_lists1(p)
@@ -124,7 +124,7 @@ class Html2Doc
124
124
  end
125
125
 
126
126
  def list_add_tail(list, liststyles, listtype, level)
127
- list.xpath(".//ul[not(ancestor::li/ancestor::*/@id = '#{list['id']}')] | "\
127
+ list.xpath(".//ul[not(ancestor::li/ancestor::*/@id = '#{list['id']}')] | " \
128
128
  ".//ol[not(ancestor::li/ancestor::*/@id = '#{list['id']}')]")
129
129
  .each do |li|
130
130
  list_add1(li.parent, liststyles, listtype, level - 1)
@@ -137,8 +137,10 @@ class Html2Doc
137
137
  idx += 1
138
138
  ol = elem.xpath("./ancestor::ol")&.last
139
139
  label = listlabel(listtype, idx, ol ? ol["type"] : nil)
140
- elem.children.first.previous =
141
- "#{label}<span style='mso-tab-count:1'>&#xa0;</span>"
140
+ unless elem.at("./ancestor::div[@class = 'index']") # indexsect
141
+ elem.children.first.previous =
142
+ "#{label}<span style='mso-tab-count:1'>&#xa0;</span>"
143
+ end
142
144
  elem["level"] = level
143
145
  idx
144
146
  end
@@ -162,7 +164,7 @@ class Html2Doc
162
164
 
163
165
  def cleanup(docxml)
164
166
  super
165
- docxml.xpath("//div[@class = 'Quote' or @class = 'Example' or "\
167
+ docxml.xpath("//div[@class = 'Quote' or @class = 'Example' or " \
166
168
  "@class = 'Note']").each do |d|
167
169
  d.delete("class")
168
170
  end
@@ -31,7 +31,7 @@ module IsoDoc
31
31
  def example_span_label(_node, div, name)
32
32
  return if name.nil?
33
33
 
34
- div.span **{ class: "example_label" } do |p|
34
+ div.span class: "example_label" do |p|
35
35
  name.children.each { |n| parse(n, p) }
36
36
  end
37
37
  end
@@ -64,7 +64,7 @@ module IsoDoc
64
64
  end
65
65
 
66
66
  def example_parse(node, out)
67
- out.div **{ id: node["id"], class: "example" } do |div|
67
+ out.div id: node["id"], class: "example" do |div|
68
68
  if node_begins_with_para(node)
69
69
  example_p_parse(node, div)
70
70
  else
@@ -86,24 +86,10 @@ module IsoDoc
86
86
  end
87
87
  end
88
88
 
89
- def formula_where(dlist, out)
90
- return if dlist.nil?
91
- return super unless dlist.xpath(ns("./dt"))&.size == 1 &&
92
- dlist.at(ns("./dd"))&.elements&.size == 1 &&
93
- dlist.at(ns("./dd/p"))
94
-
95
- out.span **{ class: "zzMoveToFollowing" } do |s|
96
- s << "#{@i18n.where} "
97
- dlist.at(ns("./dt")).children.each { |n| parse(n, s) }
98
- s << " "
99
- end
100
- parse(dlist.at(ns("./dd/p")), out)
101
- end
102
-
103
89
  def admonition_parse(node, out)
104
90
  type = node["type"]
105
91
  name = admonition_name(node, type)
106
- out.div **{ id: node["id"], class: admonition_class(node) } do |div|
92
+ out.div id: node["id"], class: admonition_class(node) do |div|
107
93
  if node.first_element_child.name == "p"
108
94
  admonition_p_parse(node, div, name)
109
95
  else
@@ -139,7 +125,7 @@ module IsoDoc
139
125
  end
140
126
 
141
127
  def figure_name_parse(_node, div, name)
142
- div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
128
+ div.p class: "FigureTitle", style: "text-align:center;" do |p|
143
129
  name&.children&.each { |n| parse(n, p) }
144
130
  end
145
131
  end
@@ -149,16 +135,13 @@ module IsoDoc
149
135
  middle_admonitions(isoxml, out)
150
136
  i = scope isoxml, out, 0
151
137
  i = norm_ref isoxml, out, i
152
- # i = terms_defs isoxml, out, i
153
- # symbols_abbrevs isoxml, out, i
154
138
  clause_etc isoxml, out, i
155
139
  annex isoxml, out
156
140
  bibliography isoxml, out
157
- indexsect isoxml, out
158
141
  end
159
142
 
160
143
  def clause_etc(isoxml, out, num)
161
- isoxml.xpath(ns("//sections/clause[not(@type = 'scope')] | "\
144
+ isoxml.xpath(ns("//sections/clause[not(@type = 'scope')] | " \
162
145
  "//sections/terms | //sections/definitions"))
163
146
  .each do |f|
164
147
  clause_etc1(f, out, num)
@@ -171,7 +154,7 @@ module IsoDoc
171
154
  class: clause.name == "definitions" ? "Symbols" : nil,
172
155
  ) do |div|
173
156
  num = num + 1
174
- clause_name(num, clause&.at(ns("./title")), div, nil)
157
+ clause_name(clause, clause&.at(ns("./title")), div, nil)
175
158
  clause.elements.each do |e|
176
159
  parse(e, div) unless %w{title source}.include? e.name
177
160
  end
@@ -180,7 +163,6 @@ module IsoDoc
180
163
 
181
164
  def indexsect(isoxml, out)
182
165
  isoxml.xpath(ns("//indexsect")).each do |i|
183
- page_break(out)
184
166
  clause_parse(i, out)
185
167
  end
186
168
  end
@@ -194,6 +176,42 @@ module IsoDoc
194
176
  ret[:sdo] = std_docid_semantic(ret[:sdo])
195
177
  ret
196
178
  end
179
+
180
+ def table_parse(node, out)
181
+ @in_table = true
182
+ table_title_parse(node, out)
183
+ measurement_units(node, out)
184
+ out.table **table_attrs(node) do |t|
185
+ table_parse_core(node, t)
186
+ (dl = node.at(ns("./dl"))) && parse(dl, out)
187
+ node.xpath(ns("./note[not(@type = 'units')]"))
188
+ .each { |n| parse(n, out) }
189
+ end
190
+ @in_table = false
191
+ end
192
+
193
+ def figure_parse1(node, out)
194
+ measurement_units(node, out)
195
+ out.div **figure_attrs(node) do |div|
196
+ node.children.each do |n|
197
+ figure_key(out) if n.name == "dl"
198
+ next if n.name == "note" && n["type"] == "units"
199
+
200
+ parse(n, div) unless n.name == "name"
201
+ end
202
+ figure_name_parse(node, div, node.at(ns("./name")))
203
+ end
204
+ end
205
+
206
+ def measurement_units(node, out)
207
+ node.xpath(ns("./note[@type = 'units']")).each do |n|
208
+ out.div align: "right" do |p|
209
+ p.b do |b|
210
+ n.children.each { |e| parse(e, b) }
211
+ end
212
+ end
213
+ end
214
+ end
197
215
  end
198
216
  end
199
217
  end
@@ -124,6 +124,10 @@ a.FootnoteRef + a.FootnoteRef:before {
124
124
  content: ", ";
125
125
  vertical-align: super; }
126
126
 
127
+ a.TableFootnoteRef + a.TableFootnoteRef:before {
128
+ content: ", ";
129
+ vertical-align: super; }
130
+
127
131
  .addition {
128
132
  color: blue; }
129
133
 
@@ -623,6 +627,10 @@ div.figure {
623
627
  max-width: 100%;
624
628
  height: auto; }
625
629
 
630
+ table div.figure {
631
+ padding: 0;
632
+ margin: 0; }
633
+
626
634
  /*
627
635
  Document types + stages
628
636
  */
@@ -341,6 +341,12 @@ div.figure {
341
341
  @include figureBlock();
342
342
  }
343
343
 
344
+ table div.figure {
345
+ padding: 0;
346
+ margin: 0;
347
+ }
348
+
349
+
344
350
  /*
345
351
  Document types + stages
346
352
  */
@@ -124,6 +124,10 @@ a.FootnoteRef + a.FootnoteRef:before {
124
124
  content: ", ";
125
125
  vertical-align: super; }
126
126
 
127
+ a.TableFootnoteRef + a.TableFootnoteRef:before {
128
+ content: ", ";
129
+ vertical-align: super; }
130
+
127
131
  .addition {
128
132
  color: blue; }
129
133
 
@@ -575,6 +579,10 @@ div.figure {
575
579
  max-width: 100%;
576
580
  height: auto; }
577
581
 
582
+ table div.figure {
583
+ padding: 0;
584
+ margin: 0; }
585
+
578
586
  /*
579
587
  Document types + stages
580
588
  */
@@ -281,6 +281,13 @@ div.figure {
281
281
  @include figureBlock();
282
282
  }
283
283
 
284
+ table div.figure {
285
+ padding: 0;
286
+ margin: 0;
287
+ }
288
+
289
+
290
+
284
291
  /*
285
292
  Document types + stages
286
293
  */
@@ -2015,6 +2015,22 @@ div.WordSection3 {
2015
2015
  div.colophon {
2016
2016
  page: WordSection4; }
2017
2017
 
2018
+ @page WordSection5 {
2019
+ size: 595.3pt 841.9pt;
2020
+ margin: 39.7pt 53.85pt 1.0cm 53.85pt;
2021
+ mso-header-margin: 35.45pt;
2022
+ mso-footer-margin: 14.2pt;
2023
+ mso-page-numbers: 1;
2024
+ mso-columns: 2 even 36.0pt;
2025
+ mso-even-header: url("file:///C:/Doc/FILENAME_files/header.html") eh2;
2026
+ mso-header: url("file:///C:/Doc/FILENAME_files/header.html") h2;
2027
+ mso-even-footer: url("file:///C:/Doc/FILENAME_files/header.html") f4;
2028
+ mso-footer: url("file:///C:/Doc/FILENAME_files/header.html") f4;
2029
+ mso-paper-source: 0; }
2030
+
2031
+ div.index {
2032
+ page: WordSection5; }
2033
+
2018
2034
  /* List Definitions */
2019
2035
  @list l11 {
2020
2036
  mso-list-id: 145051656;
@@ -1902,6 +1902,20 @@ div.WordSection3
1902
1902
  mso-paper-source:0;}
1903
1903
  div.colophon
1904
1904
  {page:WordSection4;}
1905
+ @page WordSection5
1906
+ {size:595.3pt 841.9pt;
1907
+ margin:39.7pt 53.85pt 1.0cm 53.85pt;
1908
+ mso-header-margin:35.45pt;
1909
+ mso-footer-margin:14.2pt;
1910
+ mso-page-numbers:1;
1911
+ mso-columns:2 even 36.0pt;
1912
+ mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2;
1913
+ mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2;
1914
+ mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") f4;
1915
+ mso-footer:url("file:///C:/Doc/FILENAME_files/header.html") f4;
1916
+ mso-paper-source:0;}
1917
+ div.index
1918
+ {page:WordSection5;}
1905
1919
 
1906
1920
  /* List Definitions */
1907
1921
  @list l11
@@ -1457,6 +1457,22 @@ div.WordSection3 {
1457
1457
  div.colophon {
1458
1458
  page: WordSection4; }
1459
1459
 
1460
+ @page WordSection5 {
1461
+ size: 595.3pt 841.9pt;
1462
+ margin: 39.7pt 53.85pt 1.0cm 53.85pt;
1463
+ mso-header-margin: 35.45pt;
1464
+ mso-footer-margin: 14.2pt;
1465
+ mso-page-numbers: 1;
1466
+ mso-columns: 2 even 36.0pt;
1467
+ mso-even-header: url("file:///C:/Doc/FILENAME_files/header.html") eh2;
1468
+ mso-header: url("file:///C:/Doc/FILENAME_files/header.html") h2;
1469
+ mso-even-footer: url("file:///C:/Doc/FILENAME_files/header.html") f4;
1470
+ mso-footer: url("file:///C:/Doc/FILENAME_files/header.html") f4;
1471
+ mso-paper-source: 0; }
1472
+
1473
+ div.index {
1474
+ page: WordSection5; }
1475
+
1460
1476
  /* List Definitions */
1461
1477
  @list l0 {
1462
1478
  mso-list-id: 145051656;
@@ -1372,6 +1372,20 @@ div.WordSection3
1372
1372
  mso-paper-source:0;}
1373
1373
  div.colophon
1374
1374
  {page:WordSection4;}
1375
+ @page WordSection5
1376
+ {size:595.3pt 841.9pt;
1377
+ margin:39.7pt 53.85pt 1.0cm 53.85pt;
1378
+ mso-header-margin:35.45pt;
1379
+ mso-footer-margin:14.2pt;
1380
+ mso-page-numbers:1;
1381
+ mso-columns:2 even 36.0pt;
1382
+ mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2;
1383
+ mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2;
1384
+ mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") f4;
1385
+ mso-footer:url("file:///C:/Doc/FILENAME_files/header.html") f4;
1386
+ mso-paper-source:0;}
1387
+ div.index
1388
+ {page:WordSection5;}
1375
1389
 
1376
1390
  /* List Definitions */
1377
1391
  @list l0
@@ -61,6 +61,7 @@ module IsoDoc
61
61
  content = header.at("./following-sibling::p" \
62
62
  "[@class = 'variant-title-toc']") || header
63
63
  if level == "h1" &&
64
+ header.parent.name != "main" &&
64
65
  header.parent.at(".//h2#{toc_exclude_class}")
65
66
  <<~HDR
66
67
  <li class="#{level}"><div class="collapse-group"><a href="##{header['id']}">#{header_strip(content)}</a>
@@ -80,6 +81,18 @@ module IsoDoc
80
81
  docxml
81
82
  end
82
83
 
84
+ def middle(isoxml, out)
85
+ middle_title(isoxml, out)
86
+ middle_admonitions(isoxml, out)
87
+ scope isoxml, out, 0
88
+ norm_ref isoxml, out, 0
89
+ clause_etc isoxml, out, 0
90
+ annex isoxml, out
91
+ bibliography isoxml, out
92
+ indexsect isoxml, out
93
+ end
94
+
95
+
83
96
  def html_toc1(ulist)
84
97
  u2 = nil
85
98
  ulist.xpath("./li").each do |l|