metanorma-iso 2.1.0 → 2.1.3
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 +145 -10
- data/lib/isodoc/iso/base_convert.rb +11 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
- data/lib/isodoc/iso/html/isodoc-dis.css +216 -278
- data/lib/isodoc/iso/html/isodoc-dis.scss +294 -288
- 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 +1 -6
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +24 -13
- data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +10 -6
- data/lib/isodoc/iso/html/wordstyle-dis.css +12 -62
- data/lib/isodoc/iso/html/wordstyle-dis.scss +7 -56
- data/lib/isodoc/iso/html_convert.rb +7 -2
- data/lib/isodoc/iso/i18n-en.yaml +32 -4
- data/lib/isodoc/iso/i18n-fr.yaml +29 -3
- data/lib/isodoc/iso/i18n-ru.yaml +32 -4
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
- data/lib/isodoc/iso/i18n.rb +1 -1
- data/lib/isodoc/iso/iso.amendment.xsl +1570 -246
- data/lib/isodoc/iso/iso.international-standard.xsl +1570 -246
- data/lib/isodoc/iso/metadata.rb +67 -67
- data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
- data/lib/isodoc/iso/presentation_xml_convert.rb +16 -5
- data/lib/isodoc/iso/presentation_xref.rb +10 -4
- data/lib/isodoc/iso/sections.rb +3 -3
- data/lib/isodoc/iso/word_cleanup.rb +3 -0
- data/lib/isodoc/iso/word_convert.rb +8 -5
- data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
- data/lib/isodoc/iso/word_dis_convert.rb +48 -100
- data/lib/isodoc/iso/xref.rb +34 -6
- data/lib/metanorma/iso/base.rb +20 -1
- data/lib/metanorma/iso/biblio.rng +134 -39
- data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
- data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
- data/lib/metanorma/iso/boilerplate.xml +3 -0
- data/lib/metanorma/iso/cleanup.rb +49 -11
- data/lib/metanorma/iso/front.rb +38 -6
- data/lib/metanorma/iso/front_id.rb +2 -0
- data/lib/metanorma/iso/isodoc.rng +16 -0
- data/lib/metanorma/iso/isostandard.rng +30 -12
- data/lib/metanorma/iso/macros.rb +29 -0
- data/lib/metanorma/iso/validate_section.rb +0 -12
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/isodoc/amd_spec.rb +20 -46
- data/spec/isodoc/blocks_spec.rb +499 -2
- data/spec/isodoc/i18n_spec.rb +145 -80
- data/spec/isodoc/iso_spec.rb +50 -169
- data/spec/isodoc/metadata_spec.rb +240 -99
- data/spec/isodoc/postproc_spec.rb +43 -7
- data/spec/isodoc/section_spec.rb +9 -9
- data/spec/isodoc/word_dis_spec.rb +1332 -146
- data/spec/isodoc/xref_spec.rb +87 -13
- data/spec/metanorma/amd_spec.rb +39 -23
- data/spec/metanorma/base_spec.rb +174 -44
- 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/metanorma/validate_spec.rb +8 -19
- data/spec/spec_helper.rb +17 -7
- data/spec/vcr_cassettes/withdrawn_iso.yml +30 -30
- metadata +7 -8
- 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/lib/isodoc/iso/presentation_inline.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5af2d1e84ef187d29c8adb59589006fe83a313db249d03f1b972f2c24f55026e
|
4
|
+
data.tar.gz: 24e56ffa73fb96734cfb1d9990bd97d404707119714cd4c95541d6b60022e6cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 771062f88d67f10235c8d23df932c4ce0e55f75df7d090e411739729b5d28291f51b453efd0e0a16490d1fbf18d83d0d1cfea1e3308cdc36d137c30b80f1a141
|
7
|
+
data.tar.gz: 7a14ad2b9b71991608d0af4ba011c86f1f89bbde21f00e4ee62b6aa975d60c27a9db2cfcbf9701bedfde08f3aeda9b32072c8e39a2c08d4cc8bac8542cf651dc
|
data/lib/html2doc/lists.rb
CHANGED
@@ -4,17 +4,45 @@ class Html2Doc
|
|
4
4
|
return if list.xpath("./li").empty?
|
5
5
|
|
6
6
|
list.xpath("./li").each do |l|
|
7
|
-
l
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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::* | "\
|
39
|
+
"./preceding-sibling::text()[normalize-space()]")
|
40
|
+
# bullet, tab, paragraph: ignore bullet, tab
|
41
|
+
if prev.empty? then para.replace(para.children)
|
42
|
+
elsif prev.size == 2 && prev[-1].name == "span" &&
|
43
|
+
prev[-1]["style"] == "mso-tab-count:1"
|
44
|
+
first_p.replace(first_p.children)
|
16
45
|
end
|
17
|
-
list.replace(list.children)
|
18
46
|
end
|
19
47
|
|
20
48
|
def list2para_style(listtype, depth)
|
@@ -33,5 +61,112 @@ class Html2Doc
|
|
33
61
|
end
|
34
62
|
end
|
35
63
|
end
|
64
|
+
|
65
|
+
def lists(docxml, liststyles)
|
66
|
+
super
|
67
|
+
docxml.xpath("//p[ol | ul]").each do |p|
|
68
|
+
list2para_unnest_para(p, p.at("./ol | ./ul"),
|
69
|
+
p.at("./*[name() = 'ul' or name() = 'ol'][last()]"))
|
70
|
+
end
|
71
|
+
docxml.xpath("//ol | //ul").each do |u|
|
72
|
+
u.replace(u.children)
|
73
|
+
end
|
74
|
+
unnest_list_paras(docxml)
|
75
|
+
indent_lists(docxml)
|
76
|
+
end
|
77
|
+
|
78
|
+
def unnest_list_paras(docxml)
|
79
|
+
docxml.xpath("//p[@class = 'ListContinue1' or @class = 'ListNumber1']"\
|
80
|
+
"[.//p]").each do |p|
|
81
|
+
p.at("./p") and
|
82
|
+
list2para_unnest_para(p, p.at("./p"),
|
83
|
+
p.at("./p[last()]"))
|
84
|
+
p.xpath(".//p[p]").each do |p1|
|
85
|
+
list2para_unnest_para(p1, p1.at("./p"),
|
86
|
+
p1.at("./p[last()]"))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def indent_lists(docxml)
|
92
|
+
docxml.xpath("//div[@class = 'Note' or @class = 'Example' or "\
|
93
|
+
"@class = 'Quote']").each do |d|
|
94
|
+
d.xpath(".//p").each do |p|
|
95
|
+
indent_lists1(p)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def indent_lists1(para)
|
101
|
+
m = /^(ListContinue|ListNumber|MsoListContinue|MsoListNumber)(\d)$/
|
102
|
+
.match(para["class"]) or return
|
103
|
+
base = m[1].sub(/^Mso/, "")
|
104
|
+
level = m[2].to_i + 1
|
105
|
+
level = 5 if level > 5
|
106
|
+
para["class"] = "#{base}#{level}-"
|
107
|
+
end
|
108
|
+
|
109
|
+
def list_add(xpath, liststyles, listtype, level)
|
110
|
+
xpath.each do |l|
|
111
|
+
l["seen"] = true if level == 1
|
112
|
+
l["id"] ||= UUIDTools::UUID.random_create
|
113
|
+
list_add_number(l, liststyles, listtype, level)
|
114
|
+
list_add_tail(l, liststyles, listtype, level)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def list_add_number(list, liststyles, listtype, level)
|
119
|
+
i = list["start"] ? list["start"].to_i - 1 : 0
|
120
|
+
(list.xpath(".//li") - list.xpath(".//ol//li | .//ul//li")).each do |li|
|
121
|
+
i = style_list_iso(li, level, listtype, i)
|
122
|
+
list_add1(li, liststyles, listtype, level)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def list_add_tail(list, liststyles, listtype, level)
|
127
|
+
list.xpath(".//ul[not(ancestor::li/ancestor::*/@id = '#{list['id']}')] | "\
|
128
|
+
".//ol[not(ancestor::li/ancestor::*/@id = '#{list['id']}')]")
|
129
|
+
.each do |li|
|
130
|
+
list_add1(li.parent, liststyles, listtype, level - 1)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def style_list_iso(elem, level, listtype, idx)
|
135
|
+
return idx if elem.at(".//ol | .//ul") && !elem.at("./p")
|
136
|
+
|
137
|
+
idx += 1
|
138
|
+
ol = elem.xpath("./ancestor::ol")&.last
|
139
|
+
label = listlabel(listtype, idx, ol ? ol["type"] : nil)
|
140
|
+
elem.children.first.previous =
|
141
|
+
"#{label}<span style='mso-tab-count:1'> </span>"
|
142
|
+
elem["level"] = level
|
143
|
+
idx
|
144
|
+
end
|
145
|
+
|
146
|
+
def listlabel(listtype, idx, level)
|
147
|
+
case listtype
|
148
|
+
when :ul then "—"
|
149
|
+
when :ol then "#{listidx(idx, level)})"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def listidx(idx, level)
|
154
|
+
case level
|
155
|
+
when "a" then (96 + idx).chr.to_s
|
156
|
+
when "1" then idx.to_s
|
157
|
+
when "i" then RomanNumerals.to_roman(idx).downcase
|
158
|
+
when "A" then (64 + idx).chr.to_s
|
159
|
+
when "I" then RomanNumerals.to_roman(idx).upcase
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def cleanup(docxml)
|
164
|
+
super
|
165
|
+
docxml.xpath("//div[@class = 'Quote' or @class = 'Example' or "\
|
166
|
+
"@class = 'Note']").each do |d|
|
167
|
+
d.delete("class")
|
168
|
+
end
|
169
|
+
docxml
|
170
|
+
end
|
36
171
|
end
|
37
172
|
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
|
@@ -21,8 +21,10 @@
|
|
21
21
|
|
22
22
|
<p class="coverpage_techcommittee">{{ agency }}/{{ editorialgroup | join: "/" }}</p>
|
23
23
|
|
24
|
+
{% if secretariat %}
|
24
25
|
<p class="coverpage_techcommittee"><a
|
25
26
|
name="CVP_Secretariat_Loca">{{ labels["secretariat"] }}</a>: {{ secretariat }}</p>
|
27
|
+
{% endif %}
|
26
28
|
|
27
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>
|
28
30
|
{% if doctitlepart %}
|