metanorma-iso 1.3.19 → 1.3.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,7 +19,6 @@ module IsoDoc
19
19
  title_attr = { class: "IntroTitle" }
20
20
  page_break(out)
21
21
  out.div **{ class: "Section3", id: f["id"] } do |div|
22
- # div.h1 "Introduction", **attr_code(title_attr)
23
22
  clause_name(num, @introduction_lbl, div, title_attr)
24
23
  f.elements.each do |e|
25
24
  if e.name == "patent-notice"
@@ -200,6 +199,48 @@ module IsoDoc
200
199
  def table_footnote_reference_format(a)
201
200
  a.content = a.content + ")"
202
201
  end
202
+
203
+ def clause_parse_title(node, div, c1, out)
204
+ return inline_header_title(out, node, c1) if c1.nil?
205
+ super
206
+ end
207
+
208
+ def cleanup(docxml)
209
+ super
210
+ remove_internal_hyperlinks(docxml)
211
+ table_th_center(docxml)
212
+ docxml
213
+ end
214
+
215
+ def remove_internal_hyperlinks(docxml)
216
+ docxml.xpath("//a[@href]").each do |a|
217
+ next unless /^#/.match(a[:href])
218
+ anchor = a[:href].sub(/^#/, "")
219
+ next if a["epub:type"] == "footnote"
220
+ next unless @anchors[anchor]
221
+ next unless @anchors[anchor][:type]
222
+ next if @anchors[anchor][:type] == "clause"
223
+ a.replace(a.children)
224
+ end
225
+ end
226
+
227
+ def table_th_center(docxml)
228
+ docxml.xpath("//thead//th | //thead//td").each do |th|
229
+ th["align"] = "center"
230
+ th["valign"] = "middle"
231
+ end
232
+ end
233
+
234
+ def hierarchical_formula_names(clause, num)
235
+ c = IsoDoc::Function::XrefGen::Counter.new
236
+ clause.xpath(ns(".//formula")).each do |t|
237
+ next if t["id"].nil? || t["id"].empty?
238
+ @anchors[t["id"]] =
239
+ anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
240
+ t["inequality"] ? @inequality_lbl : @formula_lbl,
241
+ "formula", t["unnumbered"])
242
+ end
243
+ end
203
244
  end
204
245
  end
205
246
  end
@@ -598,6 +598,10 @@ table.figdl
598
598
  margin-right: 0cm;
599
599
  }
600
600
 
601
+ table.formula_dl {
602
+ margin-left:20.15pt;
603
+ }
604
+
601
605
  table.MsoISOTable
602
606
  {mso-style-name:"Table ISO";
603
607
  mso-tstyle-rowband-size:0;
@@ -820,6 +820,13 @@ margin-right: 20%;
820
820
  font-size: 0.9em;
821
821
  }
822
822
 
823
+ dl.formula_dl {
824
+ background-color: #f7f7f7;
825
+ margin-left: 20%;
826
+ margin-right: 20%;
827
+ font-size: 0.9em;
828
+ }
829
+
823
830
  /*
824
831
  Keywords
825
832
  */
@@ -906,6 +906,12 @@ margin-left: 20%;
906
906
  margin-right: 20%;
907
907
  }
908
908
 
909
+ dl.formula_dl {
910
+ background-color: #f7f7f7;
911
+ margin-left: 20%;
912
+ margin-right: 20%;
913
+ }
914
+
909
915
  /*
910
916
  Keywords
911
917
  */
@@ -44,6 +44,12 @@ module IsoDoc
44
44
  a.content = a.content + ")"
45
45
  end
46
46
 
47
+ def table_th_center(docxml)
48
+ docxml.xpath("//thead//th | //thead//td").each do |th|
49
+ th["style"] += ";text-align:center;vertical-align:middle;"
50
+ end
51
+ end
52
+
47
53
  include BaseConvert
48
54
  end
49
55
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.3.19".freeze
3
+ VERSION = "1.3.20".freeze
4
4
  end
5
5
  end
@@ -42,6 +42,5 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency "rubocop", "= 0.54.0"
43
43
  spec.add_development_dependency "simplecov", "~> 0.15"
44
44
  spec.add_development_dependency "timecop", "~> 0.9"
45
- spec.add_development_dependency "metanorma", "~> 0.3.0"
46
45
  spec.add_development_dependency "iev", "~> 0.2.0"
47
46
  end
@@ -744,6 +744,8 @@ RSpec.describe Asciidoctor::ISO do
744
744
 
745
745
  == Clause 1
746
746
  <<ref1>>
747
+ <<ref1a>>
748
+ <<ref1b>>
747
749
  <<ref2>>
748
750
  <<ref3>>
749
751
  <<ref4>>
@@ -762,6 +764,8 @@ RSpec.describe Asciidoctor::ISO do
762
764
  * [[[ref3,IEC 123]]], _Standard IEC 123_
763
765
  * [[[ref5,20]]], _Standard 10_
764
766
  * [[[ref1,ISO 123]]], _Standard ISO 123_
767
+ * [[[ref1a,ISO 123-100]]], _Standard ISO 123_
768
+ * [[[ref1b,ISO/TS 123-1]]], _Standard ISO 123_
765
769
  * [[[ref4,GB 123]]], _Standard GB 123_
766
770
  * [[[ref2,ISO/IEC 123]]], _Standard ISO/IEC 123_
767
771
  * [[[ref6,(B)]]], _Standard 20_
@@ -781,10 +785,12 @@ RSpec.describe Asciidoctor::ISO do
781
785
  <sections><clause id="_" inline-header="false" obligation="normative">
782
786
  <title>Clause 1</title>
783
787
  <p id="_"><eref type="inline" bibitemid="ref1" citeas="ISO 123"/>
788
+ <eref type='inline' bibitemid='ref1a' citeas='ISO 123-100'/>
789
+ <eref type='inline' bibitemid='ref1b' citeas='ISO/TS 123-1'/>
784
790
  <eref type="inline" bibitemid="ref2" citeas="ISO/IEC 123"/>
785
791
  <eref type="inline" bibitemid="ref3" citeas="IEC 123"/>
786
792
  <eref type="inline" bibitemid="ref4" citeas="GB 123"/>
