metanorma-iso 2.0.0 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  4. data/lib/isodoc/iso/html/isodoc.css +1 -2
  5. data/lib/isodoc/iso/html/isodoc.scss +0 -1
  6. data/lib/isodoc/iso/html/style-human.css +19 -14
  7. data/lib/isodoc/iso/html/style-human.scss +8 -2
  8. data/lib/isodoc/iso/html/style-iso.css +21 -15
  9. data/lib/isodoc/iso/html/style-iso.scss +9 -2
  10. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  11. data/lib/isodoc/iso/i18n-en.yaml +22 -0
  12. data/lib/isodoc/iso/i18n-fr.yaml +22 -1
  13. data/lib/isodoc/iso/i18n-ru.yaml +42 -0
  14. data/lib/isodoc/iso/i18n-zh-Hans.yaml +21 -1
  15. data/lib/isodoc/iso/i18n.rb +1 -0
  16. data/lib/isodoc/iso/iso.amendment.xsl +2479 -1631
  17. data/lib/isodoc/iso/iso.international-standard.xsl +2479 -1631
  18. data/lib/isodoc/iso/metadata.rb +12 -2
  19. data/lib/isodoc/iso/word_convert.rb +2 -0
  20. data/lib/metanorma/iso/basicdoc.rng +5 -3
  21. data/lib/metanorma/iso/biblio.rng +7 -5
  22. data/lib/metanorma/iso/boilerplate-fr.xml +3 -3
  23. data/lib/metanorma/iso/boilerplate-ru.xml +39 -0
  24. data/lib/metanorma/iso/boilerplate.xml +3 -3
  25. data/lib/metanorma/iso/cleanup.rb +5 -1
  26. data/lib/metanorma/iso/front.rb +1 -1
  27. data/lib/metanorma/iso/front_id.rb +1 -0
  28. data/lib/metanorma/iso/isodoc.rng +142 -4
  29. data/lib/metanorma/iso/validate.rb +1 -1
  30. data/lib/metanorma/iso/validate_section.rb +3 -2
  31. data/lib/metanorma/iso/version.rb +1 -1
  32. data/spec/isodoc/amd_spec.rb +10 -5
  33. data/spec/isodoc/i18n_spec.rb +350 -9
  34. data/spec/isodoc/metadata_spec.rb +153 -3
  35. data/spec/isodoc/postproc_spec.rb +1 -0
  36. data/spec/isodoc/section_spec.rb +1 -0
  37. data/spec/isodoc/xref_spec.rb +18 -18
  38. data/spec/metanorma/base_spec.rb +439 -370
  39. data/spec/metanorma/refs_spec.rb +1 -4
  40. data/spec/metanorma/validate_spec.rb +27 -2
  41. metadata +4 -4
  42. data/spec/vcr_cassettes/docrels.yml +0 -393
  43. data/spec/vcr_cassettes/sortrefs.yml +0 -599
@@ -72,12 +72,14 @@ module IsoDoc
72
72
  case lang
73
73
  when "en" then "Part"
74
74
  when "fr" then "Partie"
75
+ when "ru" then "Часть"
75
76
  end
76
77
  end
77
78
 
78
79
  def amd_label(lang)
79
80
  case lang
80
81
  when "en", "fr" then "AMENDMENT"
82
+ when "ru" then "ПОПРАВКА"
81
83
  end
82
84
  end
83
85
 
@@ -85,6 +87,7 @@ module IsoDoc
85
87
  case lang
86
88
  when "en" then "TECHNICAL CORRIGENDUM"
87
89
  when "fr" then "RECTIFICATIF TECHNIQUE"
90
+ when "ru" then "ТЕХНИЧЕСКОЕ ИСПРАВЛЕНИЕ"
88
91
  end
89
92
  end
90
93
 
@@ -140,7 +143,11 @@ module IsoDoc
140
143
  end
141
144
 
142
145
  def title(isoxml, _out)
143
- lang = @lang == "fr" ? "fr" : "en"
146
+ lang = case @lang
147
+ when "fr" then "fr"
148
+ when "ru" then "ru"
149
+ else "en"
150
+ end
144
151
  intro, main, part, amd = title_parts(isoxml, lang)
145
152
  partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
146
153
 
@@ -159,7 +166,10 @@ module IsoDoc
159
166
  end
160
167
 
161
168
  def subtitle(isoxml, _out)
