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 +4 -4
- data/lib/html2doc/lists.rb +9 -7
- data/lib/isodoc/iso/base_convert.rb +42 -24
- data/lib/isodoc/iso/html/style-human.css +8 -0
- data/lib/isodoc/iso/html/style-human.scss +6 -0
- data/lib/isodoc/iso/html/style-iso.css +8 -0
- data/lib/isodoc/iso/html/style-iso.scss +7 -0
- data/lib/isodoc/iso/html/wordstyle-dis.css +16 -0
- data/lib/isodoc/iso/html/wordstyle-dis.scss +14 -0
- data/lib/isodoc/iso/html/wordstyle.css +16 -0
- data/lib/isodoc/iso/html/wordstyle.scss +14 -0
- data/lib/isodoc/iso/html_convert.rb +13 -0
- data/lib/isodoc/iso/iso.amendment.xsl +417 -146
- data/lib/isodoc/iso/iso.international-standard.xsl +417 -146
- data/lib/isodoc/iso/presentation_xml_convert.rb +21 -0
- data/lib/isodoc/iso/sections.rb +6 -6
- data/lib/isodoc/iso/word_cleanup.rb +12 -2
- data/lib/isodoc/iso/word_convert.rb +44 -9
- data/lib/isodoc/iso/xref.rb +22 -4
- data/lib/metanorma/iso/base.rb +5 -0
- data/lib/metanorma/iso/biblio.rng +11 -1
- data/lib/metanorma/iso/cleanup.rb +8 -20
- data/lib/metanorma/iso/front_id.rb +8 -4
- data/lib/metanorma/iso/isodoc.rng +56 -296
- data/lib/metanorma/iso/isostandard.rng +1 -8
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 933e6aa82c5ca8cef1a5ead9829cb1b754fd96a4ca96e9949bd3159bb314ae63
|
4
|
+
data.tar.gz: f39b54e13cbcd0f15c31808a8d3a94bafbb6d9834e0e6bd7cb73851643b590e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f46dc0381b71de56114fa2749729ee78a9a7c3f02d5a11d9c8ac97cead706d7e96a4ebeda77fc4f05843c44585f9c014447c954e519b34ba4337cf00c6af2f3
|
7
|
+
data.tar.gz: 4564b27b84fe80c5e15c817f3bb8d33daffb0e0fb0fa590983da1abf11c5fc8e97eff593a3ab3191c589c28f1c34fd5cd26818070d202dfc2f4f1ab96ad14ff8
|
data/lib/html2doc/lists.rb
CHANGED
@@ -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.
|
141
|
-
|
140
|
+
unless elem.at("./ancestor::div[@class = 'index']") # indexsect
|
141
|
+
elem.children.first.previous =
|
142
|
+
"#{label}<span style='mso-tab-count:1'> </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
|
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
|
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
|
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
|
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(
|
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
|
*/
|
@@ -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
|
*/
|
@@ -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|
|