787
- <eref type="inline" bibitemid="ref5" citeas="[4]"/>
793
+ <eref type="inline" bibitemid="ref5" citeas="[6]"/>
788
794
  <eref type="inline" bibitemid="ref6" citeas="[B]"/>
789
795
  <eref type="inline" bibitemid="ref7" citeas="[A]"/>
790
796
  <xref target="ref8"/>
@@ -802,24 +808,54 @@ RSpec.describe Asciidoctor::ISO do
802
808
  <abbreviation>ISO</abbreviation>
803
809
  </organization>
804
810
  </contributor>
805
- </bibitem><bibitem id="ref2" type="standard">
806
- <title format="text/plain">Standard ISO/IEC 123</title>
807
- <docidentifier>ISO/IEC 123</docidentifier>
808
- <contributor>
809
- <role type="publisher"/>
810
- <organization>
811
- <name>International Organization for Standardization</name>
812
- <abbreviation>ISO</abbreviation>
813
- </organization>
814
- </contributor>
815
- <contributor>
816
- <role type="publisher"/>
817
- <organization>
818
- <name>International Electrotechnical Commission</name>
819
- <abbreviation>IEC</abbreviation>
820
- </organization>
821
- </contributor>
822
- </bibitem><bibitem id="ref3" type="standard">
811
+ </bibitem>
812
+ <bibitem id='ref2' type='standard'>
813
+ <title format='text/plain'>Standard ISO/IEC 123</title>
814
+ <docidentifier>ISO/IEC 123</docidentifier>
815
+ <contributor>
816
+ <role type='publisher'/>
817
+ <organization>
818
+ <name>International Organization for Standardization</name>
819
+ <abbreviation>ISO</abbreviation>
820
+ </organization>
821
+ </contributor>
822
+ <contributor>
823
+ <role type='publisher'/>
824
+ <organization>
825
+ <name>International Electrotechnical Commission</name>
826
+ <abbreviation>IEC</abbreviation>
827
+ </organization>
828
+ </contributor>
829
+ </bibitem>
830
+ <bibitem id='ref1b' type='standard'>
831
+ <title format='text/plain'>Standard ISO 123</title>
832
+ <docidentifier>ISO/TS 123-1</docidentifier>
833
+ <contributor>
834
+ <role type='publisher'/>
835
+ <organization>
836
+ <name>International Organization for Standardization</name>
837
+ <abbreviation>ISO</abbreviation>
838
+ </organization>
839
+ </contributor>
840
+ <contributor>
841
+ <role type='publisher'/>
842
+ <organization>
843
+ <name>TS</name>
844
+ </organization>
845
+ </contributor>
846
+ </bibitem>
847
+ <bibitem id='ref1a' type='standard'>
848
+ <title format='text/plain'>Standard ISO 123</title>
849
+ <docidentifier>ISO 123-100</docidentifier>
850
+ <contributor>
851
+ <role type='publisher'/>
852
+ <organization>
853
+ <name>International Organization for Standardization</name>
854
+ <abbreviation>ISO</abbreviation>
855
+ </organization>
856
+ </contributor>
857
+ </bibitem>
858
+ <bibitem id="ref3" type="standard">
823
859
  <title format="text/plain">Standard IEC 123</title>
824
860
  <docidentifier>IEC 123</docidentifier>
825
861
  <contributor>
@@ -833,7 +869,7 @@ RSpec.describe Asciidoctor::ISO do
833
869
  <formattedref format="application/x-isodoc+xml">
834
870
  <em>Standard 10</em>
835
871
  </formattedref>
836
- <docidentifier type="metanorma">[4]</docidentifier>
872
+ <docidentifier type="metanorma">[6]</docidentifier>
837
873
  </bibitem><bibitem id="ref4">
838
874
  <formattedref format="application/x-isodoc+xml">
839
875
  <em>Standard GB 123</em>
@@ -900,7 +936,7 @@ RSpec.describe Asciidoctor::ISO do
900
936
  <formattedref format="application/x-isodoc+xml">
901
937
  <em>Standard 10</em>
902
938
  </formattedref>
903
- <docidentifier type="metanorma">[11]</docidentifier>
939
+ <docidentifier type="metanorma">[13]</docidentifier>
904
940
  </bibitem><bibitem id="ref14">
905
941
  <formattedref format="application/x-isodoc+xml">
906
942
  <em>Standard GB 123</em>
@@ -4,7 +4,8 @@ require "fileutils"
4
4
  RSpec.describe Asciidoctor::ISO do
5
5
 
6
6
  it "Warns of illegal doctype" do
7
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/pizza is not a recognised document type/).to_stderr
7
+ FileUtils.rm_f "test.err"
8
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
8
9
  = Document title
9
10
  Author
10
11
  :docfile: test.adoc
@@ -14,10 +15,12 @@ it "Warns of illegal doctype" do
14
15
 
15
16
  text
16
17
  INPUT
18
+ expect(File.read("test.err")).to include "pizza is not a recognised document type"
17
19
  end
18
20
 
19
21
  it "Warns of illegal script" do
20
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/pizza is not a recognised script/).to_stderr
22
+ FileUtils.rm_f "test.err"
23
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
21
24
  = Document title
22
25
  Author
23
26
  :docfile: test.adoc
@@ -27,10 +30,12 @@ it "Warns of illegal script" do
27
30
 
28
31
  text
29
32
  INPUT
33
+ expect(File.read("test.err")).to include "pizza is not a recognised script"
30
34
  end
31
35
 
32
36
  it "Warns of illegal stage" do
33
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/pizza is not a recognised stage/).to_stderr
37
+ FileUtils.rm_f "test.err"
38
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
34
39
  = Document title
35
40
  Author
36
41
  :docfile: test.adoc
@@ -40,10 +45,12 @@ it "Warns of illegal stage" do
40
45
 
41
46
  text
42
47
  INPUT
48
+ expect(File.read("test.err")).to include "pizza is not a recognised stage"
43
49
  end
44
50
 
45
51
  it "Warns of illegal substage" do
46
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/pizza is not a recognised substage/).to_stderr
52
+ FileUtils.rm_f "test.err"
53
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
47
54
  = Document title
48
55
  Author
49
56
  :docfile: test.adoc