162
- lang = @lang == "fr" ? "en" : "fr"
169
+ lang = case @lang
170
+ when "fr", "ru" then "en"
171
+ else "fr"
172
+ end
163
173
  intro, main, part, amd = title_parts(isoxml, lang)
164
174
  partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
165
175
 
@@ -154,11 +154,13 @@ module IsoDoc
154
154
  end
155
155
 
156
156
  def annex_name(_annex, name, div)
157
+ preceding_floating_titles(name, div)
157
158
  return if name.nil?
158
159
 
159
160
  name&.at(ns("./strong"))&.remove # supplied by CSS list numbering
160
161
  div.h1 **{ class: "Annex" } do |t|
161
162
  name.children.each { |c2| parse(c2, t) }
163
+ clause_parse_subtitle(name, t)
162
164
  end
163
165
  end
164
166
 
@@ -173,9 +173,11 @@
173
173
  <data type="dateTime"/>
174
174
  </attribute>
175
175
  </optional>
176
- <attribute name="from">
177
- <data type="IDREF"/>
178
- </attribute>
176
+ <optional>
177
+ <attribute name="from">
178
+ <data type="IDREF"/>
179
+ </attribute>
180
+ </optional>
179
181
  <optional>
180
182
  <attribute name="to">
181
183
  <data type="IDREF"/>
@@ -209,9 +209,6 @@
209
209
  <zeroOrMore>
210
210
  <ref name="contact"/>
211
211
  </zeroOrMore>
212
- <zeroOrMore>
213
- <ref name="uri"/>
214
- </zeroOrMore>
215
212
  </element>
216
213
  </define>
217
214
  <define name="fullname">
@@ -401,9 +398,9 @@
401
398
  <choice>
402
399
  <!-- iso191606 TODO -->
403
400
  <group>
404
- <oneOrMore>
401
+ <zeroOrMore>
405
402
  <ref name="street"/>
406
- </oneOrMore>
403
+ </zeroOrMore>
407
404
  <ref name="city"/>
408
405
  <optional>
409
406
  <ref name="state"/>
@@ -828,6 +825,11 @@
828
825
  <optional>
829
826
  <attribute name="scope"/>
830
827
  </optional>
828
+ <optional>
829
+ <attribute name="primary">
830
+ <data type="boolean"/>
831
+ </attribute>
832
+ </optional>
831
833
  <text/>
832
834
  </element>
833
835
  </define>
@@ -2,7 +2,7 @@
2
2
  <copyright-statement>
3
3
  <clause>
4
4
  <title>DOCUMENT PROTÉGÉ PAR COPYRIGHT</title>
5
- <p id="boilerplate-year">&copy; {{ agency }} {{ docyear }}</p>
5
+ <p id="boilerplate-year">&#xa9; {{ agency }} {{ docyear }}</p>
6
6
 
7
7
  <p id="boilerplate-message">
8
8
  Droits de reproduction réservés. Sauf indication contraire, aucune partie de cette publication ne
@@ -16,8 +16,8 @@ l’adresse ci-après ou au comité membre de l’ISO dans le pays du demandeur.
16
16
  ISO copyright office<br/>
17
17
  Ch. de Blandonnet 8 &#x2022; CP 401<br/>
18
18
  CH-1214 Vernier, Geneva, Switzerland<br/>
19
- Tel.&nbsp;&nbsp;+ 41 22 749 01 11<br/>
20
- Fax&nbsp;&nbsp;+ 41 22 749 09 47<br/>
19
+ Tel.&#xa0;&#xa0;+ 41 22 749 01 11<br/>
20
+ Fax&#xa0;&#xa0;+ 41 22 749 09 47<br/>
21
21
  Email: copyright@iso.org<br/>
22
22
  Website: www.iso.org
23
23
  </p>
