metanorma-iso 2.0.8.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html2doc/lists.rb +169 -0
- data/lib/isodoc/iso/base_convert.rb +11 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +7 -0
- data/lib/isodoc/iso/html/isodoc-dis.css +407 -427
- data/lib/isodoc/iso/html/isodoc-dis.scss +482 -438
- data/lib/isodoc/iso/html/isodoc.css +38 -13
- data/lib/isodoc/iso/html/isodoc.scss +38 -12
- data/lib/isodoc/iso/html/style-human.css +14 -1
- data/lib/isodoc/iso/html/style-human.scss +10 -1
- data/lib/isodoc/iso/html/style-iso.css +35 -23
- data/lib/isodoc/iso/html/style-iso.scss +31 -23
- data/lib/isodoc/iso/html/word_iso_intro-dis.html +3 -1
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +26 -13
- data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +16 -6
- data/lib/isodoc/iso/html/wordstyle-dis.css +168 -48
- data/lib/isodoc/iso/html/wordstyle-dis.scss +158 -43
- data/lib/isodoc/iso/html_convert.rb +7 -2
- data/lib/isodoc/iso/i18n-en.yaml +33 -4
- data/lib/isodoc/iso/i18n-fr.yaml +30 -3
- data/lib/isodoc/iso/i18n-ru.yaml +33 -4
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +33 -3
- data/lib/isodoc/iso/i18n.rb +1 -1
- data/lib/isodoc/iso/init.rb +17 -1
- data/lib/isodoc/iso/iso.amendment.xsl +1711 -367
- data/lib/isodoc/iso/iso.international-standard.xsl +1711 -367
- data/lib/isodoc/iso/metadata.rb +72 -78
- data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
- data/lib/isodoc/iso/presentation_xml_convert.rb +52 -100
- data/lib/isodoc/iso/presentation_xref.rb +132 -0
- data/lib/isodoc/iso/sections.rb +3 -3
- data/lib/isodoc/iso/word_cleanup.rb +17 -0
- data/lib/isodoc/iso/word_convert.rb +32 -12
- data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
- data/lib/isodoc/iso/word_dis_convert.rb +122 -0
- data/lib/isodoc/iso/xref.rb +78 -29
- data/lib/metanorma/iso/base.rb +20 -1
- data/lib/metanorma/iso/biblio.rng +69 -42
- data/lib/metanorma/iso/boilerplate-fr.xml +4 -1
- data/lib/metanorma/iso/boilerplate-ru.xml +4 -3
- data/lib/metanorma/iso/boilerplate.xml +4 -3
- data/lib/metanorma/iso/cleanup.rb +29 -1
- data/lib/metanorma/iso/front.rb +31 -6
- data/lib/metanorma/iso/front_id.rb +2 -0
- data/lib/metanorma/iso/isodoc.rng +65 -0
- data/lib/metanorma/iso/isostandard.rng +30 -12
- data/lib/metanorma/iso/macros.rb +29 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/metanorma-iso.rb +1 -0
- data/lib/relaton/render/config.yml +4 -0
- data/lib/relaton/render/general.rb +13 -0
- data/metanorma-iso.gemspec +1 -1
- data/spec/isodoc/amd_spec.rb +35 -60
- data/spec/isodoc/blocks_spec.rb +783 -179
- data/spec/isodoc/i18n_spec.rb +331 -100
- data/spec/isodoc/inline_spec.rb +35 -42
- data/spec/isodoc/iso_spec.rb +51 -170
- data/spec/isodoc/metadata_spec.rb +240 -99
- data/spec/isodoc/postproc_spec.rb +68 -7
- data/spec/isodoc/ref_spec.rb +66 -69
- data/spec/isodoc/section_spec.rb +88 -80
- data/spec/isodoc/table_spec.rb +2 -2
- data/spec/isodoc/terms_spec.rb +2 -2
- data/spec/isodoc/word_dis_spec.rb +1886 -0
- data/spec/isodoc/xref_spec.rb +138 -64
- data/spec/metanorma/amd_spec.rb +53 -1
- data/spec/metanorma/base_spec.rb +195 -20
- data/spec/metanorma/blocks_spec.rb +54 -0
- data/spec/metanorma/lists_spec.rb +2 -2
- data/spec/metanorma/section_spec.rb +2 -2
- data/spec/spec_helper.rb +23 -4
- data/spec/vcr_cassettes/withdrawn_iso.yml +25 -25
- metadata +15 -10
- data/docs/asciiiso-syntax.adoc +0 -307
- data/docs/guidance.adoc +0 -487
- data/docs/navigation.adoc +0 -23
- data/docs/quickstart.adoc +0 -179
- data/spec/vcr_cassettes/docrels.yml +0 -385
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43eeca2b2e24e0d8d1681a52ad493218736544151b9d440e4a38343dae49e22b
|
4
|
+
data.tar.gz: 79241bc11b898d70a969f984646e3aded85b0bf1a7fd9d56f73b359e84e36f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27b8c022d5e76b1d1d91ed48a2d7f95246df401c8ede504244387500ab371dd05fc0c6c71fb47d955059004321a9192ebd7d532ee593d46ccd594a0df3b654e2
|
7
|
+
data.tar.gz: 4f5d8ce30167455dd18418b82120ec7597d1daafde97b781d1b50b71d42a616754317c8faa6fd3906b35dcf040afc53bdad0c9f06d75b45784fb49fd7db33136
|
@@ -0,0 +1,169 @@
|
|
1
|
+
class Html2Doc
|
2
|
+
class IsoDIS < ::Html2Doc
|
3
|
+
def list2para(list)
|
4
|
+
return if list.xpath("./li").empty?
|
5
|
+
|
6
|
+
list.xpath("./li").each do |l|
|
7
|
+
list2para_level(l, list)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def list2para_level(item, list)
|
12
|
+
level = item["level"]
|
13
|
+
item.delete("level")
|
14
|
+
item.name = "p"
|
15
|
+
list2para_nest(item, level, list) if level
|
16
|
+
end
|
17
|
+
|
18
|
+
def list2para_nest(item, level, list)
|
19
|
+
item["class"] = list2para_style(list.name, level)
|
20
|
+
item.xpath("./p").each do |p|
|
21
|
+
p["class"] = list2para_style(list.name, level)
|
22
|
+
end
|
23
|
+
p1 = item.at("./p") or return
|
24
|
+
prev = p1.xpath("./preceding-sibling::* | ./preceding-sibling::text()")
|
25
|
+
if prev[-1].name == "span" && prev[-1]["style"] == "mso-tab-count:1" &&
|
26
|
+
prev.size == 2
|
27
|
+
p1.children.first.previous = prev[1]
|
28
|
+
p1.children.first.previous = prev[0]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def list2para_unnest_para(para, first_p, last_p)
|
33
|
+
return if last_p.xpath("./following-sibling::* | ./following-sibling::text()")
|
34
|
+
.any? do |x|
|
35
|
+
!x.text.strip.empty?
|
36
|
+
end
|
37
|
+
|
38
|
+
prev = first_p.xpath("./preceding-sibling::* | ./preceding-sibling::text()")
|
39
|
+
# bullet, tab, paragraph: ignore bullet, tab
|
40
|
+
return if prev.any? { |x| !x.text.strip.empty? }
|
41
|
+
|
42
|
+
para.replace(para.children)
|
43
|
+
end
|
44
|
+
|
45
|
+
def list2para_style(listtype, depth)
|
46
|
+
case listtype
|
47
|
+
when "ul"
|
48
|
+
case depth
|
49
|
+
when "1" then "ListContinue1"
|
50
|
+
when "2", "3", "4" then "MsoListContinue#{depth}"
|
51
|
+
else "MsoListContinue5"
|
52
|
+
end
|
53
|
+
when "ol"
|
54
|
+
case depth
|
55
|
+
when "1" then "ListNumber1"
|
56
|
+
when "2", "3", "4" then "MsoListNumber#{depth}"
|
57
|
+
else "MsoListNumber5"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def lists(docxml, liststyles)
|
63
|
+
super
|
64
|
+
docxml.xpath("//p[ol | ul]").each do |p|
|
65
|
+
list2para_unnest_para(p, p.at("./ol | ./ul"),
|
66
|
+
p.at("./*[name() = 'ul' or name() = 'ol'][last()]"))
|
67
|
+
end
|
68
|
+
docxml.xpath("//ol | //ul").each do |u|
|
69
|
+
u.replace(u.children)
|
70
|
+
end
|
71
|
+
unnest_list_paras(docxml)
|
72
|
+
indent_lists(docxml)
|
73
|
+
end
|
74
|
+
|
75
|
+
def unnest_list_paras(docxml)
|
76
|
+
docxml.xpath("//p[@class = 'ListContinue1' or @class = 'ListNumber1']"\
|
77
|
+
"[.//p]").each do |p|
|
78
|
+
p.at("./p") and
|
79
|
+
list2para_unnest_para(p, p.at("./p"),
|
80
|
+
p.at("./p[last()]"))
|
81
|
+
p.xpath(".//p[p]").each do |p1|
|
82
|
+
list2para_unnest_para(p1, p1.at("./p"),
|
83
|
+
p1.at("./p[last()]"))
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def indent_lists(docxml)
|
89
|
+
docxml.xpath("//div[@class = 'Note' or @class = 'Example' or "\
|
90
|
+
"@class = 'Quote']").each do |d|
|
91
|
+
d.xpath(".//p").each do |p|
|
92
|
+
indent_lists1(p)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def indent_lists1(para)
|
98
|
+
m = /^(ListContinue|ListNumber|MsoListContinue|MsoListNumber)(\d)$/
|
99
|
+
.match(para["class"]) or return
|
100
|
+
base = m[1].sub(/^Mso/, "")
|
101
|
+
level = m[2].to_i + 1
|
102
|
+
level = 5 if level > 5
|
103
|
+
para["class"] = "#{base}#{level}-"
|
104
|
+
end
|
105
|
+
|
106
|
+
def list_add(xpath, liststyles, listtype, level)
|
107
|
+
xpath.each do |l|
|
108
|
+
l["seen"] = true if level == 1
|
109
|
+
l["id"] ||= UUIDTools::UUID.random_create
|
110
|
+
list_add_number(l, liststyles, listtype, level)
|
111
|
+
list_add_tail(l, liststyles, listtype, level)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def list_add_number(list, liststyles, listtype, level)
|
116
|
+
i = list["start"] ? list["start"].to_i - 1 : 0
|
117
|
+
(list.xpath(".//li") - list.xpath(".//ol//li | .//ul//li")).each do |li|
|
118
|
+
i = style_list_iso(li, level, listtype, i)
|
119
|
+
list_add1(li, liststyles, listtype, level)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def list_add_tail(list, liststyles, listtype, level)
|
124
|
+
list.xpath(".//ul[not(ancestor::li/ancestor::*/@id = '#{list['id']}')] | "\
|
125
|
+
".//ol[not(ancestor::li/ancestor::*/@id = '#{list['id']}')]")
|
126
|
+
.each do |li|
|
127
|
+
list_add1(li.parent, liststyles, listtype, level - 1)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def style_list_iso(elem, level, listtype, idx)
|
132
|
+
return idx if elem.at(".//ol | .//ul") && !elem.at("./p")
|
133
|
+
|
134
|
+
idx += 1
|
135
|
+
ol = elem.xpath("./ancestor::ol")&.last
|
136
|
+
label = listlabel(listtype, idx, ol ? ol["type"] : nil)
|
137
|
+
elem.children.first.previous =
|
138
|
+
"#{label}<span style='mso-tab-count:1'> </span>"
|
139
|
+
elem["level"] = level
|
140
|
+
idx
|
141
|
+
end
|
142
|
+
|
143
|
+
def listlabel(listtype, idx, level)
|
144
|
+
case listtype
|
145
|
+
when :ul then "—"
|
146
|
+
when :ol then "#{listidx(idx, level)})"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def listidx(idx, level)
|
151
|
+
case level
|
152
|
+
when "a" then (96 + idx).chr.to_s
|
153
|
+
when "1" then idx.to_s
|
154
|
+
when "i" then RomanNumerals.to_roman(idx).downcase
|
155
|
+
when "A" then (64 + idx).chr.to_s
|
156
|
+
when "I" then RomanNumerals.to_roman(idx).upcase
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def cleanup(docxml)
|
161
|
+
super
|
162
|
+
docxml.xpath("//div[@class = 'Quote' or @class = 'Example' or "\
|
163
|
+
"@class = 'Note']").each do |d|
|
164
|
+
d.delete("class")
|
165
|
+
end
|
166
|
+
docxml
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -112,6 +112,12 @@ module IsoDoc
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
def admonition_class(node)
|
116
|
+
if node["type"] == "editorial" then "zzHelp"
|
117
|
+
else super
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
115
121
|
def admonition_parse1(node, div, name)
|
116
122
|
div.p do |p|
|
117
123
|
admonition_name_parse(node, p, name) if name
|
@@ -129,7 +135,7 @@ module IsoDoc
|
|
129
135
|
|
130
136
|
def admonition_name_parse(_node, div, name)
|
131
137
|
name.children.each { |n| parse(n, div) }
|
132
|
-
div << "
|
138
|
+
div << " — "
|
133
139
|
end
|
134
140
|
|
135
141
|
def figure_name_parse(_node, div, name)
|
@@ -177,6 +183,10 @@ module IsoDoc
|
|
177
183
|
clause_parse(i, out)
|
178
184
|
end
|
179
185
|
end
|
186
|
+
|
187
|
+
def ol_attrs(node)
|
188
|
+
super.merge(start: node["start"]).compact
|
189
|
+
end
|
180
190
|
end
|
181
191
|
end
|
182
192
|
end
|
@@ -7,6 +7,10 @@
|
|
7
7
|
<p class="coverpage_docnumber">{{ docnumber_undated }} {{ draftinfo }}</p>
|
8
8
|
{% endif %}
|
9
9
|
|
10
|
+
{% if edition_display %}
|
11
|
+
<p class="coverpage_docnumber">{{ edition_display | capitalize }}</p>
|
12
|
+
{% endif %}
|
13
|
+
|
10
14
|
{% if revdate %}
|
11
15
|
<p class="coverpage_docnumber">{{ labels["date"]}}: {{ revdate }}</p>
|
12
16
|
{% endif %}
|
@@ -17,8 +21,10 @@
|
|
17
21
|
|
18
22
|
<p class="coverpage_techcommittee">{{ agency }}/{{ editorialgroup | join: "/" }}</p>
|
19
23
|
|
24
|
+
{% if secretariat %}
|
20
25
|
<p class="coverpage_techcommittee"><a
|
21
26
|
name="CVP_Secretariat_Loca">{{ labels["secretariat"] }}</a>: {{ secretariat }}</p>
|
27
|
+
{% endif %}
|
22
28
|
|
23
29
|
<div class="doctitle-en"><div><span class="title">{{ doctitleintro }}{% if doctitleintro and doctitlemain %} — {% endif %}</span><span class="subtitle">{{ doctitlemain }}{% if doctitlemain and doctitlepart %} —{% endif %}</span>
|
24
30
|
{% if doctitlepart %}
|
@@ -61,6 +67,7 @@
|
|
61
67
|
<div id="boilerplate-license-destination"/>
|
62
68
|
</div>
|
63
69
|
{% endif %}
|
70
|
+
<div class="coverpage-warning" id="coverpage-note-destination"/>
|
64
71
|
|
65
72
|
{% if ics %}
|
66
73
|
<p><b>ICS:</b> {{ ics }}</p>
|