@@ -54,10 +61,12 @@ it "Warns of illegal substage" do
54
61
 
55
62
  text
56
63
  INPUT
64
+ expect(File.read("test.err")).to include "pizza is not a recognised substage"
57
65
  end
58
66
 
59
67
  it "Warns of illegal iteration" do
60
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/pizza is not a recognised iteration/).to_stderr
68
+ FileUtils.rm_f "test.err"
69
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
61
70
  = Document title
62
71
  Author
63
72
  :docfile: test.adoc
@@ -68,10 +77,12 @@ it "Warns of illegal iteration" do
68
77
 
69
78
  text
70
79
  INPUT
80
+ expect(File.read("test.err")).to include "pizza is not a recognised iteration"
71
81
  end
72
82
 
73
83
  it "Warns of illegal script" do
74
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/pizza is not a recognised script/).to_stderr
84
+ FileUtils.rm_f "test.err"
85
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
75
86
  = Document title
76
87
  Author
77
88
  :docfile: test.adoc
@@ -81,49 +92,59 @@ it "Warns of illegal script" do
81
92
 
82
93
  text
83
94
  INPUT
95
+ expect(File.read("test.err")).to include "pizza is not a recognised script"
84
96
  end
85
97
 
86
98
 
87
99
  it "warns that introduction may contain requirement" do
88
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Introduction may contain requirement/).to_stderr
100
+ FileUtils.rm_f "test.err"
101
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
89
102
  #{VALIDATING_BLANK_HDR}
90
103
  == Introduction
91
104
 
92
105
  The widget is required not to be larger than 15 cm.
93
106
  INPUT
107
+ expect(File.read("test.err")).to include "Introduction may contain requirement"
94
108
  end
95
109
 
96
110
  it "warns that foreword may contain recommendation" do
97
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Foreword may contain recommendation/).to_stderr
111
+ FileUtils.rm_f "test.err"
112
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
98
113
  #{VALIDATING_BLANK_HDR}
99
114
 
100
115
  It is not recommended that widgets should be larger than 15 cm.
101
116
 
102
117
  == Clause
103
118
  INPUT
119
+ expect(File.read("test.err")).to include "Foreword may contain recommendation"
104
120
  end
105
121
 
106
122
  it "warns that foreword may contain permission" do
107
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Foreword may contain permission/).to_stderr
123
+ FileUtils.rm_f "test.err"
124
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
108
125
  #{VALIDATING_BLANK_HDR}
109
126
 
110
127
  No widget is required to be larger than 15 cm.
111
128
 
112
129
  == Clause
113
130
  INPUT
131
+ expect(File.read("test.err")).to include "Foreword may contain permission"
114
132
  end
115
133
 
116
134
  it "warns that scope may contain recommendation" do
117
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Scope may contain recommendation/).to_stderr
135
+ FileUtils.rm_f "test.err"
136
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
118
137
  #{VALIDATING_BLANK_HDR}
119
138
 
120
139
  == Scope
121
140
  It is not recommended that widgets should be larger than 15 cm.
122
141
  INPUT
142
+ expect(File.read("test.err")).to include "Scope may contain recommendation"
123
143
  end
124
144
 
125
145
  it "warns that definition may contain requirement" do
126
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Definition may contain requirement/).to_stderr
146
+ FileUtils.rm_f "test.err"
147
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
127
148
  #{VALIDATING_BLANK_HDR}
128
149
 
129
150
  == Terms and Definitions
@@ -133,10 +154,12 @@ it "warns that definition may contain requirement" do
133
154
  It is required that there is a definition.
134
155
 
135
156
  INPUT
157
+ expect(File.read("test.err")).to include "Definition may contain requirement"
136
158
  end
137
159
 
138
160
  it "warns that term example may contain recommendation" do
139
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Example may contain recommendation/).to_stderr
161
+ FileUtils.rm_f "test.err"
162
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
140
163
  #{VALIDATING_BLANK_HDR}
141
164
 
142
165
  == Terms and Definitions
@@ -146,43 +169,53 @@ it "warns that term example may contain recommendation" do
146
169
  [example]
147
170
  It is not recommended that widgets should be larger than 15 cm.
148
171
  INPUT
172
+ expect(File.read("test.err")).to include "Example may contain recommendation"
149
173
  end
150
174
 
151
175
  it "warns that note may contain recommendation" do
152
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Note may contain recommendation/).to_stderr
176
+ FileUtils.rm_f "test.err"
177
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
153
178
  #{VALIDATING_BLANK_HDR}
154
179
 
155
180
  NOTE: It is not recommended that widgets should be larger than 15 cm.
156
181
  INPUT
182
+ expect(File.read("test.err")).to include "Note may contain recommendation"
157
183
  end
158
184
 
159
185
  it "warns that footnote may contain recommendation" do
160
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Footnote may contain recommendation/).to_stderr
186
+ FileUtils.rm_f "test.err"
187
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
161
188
  #{VALIDATING_BLANK_HDR}
162
189
 
163
190
  footnote:[It is not recommended that widgets should be larger than 15 cm.]
164
191
  INPUT
192
+ expect(File.read("test.err")).to include "Footnote may contain recommendation"
165
193
  end
166
194
 
167
195
  it "warns that term source is not in expected format" do
168
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/term reference not in expected format/).to_stderr
196
+ FileUtils.rm_f "test.err"
197
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
169
198
  #{VALIDATING_BLANK_HDR}
170
199
 
171
200
  [.source]
172
201
  I am a generic paragraph
173
202
  INPUT
203
+ expect(File.read("test.err")).to include "term reference not in expected format"
174
204
  end
175
205
 
176
206
  it "warns that figure does not have title" do
177
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/Figure should have title/).to_stderr
207
+ FileUtils.rm_f "test.err"
208
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
178
209
  #{VALIDATING_BLANK_HDR}
179
210
 
180
211
  image::spec/examples/rice_images/rice_image1.png[]
181
212
  INPUT
213
+ expect(File.read("test.err")).to include "Figure should have title"
182
214
  end
183
215
 
184
216
  it "warns that callouts do not match annotations" do
185
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/mismatch of callouts and annotations/).to_stderr
217
+ FileUtils.rm_f "test.err"
218
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
186
219
  #{VALIDATING_BLANK_HDR}