@@ -0,0 +1,39 @@
1
+ <boilerplate>
2
+ <copyright-statement>
3
+ <clause>
4
+ <title>ДОКУМЕНТ, ОХРАНЯЕМЫЙ АВТОРСКИМ ПРАВОМ</title>
5
+ <p id="boilerplate-year">
6
+ &#xa9; {{ agency }} {{ docyear }}
7
+ </p>
8
+
9
+ <p id="boilerplate-message">
10
+ Все права защищены. Если иначе не определено, никакая часть этой публикации не может быть воспроизведена или использована иначе в любой форме или каким-либо образом, электронным или механическим, включая фотокопирование, или публикацию в Интернете или интранете, без предварительного письменного разрешения. Разрешение может быть запрошено ISO по адресу, указанному ниже, или у органа — члена ISO страны запрашивающего.
11
+ </p>
12
+
13
+ <p id="boilerplate-address" align="left">
14
+ Бюро ISO по охране авторских прав<br/>
15
+ Ch. de Blandonnet 8 &#x2022; CP 401<br/>
16
+ CH-1214 Vernier, Geneva, Switzerland<br/>
17
+ Tel.&#xa0;&#xa0;+ 41 22 749 01 11<br/>
18
+ Fax&#xa0;&#xa0;+ 41 22 749 09 47<br/>
19
+ Электронная почта: copyright@iso.org<br/>
20
+ Сайт: www.iso.org
21
+ </p>
22
+ <p id="boilerplate-place">
23
+ Издано в Швейцарии
24
+ </p>
25
+ </clause>
26
+ </copyright-statement>
27
+
28
+ {% if unpublished %}
29
+ <license-statement>
30
+ <clause>
31
+ <title>Предупреждение для WD и CD</title>
32
+
33
+ <p>Этот документ не является международным стандартом ISO. Распространяется для ознакомления и комментариев. Оно может быть изменено без предварительного уведомления и не может упоминаться как международный стандарт.</p>
34
+
35
+ <p>Получателям этого проекта предлагается представить вместе со своими комментариями уведомление о любых соответствующих патентных правах, о которых им известно, и предоставить подтверждающую документацию.</p>
36
+ </clause>
37
+ </license-statement>
38
+ {% endif %}
39
+ </boilerplate>
@@ -3,7 +3,7 @@
3
3
  <clause>
4
4
  <title>COPYRIGHT PROTECTED DOCUMENT</title>
5
5
  <p id="boilerplate-year">
6
- &copy; {{ agency }} {{ docyear }}
6
+ &#xa9; {{ agency }} {{ docyear }}
7
7
  </p>
8
8
 
9
9
  <p id="boilerplate-message">
@@ -19,8 +19,8 @@ at the address below or ISO's member body in the country of the requester.
19
19
  ISO copyright office<br/>
20
20
  Ch. de Blandonnet 8 &#x2022; CP 401<br/>
21
21
  CH-1214 Vernier, Geneva, Switzerland<br/>
22
- Tel.&nbsp;&nbsp;+ 41 22 749 01 11<br/>
23
- Fax&nbsp;&nbsp;+ 41 22 749 09 47<br/>
22
+ Tel.&#xa0;&#xa0;+ 41 22 749 01 11<br/>
23
+ Fax&#xa0;&#xa0;+ 41 22 749 09 47<br/>
24
24
  Email: copyright@iso.org<br/>
25
25
  Website: www.iso.org
26
26
  </p>
@@ -125,7 +125,11 @@ module Metanorma
125
125
  end
126
126
 
127
127
  def boilerplate_file(_xmldoc)
128
- file = @lang == "fr" ? "boilerplate-fr.xml" : "boilerplate.xml"
128
+ file = case @lang
129
+ when "fr" then "boilerplate-fr.xml"
130
+ when "ru" then "boilerplate-ru.xml"
131
+ else "boilerplate.xml"
132
+ end
129
133
  File.join(@libdir, file)
130
134
  end
131
135
 
@@ -135,7 +135,7 @@ module Metanorma
135
135
  end
136
136
 
137
137
  def title(node, xml)
138
- ["en", "fr"].each do |lang|
138
+ %w(en ru fr).each do |lang|
139
139
  at = { language: lang, format: "text/plain" }
140
140
  title_full(node, xml, lang, at)
141
141
  title_intro(node, xml, lang, at)
@@ -106,6 +106,7 @@ module Metanorma
106
106
  suffix = case lang
107
107
  when "en" then "(E)"
108
108
  when "fr" then "(F)"
109
+ when "ru" then "(R)"
109
110
  else
110
111
  "(X)"
111
112
  end
@@ -32,6 +32,43 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="index">
36
+ <element name="index">
37
+ <optional>
38
+ <attribute name="to">
39
+ <data type="IDREF"/>
40
+ </attribute>
41
+ </optional>
42
+ <element name="primary">
43
+ <oneOrMore>
44
+ <choice>
45
+ <ref name="PureTextElement"/>
46
+ <ref name="stem"/>
47
+ </choice>
48
+ </oneOrMore>
49
+ </element>
50
+ <optional>
51
+ <element name="secondary">
52
+ <oneOrMore>
53
+ <choice>
54
+ <ref name="PureTextElement"/>
55
+ <ref name="stem"/>
56
+ </choice>
57
+ </oneOrMore>
58
+ </element>
59
+ </optional>
60
+ <optional>
61
+ <element name="tertiary">
62
+ <oneOrMore>
63
+ <choice>
64
+ <ref name="PureTextElement"/>
65
+ <ref name="stem"/>
66
+ </choice>
67
+ </oneOrMore>
68
+ </element>
69
+ </optional>
70
+ </element>
71
+ </define>
35
72
  <define name="bibitem">
