metanorma-iso 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +142 -10
  3. data/lib/isodoc/iso/base_convert.rb +10 -0
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +170 -252
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +170 -245
  7. data/lib/isodoc/iso/html/isodoc.css +38 -13
  8. data/lib/isodoc/iso/html/isodoc.scss +38 -12
  9. data/lib/isodoc/iso/html/style-human.css +14 -1
  10. data/lib/isodoc/iso/html/style-human.scss +10 -1
  11. data/lib/isodoc/iso/html/style-iso.css +35 -23
  12. data/lib/isodoc/iso/html/style-iso.scss +31 -23
  13. data/lib/isodoc/iso/html/word_iso_intro-dis.html +1 -6
  14. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +24 -13
  15. data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
  16. data/lib/isodoc/iso/html/word_iso_titlepage.html +6 -2
  17. data/lib/isodoc/iso/html_convert.rb +5 -0
  18. data/lib/isodoc/iso/i18n-en.yaml +32 -4
  19. data/lib/isodoc/iso/i18n-fr.yaml +29 -3
  20. data/lib/isodoc/iso/i18n-ru.yaml +32 -4
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
  22. data/lib/isodoc/iso/i18n.rb +1 -1
  23. data/lib/isodoc/iso/iso.amendment.xsl +332 -187
  24. data/lib/isodoc/iso/iso.international-standard.xsl +332 -187
  25. data/lib/isodoc/iso/metadata.rb +63 -63
  26. data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
  27. data/lib/isodoc/iso/presentation_xml_convert.rb +14 -3
  28. data/lib/isodoc/iso/presentation_xref.rb +8 -2
  29. data/lib/isodoc/iso/sections.rb +1 -1
  30. data/lib/isodoc/iso/word_cleanup.rb +3 -0
  31. data/lib/isodoc/iso/word_convert.rb +6 -3
  32. data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
  33. data/lib/isodoc/iso/word_dis_convert.rb +47 -108
  34. data/lib/isodoc/iso/xref.rb +34 -6
  35. data/lib/metanorma/iso/base.rb +20 -1
  36. data/lib/metanorma/iso/biblio.rng +32 -34
  37. data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
  38. data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
  39. data/lib/metanorma/iso/boilerplate.xml +3 -0
  40. data/lib/metanorma/iso/cleanup.rb +28 -1
  41. data/lib/metanorma/iso/front.rb +31 -6
  42. data/lib/metanorma/iso/front_id.rb +2 -0
  43. data/lib/metanorma/iso/isodoc.rng +9 -0
  44. data/lib/metanorma/iso/isostandard.rng +30 -12
  45. data/lib/metanorma/iso/macros.rb +29 -0
  46. data/lib/metanorma/iso/version.rb +1 -1
  47. data/spec/isodoc/amd_spec.rb +4 -30
  48. data/spec/isodoc/blocks_spec.rb +499 -2
  49. data/spec/isodoc/i18n_spec.rb +145 -80
  50. data/spec/isodoc/iso_spec.rb +50 -169
  51. data/spec/isodoc/metadata_spec.rb +224 -83
  52. data/spec/isodoc/postproc_spec.rb +41 -5
  53. data/spec/isodoc/section_spec.rb +12 -6
  54. data/spec/isodoc/word_dis_spec.rb +1273 -147
  55. data/spec/isodoc/xref_spec.rb +87 -13
  56. data/spec/metanorma/amd_spec.rb +53 -1
  57. data/spec/metanorma/base_spec.rb +185 -10
  58. data/spec/metanorma/blocks_spec.rb +54 -0
  59. data/spec/metanorma/lists_spec.rb +2 -2
  60. data/spec/metanorma/section_spec.rb +2 -2
  61. data/spec/spec_helper.rb +13 -4
  62. data/spec/vcr_cassettes/withdrawn_iso.yml +27 -27
  63. metadata +7 -8
  64. data/docs/asciiiso-syntax.adoc +0 -307
  65. data/docs/guidance.adoc +0 -487
  66. data/docs/navigation.adoc +0 -23
  67. data/docs/quickstart.adoc +0 -179
  68. data/lib/isodoc/iso/presentation_inline.rb +0 -90
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3154af64aad28148d931cad79a5e4ba8633d7fe8db27dd87b1c721d660a46e27
4
- data.tar.gz: 784bb188b1397fabf8978e5896382b3dd724ab0458f2b758268b8ffb202ab6fc
3
+ metadata.gz: 43eeca2b2e24e0d8d1681a52ad493218736544151b9d440e4a38343dae49e22b
4
+ data.tar.gz: 79241bc11b898d70a969f984646e3aded85b0bf1a7fd9d56f73b359e84e36f9a
5
5
  SHA512:
6
- metadata.gz: 53719e79cd10a8b3f8cf6df804e9dd6e89c365eadbb8c3a6e6a3cf7881162b4d68dcf49daf27fd324960d36981ee16d49abd03ee1abe507e070c75524d382939
7
- data.tar.gz: b9cce4a6a713f9d6844359a1ddd25f6771adb754418d4662b415840f6885b86020ff5c929dbdf234f76c19eee61df0572c037607d021d1f5d6ca746450065bfd
6
+ metadata.gz: 27b8c022d5e76b1d1d91ed48a2d7f95246df401c8ede504244387500ab371dd05fc0c6c71fb47d955059004321a9192ebd7d532ee593d46ccd594a0df3b654e2
7
+ data.tar.gz: 4f5d8ce30167455dd18418b82120ec7597d1daafde97b781d1b50b71d42a616754317c8faa6fd3906b35dcf040afc53bdad0c9f06d75b45784fb49fd7db33136
@@ -4,17 +4,42 @@ class Html2Doc
4
4
  return if list.xpath("./li").empty?
5
5
 
6
6
  list.xpath("./li").each do |l|
7
- l.name = "p"
8
- if m = /level(\d) lfo/.match(l["style"])
9
- l["class"] = list2para_style(list.name, m[1])
10
- l.xpath("./p").each do |p|
11
- p["class"] = list2para_style(list.name, m[1])
12
- end
13
- end
14
- l&.first_element_child&.name == "p" and
15
- l.first_element_child.replace(l.first_element_child.children)
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)
16
22
  end
17
- list.replace(list.children)
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)
18
43
  end
19
44
 
20
45
  def list2para_style(listtype, depth)
@@ -33,5 +58,112 @@ class Html2Doc
33
58
  end
34
59
  end
35
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'>&#xa0;</span>"
139
+ elem["level"] = level
140
+ idx
141
+ end
142
+
143
+ def listlabel(listtype, idx, level)
144
+ case listtype
145
+ when :ul then "&#x2014;"
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
36
168
  end
37
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
@@ -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 %} &mdash; {% endif %}</span><span class="subtitle">{{ doctitlemain }}{% if doctitlemain and doctitlepart %} &mdash;{% endif %}</span>
28
30
  {% if doctitlepart %}