187
220
  [source,ruby]
188
221
  --
@@ -194,19 +227,23 @@ it "warns that callouts do not match annotations" do
194
227
  <1> This is one callout
195
228
  <2> This is another callout
196
229
  INPUT
230
+ expect(File.read("test.err")).to include "mismatch of callouts and annotations"
197
231
  end
198
232
 
199
233
  it "warns that term source is not a real reference" do
200
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/iso123 is not a real reference/).to_stderr
234
+ FileUtils.rm_f "test.err"
235
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
201
236
  #{VALIDATING_BLANK_HDR}
202
237
 
203
238
  [.source]
204
239
  <<iso123>>
205
240
  INPUT
241
+ expect(File.read("test.err")).to include "iso123 is not a real reference"
206
242
  end
207
243
 
208
244
  it "warns that undated reference has locality" do
209
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/undated reference ISO 123 should not contain specific elements/).to_stderr
245
+ FileUtils.rm_f "test.err"
246
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
210
247
  #{VALIDATING_BLANK_HDR}
211
248
 
212
249
  == Scope
@@ -216,10 +253,12 @@ it "warns that undated reference has locality" do
216
253
  == Normative References
217
254
  * [[[iso123,ISO 123]]] _Standard_
218
255
  INPUT
256
+ expect(File.read("test.err")).to include "undated reference ISO 123 should not contain specific elements"
219
257
  end
220
258
 
221
259
  it "do not warn that undated reference which is a bibliographic reference has locality" do
222
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(/undated reference \[1\] should not contain specific elements/).to_stderr
260
+ FileUtils.rm_f "test.err"
261
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
223
262
  #{VALIDATING_BLANK_HDR}
224
263
 
225
264
  == Scope
@@ -229,10 +268,12 @@ it "do not warn that undated reference which is a bibliographic reference has lo
229
268
  == Bibliography
230
269
  * [[[iso123,1]]] _Standard_
231
270
  INPUT
271
+ expect(File.read("test.err")).not_to include "undated reference [1] should not contain specific elements"
232
272
  end
233
273
 
234
274
  it "do not warn that undated IEV reference has locality" do
235
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(/undated reference IEV should not contain specific elements/).to_stderr
275
+ FileUtils.rm_f "test.err"
276
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
236
277
  #{VALIDATING_BLANK_HDR}
237
278
 
238
279
  == Scope
@@ -242,10 +283,12 @@ it "do not warn that undated IEV reference has locality" do
242
283
  == Normative References
243
284
  * [[[iev,IEV]]] _Standard_
244
285
  INPUT
286
+ expect(File.read("test.err")).not_to include "undated reference IEV should not contain specific elements"
245
287
  end
246
288
 
247
289
  it "do not warn that in print has locality" do
248
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(/undated reference ISO 123 should not contain specific elements/).to_stderr
290
+ FileUtils.rm_f "test.err"
291
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
249
292
  #{VALIDATING_BLANK_HDR}
250
293
 
251
294
  == Scope
@@ -255,154 +298,187 @@ it "do not warn that in print has locality" do
255
298
  == Normative References
256
299
  * [[[iev,ISO 123:--]]] _Standard_
257
300
  INPUT
301
+ expect(File.read("test.err")).not_to include "undated reference ISO 123 should not contain specific elements"
258
302
  end
259
303
 
260
304
  it "warns of Non-reference in bibliography" do
261
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(/no anchor on reference/).to_stderr
305
+ FileUtils.rm_f "test.err"
306
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
262
307
  #{VALIDATING_BLANK_HDR}
263
308
 
264
309
  == Normative References
265
310
  * I am not a reference
266
311
  INPUT
312
+ expect(File.read("test.err")).to include "no anchor on reference"
267
313
  end
268
314
 
269
315
  it "warns of Non-ISO reference in Normative References" do
270
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-ISO/IEC reference not expected as normative}).to_stderr
316
+ FileUtils.rm_f "test.err"
317
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
271
318
  #{VALIDATING_BLANK_HDR}
272
319
 
273
320
  [bibliography]
274
321
  == Normative References
275
322
  * [[[XYZ,IESO 121]]] _Standard_
276
323
  INPUT
324
+ expect(File.read("test.err")).to include "non-ISO/IEC reference not expected as normative"
277
325
  end
278
326
 
279
327
  it "warns that Scope contains subclauses" do
280
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope contains subclauses: should be succinct}).to_stderr
328
+ FileUtils.rm_f "test.err"
329
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
281
330
  #{VALIDATING_BLANK_HDR}
282
331
 
283
332
  == Scope
284
333
 
285
334
  === Scope subclause
286
335
  INPUT
336
+ expect(File.read("test.err")).to include "Scope contains subclauses: should be succinct"
287
337
  end
288
338
 
289
339
 
290
340
  it "warns that Table should have title" do
291
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Table should have title}).to_stderr
341
+ FileUtils.rm_f "test.err"
342
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
292
343
  #{VALIDATING_BLANK_HDR}
293
344
 
294
345
  |===
295
346
  |a |b |c
296
347
  |===
297
348
  INPUT
349
+ expect(File.read("test.err")).to include "Table should have title"
298
350
  end
299
351
 
300
352
  it "gives Style warning if number not broken up in threes" do
301
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{number not broken up in threes}).to_stderr
353
+ FileUtils.rm_f "test.err"
354
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
302
355
  #{VALIDATING_BLANK_HDR}
303
356
 
304
357
  == Clause
305
358
  12121
306
359
  INPUT
360
+ expect(File.read("test.err")).to include "number not broken up in threes"
307
361
  end
308
362
 
309
363
  it "gives No style warning if number not broken up in threes is ISO reference" do
310
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to_not output(%r{number not broken up in threes}).to_stderr
364
+ FileUtils.rm_f "test.err"
365
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
311
366
  #{VALIDATING_BLANK_HDR}
312
367
 
313
368
  == Clause
314
369
  ISO 12121
315
370
  INPUT
371
+ expect(File.read("test.err")).not_to include "number not broken up in threes"
316
372
  end
317
373
 
318
374
  it "Style warning if decimal point" do
319
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{possible decimal point}).to_stderr
375
+ FileUtils.rm_f "test.err"
376
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
320
377
  #{VALIDATING_BLANK_HDR}