36
73
  <element name="bibitem">
37
74
  <attribute name="id">
@@ -115,9 +152,7 @@
115
152
  <data type="boolean"/>
116
153
  </attribute>
117
154
  </optional>
118
- <oneOrMore>
119
- <ref name="PureTextElement"/>
120
- </oneOrMore>
155
+ <ref name="XrefBody"/>
121
156
  </element>
122
157
  </define>
123
158
  <define name="erefType">
@@ -151,6 +186,42 @@
151
186
  <ref name="PureTextElement"/>
152
187
  </oneOrMore>
153
188
  </define>
189
+ <define name="localityStack">
190
+ <element name="localityStack">
191
+ <optional>
192
+ <attribute name="connective">
193
+ <choice>
194
+ <value>and</value>
195
+ <value>or</value>
196
+ <value>from</value>
197
+ <value>to</value>
198
+ <value/>
199
+ </choice>
200
+ </attribute>
201
+ </optional>
202
+ <zeroOrMore>
203
+ <ref name="locality"/>
204
+ </zeroOrMore>
205
+ </element>
206
+ </define>
207
+ <define name="sourceLocalityStack">
208
+ <element name="sourceLocalityStack">
209
+ <optional>
210
+ <attribute name="connective">
211
+ <choice>
212
+ <value>and</value>
213
+ <value>or</value>
214
+ <value>from</value>
215
+ <value>to</value>
216
+ <value/>
217
+ </choice>
218
+ </attribute>
219
+ </optional>
220
+ <zeroOrMore>
221
+ <ref name="sourceLocality"/>
222
+ </zeroOrMore>
223
+ </element>
224
+ </define>
154
225
  <define name="ul">
155
226
  <element name="ul">
156
227
  <attribute name="id">
@@ -1027,6 +1098,26 @@
1027
1098
  </zeroOrMore>
1028
1099
  </element>
1029
1100
  </define>
1101
+ <define name="sub">
1102
+ <element name="sub">
1103
+ <zeroOrMore>
1104
+ <choice>
1105
+ <ref name="PureTextElement"/>
1106
+ <ref name="stem"/>
1107
+ </choice>
1108
+ </zeroOrMore>
1109
+ </element>
1110
+ </define>
1111
+ <define name="sup">
1112
+ <element name="sup">
1113
+ <zeroOrMore>
1114
+ <choice>
1115
+ <ref name="PureTextElement"/>
1116
+ <ref name="stem"/>
1117
+ </choice>
1118
+ </zeroOrMore>
1119
+ </element>
1120
+ </define>
1030
1121
  <define name="pagebreak">
1031
1122
  <element name="pagebreak">
1032
1123
  <optional>
@@ -1041,6 +1132,16 @@
1041
1132
  </define>
1042
1133
  </include>
1043
1134
  <!-- end overrides -->
1135
+ <define name="image" combine="choice">
1136
+ <element name="svg">
1137
+ <oneOrMore>
1138
+ <choice>
1139
+ <text/>
1140
+ <ref name="AnyElement"/>
1141
+ </choice>
1142
+ </oneOrMore>
1143
+ </element>
1144
+ </define>
1044
1145
  <define name="MultilingualRenderingType">
1045
1146
  <choice>
1046
1147
  <value>common</value>
@@ -2216,7 +2317,18 @@
2216
2317
  <ref name="MultilingualRenderingType"/>
2217
2318
  </attribute>
2218
2319
  </optional>
2219
- <ref name="paragraph"/>
2320
+ <oneOrMore>
2321
+ <choice>
2322
+ <ref name="formula"/>
2323
+ <ref name="ul"/>
2324
+ <ref name="ol"/>
2325
+ <ref name="dl"/>
2326
+ <ref name="quote"/>
2327
+ <ref name="sourcecode"/>
2328
+ <ref name="paragraph"/>
2329
+ <ref name="figure"/>
2330
+ </choice>
2331
+ </oneOrMore>
2220
2332
  </element>