321
378
 
322
379
  == Clause
323
380
  8.1
324
381
  INPUT
382
+ expect(File.read("test.err")).to include "possible decimal point"
325
383
  end
326
384
 
327
385
  it "Style warning if billion used" do
328
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{ambiguous number}).to_stderr
386
+ FileUtils.rm_f "test.err"
387
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
329
388
  #{VALIDATING_BLANK_HDR}
330
389
 
331
390
  == Clause
332
391
  "Billions" are a term of art.
333
392
  INPUT
393
+ expect(File.read("test.err")).to include "ambiguous number"
334
394
  end
335
395
 
336
396
  it "Style warning if no space before percent sign" do
337
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no space before percent sign}).to_stderr
397
+ FileUtils.rm_f "test.err"
398
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
338
399
  #{VALIDATING_BLANK_HDR}
339
400
 
340
401
  == Clause
341
402
  95%
342
403
  INPUT
404
+ expect(File.read("test.err")).to include "no space before percent sign"
343
405
  end
344
406
 
345
407
  it "Style warning if unbracketed tolerance before percent sign" do
346
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{unbracketed tolerance before percent sign}).to_stderr
408
+ FileUtils.rm_f "test.err"
409
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
347
410
  #{VALIDATING_BLANK_HDR}
348
411
 
349
412
  == Clause
350
413
  95 ± 5 %
351
414
  INPUT
415
+ expect(File.read("test.err")).to include "unbracketed tolerance before percent sign"
352
416
  end
353
417
 
354
418
  it "Style warning if dots in abbreviation" do
355
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no dots in abbreviation}).to_stderr
419
+ FileUtils.rm_f "test.err"
420
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
356
421
  #{VALIDATING_BLANK_HDR}
357
422
 
358
423
  == Clause
359
424
  r.p.m.
360
425
  INPUT
426
+ expect(File.read("test.err")).to include "no dots in abbreviation"
361
427
  end
362
428
 
363
429
  it "No Style warning if dots in abbreviation are e.g." do
364
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to_not output(%r{no dots in abbreviation}).to_stderr
430
+ FileUtils.rm_f "test.err"
431
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
365
432
  #{VALIDATING_BLANK_HDR}
366
433
 
367
434
  == Clause
368
435
  e.g. 5
369
436
  INPUT
437
+ expect(File.read("test.err")).not_to include "no dots in abbreviation"
370
438
  end
371
439
 
372
440
  it "Style warning if ppm used" do
373
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{language-specific abbreviation}).to_stderr
441
+ FileUtils.rm_f "test.err"
442
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
374
443
  #{VALIDATING_BLANK_HDR}
375
444
 
376
445
  == Clause
377
446
  5 ppm
378
447
  INPUT
448
+ expect(File.read("test.err")).to include "language-specific abbreviation"
379
449
  end
380
450
 
381
451
  it "Style warning if space between number and degree" do
382
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{space between number and degrees/minutes/seconds}).to_stderr
452
+ FileUtils.rm_f "test.err"
453
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
383
454
  #{VALIDATING_BLANK_HDR}
384
455
 
385
456
  == Clause
386
457
  5 °
387
458
  INPUT
459
+ expect(File.read("test.err")).to include "space between number and degrees/minutes/seconds"
388
460
  end
389
461
 
390
462
  it "Style warning if no space between number and SI unit" do
391
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{no space between number and SI unit}).to_stderr
463
+ FileUtils.rm_f "test.err"
464
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
392
465
  #{VALIDATING_BLANK_HDR}
393
466
 
394
467
  == Clause
395
468
  A measurement of 5Bq was taken.
396
469
  INPUT
470
+ expect(File.read("test.err")).to include "no space between number and SI unit"
397
471
  end
398
472
 
399
473
  it "Style warning if mins used" do
400
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-standard unit}).to_stderr
474
+ FileUtils.rm_f "test.err"
475
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
401
476
  #{VALIDATING_BLANK_HDR}
402
477
 
403
478
  == Clause
404
479
  5 mins
405
480
  INPUT
481
+ expect(File.read("test.err")).to include "non-standard unit"
406
482
  end
407
483
 
408
484
  # can't test: our asciidoc template won't allow this to be generated
@@ -426,7 +502,8 @@ end
426
502
  #end
427
503
 
428
504
  it "Style warning if two Symbols and Abbreviated Terms sections" do
429
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{only one Symbols and Abbreviated Terms section in the standard}).to_stderr
505
+ FileUtils.rm_f "test.err"
506
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
430
507
  #{VALIDATING_BLANK_HDR}
431
508
 
432
509
  == Terms and Abbreviations
@@ -435,30 +512,36 @@ it "Style warning if two Symbols and Abbreviated Terms sections" do
435
512
 
436
513
  == Symbols and Abbreviated Terms
437
514
  INPUT
515
+ expect(File.read("test.err")).to include "Only one Symbols and Abbreviated Terms section in the standard"
438
516
  end
439
517
 
440
518
  it "Style warning if Symbols and Abbreviated Terms contains extraneous matter" do
441
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Symbols and Abbreviated Terms can only contain a definition list}).to_stderr
519
+ FileUtils.rm_f "test.err"
520
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
442
521
  #{VALIDATING_BLANK_HDR}
443
522
 
444
523
  == Symbols and Abbreviated Terms
445
524
 
446
525
  Paragraph
447
526
  INPUT
527
+ expect(File.read("test.err")).to include "Symbols and Abbreviated Terms can only contain a definition list"
448
528
  end
449
529
 
450
530
  it "Warning if do not start with scope or introduction" do
451
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Prefatory material must be followed by \(clause\) Scope}).to_stderr
531
+ FileUtils.rm_f "test.err"
532
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
452
533
  #{VALIDATING_BLANK_HDR}
453
534
 
454
535
  == Symbols and Abbreviated Terms
455
536
 
456
537
  Paragraph
457
538
  INPUT
539
+ expect(File.read("test.err")).to include "Prefatory material must be followed by (clause) Scope"
458
540
  end
459
541
 
460
542
  it "Warning if introduction not followed by scope" do
461
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Prefatory material must be followed by \(clause\) Scope}).to_stderr
543
+ FileUtils.rm_f "test.err"
544
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
462
545
  #{VALIDATING_BLANK_HDR}
463
546
 
464
547
  .Foreword
@@ -470,10 +553,12 @@ it "Warning if introduction not followed by scope" do
470
553
 
471
554
  Paragraph
472
555
  INPUT
556
+ expect(File.read("test.err")).to include "Prefatory material must be followed by (clause) Scope"
473
557
  end
474
558
 
475
559
  it "Warning if normative references not followed by terms and definitions" do
476
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Normative References must be followed by Terms and Definitions}).to_stderr
560
+ FileUtils.rm_f "test.err"
561
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
477
562
  #{VALIDATING_BLANK_HDR}
478
563
 
479
564
  .Foreword
@@ -488,10 +573,12 @@ it "Warning if normative references not followed by terms and definitions" do
488
573
 
489
574
  Paragraph
490
575
  INPUT
576
+ expect(File.read("test.err")).to include "Normative References must be followed by Terms and Definitions"
491
577
  end
492
578
 
493
579
  it "Warning if there are no clauses in the document" do
494
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Document must contain clause after Terms and Definitions}).to_stderr
580
+ FileUtils.rm_f "test.err"
581
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
495
582
  #{VALIDATING_BLANK_HDR}
496
583
 
497
584
  .Foreword
@@ -507,10 +594,12 @@ it "Warning if there are no clauses in the document" do
507
594
  == Symbols and Abbreviated Terms
508
595
 
509
596
  INPUT
597
+ expect(File.read("test.err")).to include "Document must contain clause after Terms and Definitions"
510
598
  end
511
599
 
512
600
  it "Warning if scope occurs after Terms and Definitions" do
513
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope must occur before Terms and Definitions}).to_stderr
601
+ FileUtils.rm_f "test.err"
602
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
514
603
  #{VALIDATING_BLANK_HDR}
515
604
 
516
605
  .Foreword
@@ -526,10 +615,12 @@ it "Warning if scope occurs after Terms and Definitions" do
526
615
  == Scope
527
616
 
528
617
  INPUT
618
+ expect(File.read("test.err")).to include "Scope must occur before Terms and Definitions"
529
619
  end
530
620
 
531
621
  it "Warning if scope occurs after Terms and Definitions" do
532
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Scope must occur before Terms and Definitions}).to_stderr
622
+ FileUtils.rm_f "test.err"
623
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
533
624
  #{VALIDATING_BLANK_HDR}
534
625
 
535
626
  .Foreword
@@ -547,10 +638,12 @@ it "Warning if scope occurs after Terms and Definitions" do
547
638
  == Scope
548
639
 
549
640
  INPUT
641
+ expect(File.read("test.err")).to include "Scope must occur before Terms and Definitions"
550
642
  end
551
643
 
552
644
  it "Warning if Symbols and Abbreviated Terms does not occur immediately after Terms and Definitions" do
553
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Only annexes and references can follow clauses}).to_stderr
645
+ FileUtils.rm_f "test.err"
646
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
554
647
  #{VALIDATING_BLANK_HDR}
555
648
 
556
649
  .Foreword
@@ -568,10 +661,12 @@ it "Warning if Symbols and Abbreviated Terms does not occur immediately after Te
568
661
  == Symbols and Abbreviated Terms
569
662
 
570
663
  INPUT
664
+ expect(File.read("test.err")).to include "Only annexes and references can follow clauses"
571
665
  end
572
666
 
573
667
  it "Warning if no normative references" do
574
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Document must include \(references\) Normative References}).to_stderr
668
+ FileUtils.rm_f "test.err"
669
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
575
670
  #{VALIDATING_BLANK_HDR}
576
671
 
577
672
  .Foreword
@@ -593,10 +688,12 @@ it "Warning if no normative references" do
593
688
  == Appendix C
594
689
 
595
690
  INPUT
691
+ expect(File.read("test.err")).to include "Document must include (references) Normative References"
596
692
  end
597
693
 
598
694
  it "Warning if final section is not named Bibliography" do
599
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{There are sections after the final Bibliography}).to_stderr
695
+ FileUtils.rm_f "test.err"
696
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
600
697
  #{VALIDATING_BLANK_HDR}
601
698
 
602
699
  .Foreword
@@ -624,10 +721,12 @@ it "Warning if final section is not named Bibliography" do
624
721
  == Appendix C
625
722
 
626
723
  INPUT
724
+ expect(File.read("test.err")).to include "There are sections after the final Bibliography"
627
725
  end
628
726
 
629
727
  it "Warning if final section is not styled Bibliography" do
630
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Section not marked up as \[bibliography\]!}).to_stderr
728
+ FileUtils.rm_f "test.err"
729
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
631
730
  #{VALIDATING_BLANK_HDR}
632
731
 
633
732
  .Foreword
@@ -651,10 +750,12 @@ it "Warning if final section is not styled Bibliography" do
651
750
  == Bibliography
652
751
 
653
752
  INPUT
753
+ expect(File.read("test.err")).to include "Section not marked up as [bibliography]"
654
754
  end
655
755
 
656
756
  it "Warning if English title intro and no French title intro" do
657
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title Intro!}).to_stderr
757
+ FileUtils.rm_f "test.err"
758
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
658
759
  = Document title
659
760
  Author
660
761
  :docfile: test.adoc
@@ -663,10 +764,12 @@ it "Warning if English title intro and no French title intro" do
663
764
  :no-isobib:
664
765
 
665
766
  INPUT
767
+ expect(File.read("test.err")).to include "No French Title Intro"
666
768
  end
667
769
 
668
770
  it "Warning if French title intro and no English title intro" do
669
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title Intro!}).to_stderr
771
+ FileUtils.rm_f "test.err"
772
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
670
773
  = Document title
671
774
  Author
672
775
  :docfile: test.adoc
@@ -675,11 +778,13 @@ it "Warning if French title intro and no English title intro" do
675
778
  :no-isobib:
676
779
 
677
780
  INPUT
781
+ expect(File.read("test.err")).to include "No English Title Intro"
678
782
  end
679
783
 
680
784
 
681
785
  it "Warning if English title and no French intro" do