2221
2333
  </define>
2222
2334
  <define name="termsource">
@@ -2563,4 +2675,30 @@
2563
2675
  </zeroOrMore>
2564
2676
  </element>
2565
2677
  </define>
2678
+ <define name="XrefBody">
2679
+ <zeroOrMore>
2680
+ <ref name="XrefTarget"/>
2681
+ </zeroOrMore>
2682
+ <oneOrMore>
2683
+ <ref name="PureTextElement"/>
2684
+ </oneOrMore>
2685
+ </define>
2686
+ <define name="XrefTarget">
2687
+ <element name="location">
2688
+ <attribute name="target">
2689
+ <data type="string">
2690
+ <param name="pattern">\i\c*|\c+#\c+</param>
2691
+ </data>
2692
+ </attribute>
2693
+ <attribute name="connective">
2694
+ <choice>
2695
+ <value>and</value>
2696
+ <value>or</value>
2697
+ <value>from</value>
2698
+ <value>to</value>
2699
+ <value/>
2700
+ </choice>
2701
+ </attribute>
2702
+ </element>
2703
+ </define>
2566
2704
  </grammar>
@@ -98,7 +98,7 @@ module Metanorma
98
98
 
99
99
  def script_validate(xmldoc)
100
100
  script = xmldoc&.at("//bibdata/script")&.text
101
- script == "Latn" or
101
+ %w(Cyrl Latn).include?(script) or
102
102
  @log.add("Document Attributes", nil,
103
103
  "#{script} is not a recognised script")
104
104
  end
@@ -40,7 +40,8 @@ module Metanorma
40
40
  def symbols_validate(root)
41
41
  f = root.xpath("//definitions")
42
42
  f.empty? && return
43
- (f.size == 1) || @log.add("Style", f.first, ONE_SYMBOLS_WARNING)
43
+ (f.size == 1 || @vocab) or
44
+ @log.add("Style", f.first, ONE_SYMBOLS_WARNING)
44
45
  f.first.elements.each do |e|
45
46
  unless %w(title dl).include? e.name
46
47
  @log.add("Style", f.first, NON_DL_SYMBOLS_WARNING)
@@ -100,7 +101,7 @@ module Metanorma
100
101
 
101
102
  def sections_sequence_validate(root)
102
103
  names, n = sections_sequence_validate_start(root)
103
- if root&.at("//bibdata/ext/subdoctype")&.text == "vocabulary"
104
+ if @vocab
104
105
  names, n = sections_sequence_validate_body_vocab(names, n)
105
106
  else
106
107
  names, n = sections_sequence_validate_body(names, n)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "2.0.0".freeze
3
+ VERSION = "2.0.4".freeze
4
4
  end
5
5
  end
@@ -74,6 +74,7 @@ RSpec.describe IsoDoc do
74
74
  <bibdata>
75
75
  <ext>
76
76
  <doctype language="">amendment</doctype>
77
+ <doctype language='en'>Amendment</doctype>
77
78
  </ext>
78
79
  </bibdata>
79
80
  <preface>
@@ -243,9 +244,9 @@ RSpec.describe IsoDoc do
243
244
  <bibdata>
244
245
  <ext>
245
246
  <doctype language=''>amendment</doctype>
247
+ <doctype language='en'>Amendment</doctype>
246
248
  </ext>
247
249
  </bibdata>
248
-
249
250
  <preface>
250
251
  <foreword obligation='informative' displayorder='1'>
251
252
  <title>Foreword</title>
@@ -436,6 +437,7 @@ RSpec.describe IsoDoc do
436
437
  <bibdata>
437
438
  <ext>
438
439
  <doctype language="">amendment</doctype>
440
+ <doctype language='en'>Amendment</doctype>
439
441
  </ext>
440
442
  </bibdata>
441
443
  <boilerplate>
@@ -636,10 +638,13 @@ RSpec.describe IsoDoc do
636
638
  </body>
637
639
  </html>
638
640
  OUTPUT
639
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))
640
- .sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
641
- expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml,
642
- true))).to be_equivalent_to xmlpp(html)
641
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
642
+ .convert("test", input, true))
643
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
644
+ .to be_equivalent_to xmlpp(presxml)
645
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
646
+ .convert("test", presxml, true)))
647
+ .to be_equivalent_to xmlpp(html)
643
648
  end
644
649
 
645
650
  it "processes IsoXML metadata" do