682
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title!}).to_stderr
786
+ FileUtils.rm_f "test.err"
787
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
683
788
  = Document title
684
789
  Author
685
790
  :docfile: test.adoc
@@ -688,10 +793,12 @@ it "Warning if English title and no French intro" do
688
793
  :no-isobib:
689
794
 
690
795
  INPUT
796
+ expect(File.read("test.err")).to include "No French Title"
691
797
  end
692
798
 
693
799
  it "Warning if French title and no English title" do
694
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title!}).to_stderr
800
+ FileUtils.rm_f "test.err"
801
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
695
802
  = Document title
696
803
  Author
697
804
  :docfile: test.adoc
@@ -700,10 +807,12 @@ it "Warning if French title and no English title" do
700
807
  :no-isobib:
701
808
 
702
809
  INPUT
810
+ expect(File.read("test.err")).to include "No English Title"
703
811
  end
704
812
 
705
813
  it "Warning if English title part and no French title part" do
706
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No French Title Part!}).to_stderr
814
+ FileUtils.rm_f "test.err"
815
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
707
816
  = Document title
708
817
  Author
709
818
  :docfile: test.adoc
@@ -712,10 +821,12 @@ it "Warning if English title part and no French title part" do
712
821
  :no-isobib:
713
822
 
714
823
  INPUT
824
+ expect(File.read("test.err")).to include "No French Title Part"
715
825
  end
716
826
 
717
827
  it "Warning if French title part and no English title part" do
718
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{No English Title Part!}).to_stderr
828
+ FileUtils.rm_f "test.err"
829
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
719
830
  = Document title
720
831
  Author
721
832
  :docfile: test.adoc
@@ -724,10 +835,12 @@ it "Warning if French title part and no English title part" do
724
835
  :no-isobib:
725
836
 
726
837
  INPUT
838
+ expect(File.read("test.err")).to include "No English Title Part"
727
839
  end
728
840
 
729
841
  it "Warning if non-IEC document with subpart" do
730
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Subpart defined on non-IEC document!}).to_stderr
842
+ FileUtils.rm_f "test.err"
843
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
731
844
  = Document title
732
845
  Author
733
846
  :docfile: test.adoc
@@ -738,10 +851,12 @@ it "Warning if non-IEC document with subpart" do
738
851
  :no-isobib:
739
852
 
740
853
  INPUT
854
+ expect(File.read("test.err")).to include "Subpart defined on non-IEC document"
741
855
  end
742
856
 
743
857
  it "No warning if joint IEC/non-IEC document with subpart" do
744
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(%r{Subpart defined on non-IEC document!}).to_stderr
858
+ FileUtils.rm_f "test.err"
859
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
745
860
  = Document title
746
861
  Author
747
862
  :docfile: test.adoc
@@ -752,10 +867,12 @@ it "No warning if joint IEC/non-IEC document with subpart" do
752
867
  :no-isobib:
753
868
 
754
869
  INPUT
870
+ expect(File.read("test.err")).not_to include "Subpart defined on non-IEC document"
755
871
  end
756
872
 
757
873
  it "Warning if main title contains document type" do
758
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Main Title may name document type}).to_stderr
874
+ FileUtils.rm_f "test.err"
875
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
759
876
  = Document title
760
877
  Author
761
878
  :docfile: test.adoc
@@ -764,10 +881,12 @@ it "Warning if main title contains document type" do
764
881
  :no-isobib:
765
882
 
766
883
  INPUT
884
+ expect(File.read("test.err")).to include "Main Title may name document type"
767
885
  end
768
886
 
769
887
  it "Warning if intro title contains document type" do
770
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Title Intro may name document type}).to_stderr
888
+ FileUtils.rm_f "test.err"
889
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
771
890
  = Document title
772
891
  Author
773
892
  :docfile: test.adoc
@@ -776,19 +895,23 @@ it "Warning if intro title contains document type" do
776
895
  :no-isobib:
777
896
 
778
897
  INPUT
898
+ expect(File.read("test.err")).to include "Title Intro may name document type"
779
899
  end
780
900
 
781
901
  it "Each first-level subclause must have a title" do
782
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{each first-level subclause must have a title}).to_stderr
902
+ FileUtils.rm_f "test.err"
903
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
783
904
  #{VALIDATING_BLANK_HDR}
784
905
  == Clause
785
906
 
786
907
  === {blank}
787
908
  INPUT
909
+ expect(File.read("test.err")).to include "each first-level subclause must have a title"
788
910
  end
789
911
 
790
912
  it "All subclauses must have a title, or none" do
791
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{all subclauses must have a title, or none}).to_stderr
913
+ FileUtils.rm_f "test.err"
914
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
792
915
  #{VALIDATING_BLANK_HDR}
793
916
  == Clause
794
917
 
@@ -798,20 +921,24 @@ it "All subclauses must have a title, or none" do
798
921
 
799
922
  ==== Subsubclause
800
923
  INPUT
924
+ expect(File.read("test.err")).to include "all subclauses must have a title, or none"
801
925
  end
802
926
 
803
927
  it "Warning if subclause is only child of its parent, or none" do
804
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{subclause is only child}).to_stderr
928
+ FileUtils.rm_f "test.err"
929
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
805
930
  #{VALIDATING_BLANK_HDR}
806
931
  == Clause
807
932
 
808
933
  === Subclause
809
934
 
810
935
  INPUT
936
+ expect(File.read("test.err")).to include "subclause is only child"
811
937
  end
812
938
 
813
939
  it "Warning if invalid technical committee type" do
814
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid technical committee type}).to_stderr
940
+ FileUtils.rm_f "test.err"
941
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
815
942
  = Document title
816
943
  Author
817
944
  :docfile: test.adoc
@@ -820,10 +947,12 @@ it "Warning if invalid technical committee type" do
820
947
  :no-isobib:
821
948
 
822
949
  INPUT
950
+ expect(File.read("test.err")).to include "invalid technical committee type"
823
951
  end
824
952
 
825
953
  it "Warning if invalid subcommittee type" do
826
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid subcommittee type}).to_stderr
954
+ FileUtils.rm_f "test.err"
955
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
827
956
  = Document title
828
957
  Author
829
958
  :docfile: test.adoc
@@ -832,10 +961,12 @@ it "Warning if invalid subcommittee type" do
832
961
  :no-isobib:
833
962
 
834
963
  INPUT
964
+ expect(File.read("test.err")).to include "invalid subcommittee type"
835
965
  end
836
966
 
837
967
  it "Warning if invalid subcommittee type" do
838
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{invalid subcommittee type}).to_stderr
968
+ FileUtils.rm_f "test.err"
969
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
839
970
  = Document title
840
971
  Author
841
972
  :docfile: test.adoc
@@ -844,10 +975,12 @@ it "Warning if invalid subcommittee type" do
844
975
  :no-isobib:
845
976
 
846
977
  INPUT
978
+ expect(File.read("test.err")).to include "invalid subcommittee type"
847
979
  end
848
980
 
849
981
  it "Warning if 'see' crossreference points to normative section" do
850
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{'see terms' is pointing to a normative section}).to_stderr
982
+ FileUtils.rm_f "test.err"
983
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
851
984
  #{VALIDATING_BLANK_HDR}
852
985
  [[terms]]
853
986
  == Terms and Definitions
@@ -855,10 +988,12 @@ it "Warning if 'see' crossreference points to normative section" do
855
988
  == Clause
856
989
  See <<terms>>
857
990
  INPUT
991
+ expect(File.read("test.err")).to include "'see terms' is pointing to a normative section"
858
992
  end
859
993
 
860
994
  it "Warning if 'see' reference points to normative reference" do
861
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{is pointing to a normative reference}).to_stderr
995
+ FileUtils.rm_f "test.err"
996
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
862
997
  #{VALIDATING_BLANK_HDR}
863
998
  [bibliography]
864
999
  == Normative References
@@ -867,10 +1002,12 @@ it "Warning if 'see' reference points to normative reference" do
867
1002
  == Clause
868
1003
  See <<terms>>
869
1004
  INPUT
1005
+ expect(File.read("test.err")).to include "is pointing to a normative reference"
870
1006
  end
871
1007
 
872
1008
  it "Warning if term definition starts with article" do
873
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{term definition starts with article}).to_stderr
1009
+ FileUtils.rm_f "test.err"
1010
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
874
1011
  #{VALIDATING_BLANK_HDR}
875
1012
  == Terms and Definitions
876
1013
 
@@ -878,10 +1015,12 @@ it "Warning if term definition starts with article" do
878
1015
 
879
1016
  The definition of a term is a part of the specialized vocabulary of a particular field
880
1017
  INPUT
1018
+ expect(File.read("test.err")).to include "term definition starts with article"
881
1019
  end
882
1020
 
883
1021
  it "Warning if term definition ends with period" do
884
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{term definition ends with period}).to_stderr
1022
+ FileUtils.rm_f "test.err"
1023
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
885
1024
  #{VALIDATING_BLANK_HDR}
886
1025
  == Terms and Definitions
887
1026
 
@@ -889,19 +1028,23 @@ it "Warning if term definition ends with period" do
889
1028
 
890
1029
  Part of the specialized vocabulary of a particular field.
891
1030
  INPUT
1031
+ expect(File.read("test.err")).to include "term definition ends with period"
892
1032
  end
893
1033
 
894
1034
  it "validates document against ISO XML schema" do
895
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{value of attribute "align" is invalid; must be equal to}).to_stderr
1035
+ FileUtils.rm_f "test.err"
1036
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
896
1037
  #{VALIDATING_BLANK_HDR}
897
1038
 
898
1039
  [align=mid-air]
899
1040
  Para
900
1041
  INPUT
1042
+ expect(File.read("test.err")).to include 'value of attribute "align" is invalid; must be equal to'
901
1043
  end
902
1044
 
903
1045
  it "Warn if more than 7 levels of subclause" do
904
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Exceeds the maximum clause depth of 7}).to_stderr
1046
+ FileUtils.rm_f "test.err"
1047
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
905
1048
  = Document title
906
1049
  Author
907
1050
  :docfile: test.adoc
@@ -929,10 +1072,12 @@ it "Warn if more than 7 levels of subclause" do
929
1072
  ====== Clause
930
1073
 
931
1074
  INPUT
1075
+ expect(File.read("test.err")).to include "Exceeds the maximum clause depth of 7"
932
1076
  end
933
1077
 
934
1078
  it "Do not warn if not more than 7 levels of subclause" do
935
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(%r{exceeds the maximum clause depth of 7}).to_stderr
1079
+ FileUtils.rm_f "test.err"
1080
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
936
1081
  = Document title
937
1082
  Author
938
1083
  :docfile: test.adoc
@@ -957,10 +1102,12 @@ it "Do not warn if not more than 7 levels of subclause" do
957
1102
  ====== Clause
958
1103
 
959
1104
  INPUT
1105
+ expect(File.read("test.err")).not_to include "exceeds the maximum clause depth of 7"
960
1106
  end
961
1107
 
962
1108
  it "Warn if term citation in Terms & Definitions not preceded with italicised term" do
963
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{term citation not preceded with italicised term}).to_stderr
1109
+ FileUtils.rm_f "test.err"
1110
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
964
1111
  #{VALIDATING_BLANK_HDR}
965
1112
  == Terms and Definitions
966
1113
 
@@ -969,16 +1116,19 @@ it "Warn if term citation in Terms & Definitions not preceded with italicised te
969
1116
 
970
1117
  The definition of a term (<<term>>) is a part of the specialized vocabulary of a particular field
971
1118
  INPUT
1119
+ expect(File.read("test.err")).to include "term citation not preceded with italicised term"
972
1120
  end
973
1121
 
974
1122
  it "Warn if an undated reference has no associated footnote" do
975
- expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{Reference ISO8 does not have an associated footnote indicating unpublished status}).to_stderr
1123
+ FileUtils.rm_f "test.err"
1124
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
976
1125
  #{VALIDATING_BLANK_HDR}
977
1126
 
978
1127
  [bibliography]
979
1128
  == Bibliography
980
1129
  * [[[ISO8,ISO 8:--]]], _Title_
981
1130
  INPUT
1131
+ expect(File.read("test.err")).to include "Reference ISO8 does not have an associated footnote indicating unpublished status"
982
1132
  end
983
1133
 
984
1134