metanorma-iso 1.5.10 → 1.5.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,6 +81,9 @@ INPUT
81
81
  {:accesseddate=>"2012",
82
82
  :activateddate=>"2013",
83
83
  :agency=>"ISO",
84
+ :circulateddate=>"XXX",
85
+ :confirmeddate=>"XXX",
86
+ :copieddate=>"XXX",
84
87
  :createddate=>"2010–2011",
85
88
  :docnumber=>"ISO/PreCD3 17301-1",
86
89
  :docnumber_lang=>"ISO/PreCD3 17301-1 (E)",
@@ -97,18 +100,24 @@ INPUT
97
100
  :doctitlepart=>"Rice",
98
101
  :doctitlepartlabel=>"Part 1",
99
102
  :doctype=>"International Standard",
103
+ :doctype_display=>"International Standard",
100
104
  :docyear=>"2016",
101
105
  :draft=>"0.4",
102
106
  :draftinfo=>" (draft 0.4, 2016-05-01)",
103
107
  :edition=>"2",
104
108
  :editorialgroup=>["TC 34", "SC 4", "WG 3"],
109
+ :implementeddate=>"XXX",
110
+ :issueddate=>"XXX",
105
111
  :keywords=>["kw2", "kw1"],
112
+ :lang=>"en",
106
113
  :obsoleteddate=>"2014",
107
114
  :publisheddate=>"2011",
108
115
  :publisher=>"International Organization for Standardization",
116
+ :receiveddate=>"XXX",
109
117
  :revdate=>"2016-05-01",
110
118
  :revdate_monthyear=>"May 2016",
111
119
  :sc=>"SC 4",
120
+ :script=>"Latn",
112
121
  :secretariat=>"GB",
113
122
  :stage=>"30",
114
123
  :stage_int=>30,
@@ -116,12 +125,17 @@ INPUT
116
125
  :statusabbr=>"PreCD3",
117
126
  :tc=>"TC 34",
118
127
  :tc_docnumber=>["17301", "17302"],
128
+ :transmitteddate=>"XXX",
129
+ :unchangeddate=>"XXX",
119
130
  :unpublished=>true,
131
+ :updateddate=>"XXX",
132
+ :vote_endeddate=>"XXX",
133
+ :vote_starteddate=>"XXX",
120
134
  :wg=>"WG 3"}
121
135
  OUTPUT
122
136
  end
123
137
 
124
- it "processes IsoXML metadata" do
138
+ it "processes IsoXML metadata #2" do
125
139
  c = IsoDoc::Iso::HtmlConvert.new({})
126
140
  arr = c.convert_init(<<~"INPUT", "test", false)
127
141
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -198,7 +212,12 @@ OUTPUT
198
212
  </bibdata>
199
213
  </iso-standard>
200
214
  INPUT
201
- {:agency=>"ISO/IEC",
215
+ {:accesseddate=>"XXX",
216
+ :agency=>"ISO/IEC",
217
+ :circulateddate=>"XXX",
218
+ :confirmeddate=>"XXX",
219
+ :copieddate=>"XXX",
220
+ :createddate=>"XXX",
202
221
  :docnumber=>"ISO/IEC/CD 17301-1-3",
203
222
  :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
204
223
  :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
@@ -213,20 +232,166 @@ INPUT
213
232
  :doctitlepart=>"Rice",
214
233
  :doctitlepartlabel=>"Part&nbsp;1&ndash;3",
215
234
  :doctype=>"International Standard",
235
+ :doctype_display=>"International Standard",
216
236
  :docyear=>"2016",
217
237
  :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
218
238
  :ics=>"1.2.3, 1.2.3",
239
+ :implementeddate=>"XXX",
240
+ :issueddate=>"XXX",
241
+ :lang=>"en",
242
+ :obsoleteddate=>"XXX",
219
243
  :obsoletes=>"IEC 8121",
220
244
  :obsoletes_part=>"3.1",
245
+ :publisheddate=>"XXX",
221
246
  :publisher=>"International Organization for Standardization and International Electrotechnical Commission",
247
+ :receiveddate=>"XXX",
248
+ :sc=>"DEF 4",
249
+ :script=>"Latn",
250
+ :secretariat=>"XXX",
251
+ :stage=>"60",
252
+ :stage_int=>60,
253
+ :statusabbr=>"IS",
254
+ :tc=>"ABC 34",
255
+ :tc_docnumber=>["17301"],
256
+ :transmitteddate=>"XXX",
257
+ :unchangeddate=>"XXX",
258
+ :unpublished=>false,
259
+ :updateddate=>"XXX",
260
+ :vote_endeddate=>"XXX",
261
+ :vote_starteddate=>"XXX",
262
+ :wg=>"GHI 3"}
263
+ OUTPUT
264
+ end
265
+
266
+ it "processes IsoXML metadata in French" do
267
+ c = IsoDoc::Iso::HtmlConvert.new({})
268
+ arr = c.convert_init(<<~"INPUT", "test", false)
269
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
270
+ <bibdata>
271
+ <language>fr</language>
272
+ </bibdata>
273
+ </iso-standard>
274
+ INPUT
275
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
276
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
277
+ <bibdata type="standard">
278
+ <title>
279
+ <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
280
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
281
+ <title type="title-part" language="en" format="text/plain">Rice</title>
282
+ </title>
283
+ <title>
284
+ <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
285
+ <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
286
+ <title type="title-part" language="fr" format="text/plain">Riz</title>
287
+ </title>
288
+ <docidentifier type="ISO">ISO/IEC/CD 17301-1-3</docidentifier>
289
+ <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
290
+ <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
291
+ <docidentifier type="iso-tc">17301</docidentifier>
292
+ <contributor>
293
+ <role type="author"/>
294
+ <organization>
295
+ <name>ISO</name>
296
+ </organization>
297
+ </contributor>
298
+ <contributor>
299
+ <role type="publisher"/>
300
+ <organization>
301
+ <name>International Organization for Standardization</name>
302
+ <abbreviation>ISO</abbreviation>
303
+ </organization>
304
+ </contributor>
305
+ <contributor>
306
+ <role type="publisher"/>
307
+ <organization>
308
+ <name>International Electrotechnical Commission</name>
309
+ <abbreviation>IEC</abbreviation>
310
+ </organization>
311
+ </contributor>
312
+ <language>fr</language>
313
+ <script>Latn</script>
314
+ <status>
315
+ <stage abbreviation="IS">60</stage>
316
+ <substage>92</substage>
317
+ </status>
318
+ <copyright>
319
+ <from>2016</from>
320
+ <owner>
321
+ <organization>
322
+ <name>International Organization for Standardization</name>
323
+ </organization>
324
+ </owner>
325
+ </copyright>
326
+ <relation type="obsoletes">
327
+ <locality type="clause"><referenceFrom>3.1</referenceFrom></locality>
328
+ <docidentifier>IEC 8121</docidentifier>
329
+ </relation>
330
+ <ext>
331
+ <doctype language="">international-standard</doctype>
332
+ <doctype language="fr">Standard International</doctype>
333
+ <editorialgroup>
334
+ <technical-committee number="34" type="ABC">Food products</technical-committee>
335
+ <subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
336
+ <workgroup number="3" type="GHI">Rice Group</workgroup>
337
+ </editorialgroup>
338
+ <ics><code>1.2.3</code></ics>
339
+ <ics><code>1.2.3</code></ics>
340
+ <structuredidentifier>
341
+ <project-number part="1" subpart="3">ISO/IEC/CD 17301</project-number>
342
+ </strucuredidentifier>
343
+ <stagename>International standard</stagename>
344
+ </ext>
345
+ </bibdata>
346
+ </iso-standard>
347
+ INPUT
348
+ {:accesseddate=>"XXX",
349
+ :agency=>"ISO/IEC",
350
+ :circulateddate=>"XXX",
351
+ :confirmeddate=>"XXX",
352
+ :copieddate=>"XXX",
353
+ :createddate=>"XXX",
354
+ :docnumber=>"ISO/IEC/CD 17301-1-3",
355
+ :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)",
356
+ :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)",
357
+ :docsubtitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice",
358
+ :docsubtitleintro=>"Cereals and pulses",
359
+ :docsubtitlemain=>"Specifications and test methods",
360
+ :docsubtitlepart=>"Rice",
361
+ :docsubtitlepartlabel=>"Part&nbsp;1&ndash;3",
362
+ :doctitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz",
363
+ :doctitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses",
364
+ :doctitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai",
365
+ :doctitlepart=>"Riz",
366
+ :doctitlepartlabel=>"Partie&nbsp;1&ndash;3",
367
+ :doctype=>"International Standard",
368
+ :doctype_display=>"Standard International",
369
+ :docyear=>"2016",
370
+ :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
371
+ :ics=>"1.2.3, 1.2.3",
372
+ :implementeddate=>"XXX",
373
+ :issueddate=>"XXX",
374
+ :lang=>"fr",
375
+ :obsoleteddate=>"XXX",
376
+ :obsoletes=>"IEC 8121",
377
+ :obsoletes_part=>"3.1",
378
+ :publisheddate=>"XXX",
379
+ :publisher=>"International Organization for Standardization et International Electrotechnical Commission",
380
+ :receiveddate=>"XXX",
222
381
  :sc=>"DEF 4",
223
- :secretariat=>"XXXX",
382
+ :script=>"Latn",
383
+ :secretariat=>"XXX",
224
384
  :stage=>"60",
225
385
  :stage_int=>60,
226
386
  :statusabbr=>"IS",
227
387
  :tc=>"ABC 34",
228
388
  :tc_docnumber=>["17301"],
389
+ :transmitteddate=>"XXX",
390
+ :unchangeddate=>"XXX",
229
391
  :unpublished=>false,
392
+ :updateddate=>"XXX",
393
+ :vote_endeddate=>"XXX",
394
+ :vote_starteddate=>"XXX",
230
395
  :wg=>"GHI 3"}
231
396
  OUTPUT
232
397
  end
@@ -613,11 +613,8 @@ documentation.</p>
613
613
  presxml = <<~OUTPUT
614
614
  <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
615
615
  <bibdata type="standard">
616
- <status><stage>30</stage></status>
616
+ <status><stage language="">30</stage></status>
617
617
  </bibdata>
618
- <local_bibdata type="standard">
619
- <status><stage>30</stage></status>
620
- </local_bibdata>
621
618
  <boilerplate>
622
619
  <copyright-statement>
623
620
  <clause inline-header="true">
@@ -664,7 +661,7 @@ documentation.</p>
664
661
 
665
662
  FileUtils.rm_f "test.doc"
666
663
  FileUtils.rm_f "test.html"
667
- expect((IsoDoc::Iso::PresentationXMLConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
664
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
668
665
  IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", presxml, false)
669
666
  word = File.read("test.html", encoding: "UTF-8")
670
667
  expect((word)).to include '<h1 class="IntroTitle">Warning for Stuff</h1>'
@@ -123,11 +123,8 @@ RSpec.describe IsoDoc do
123
123
  presxml = <<~OUTPUT
124
124
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
125
125
  <bibdata>
126
- <language>en</language>
126
+ <language current="true">en</language>
127
127
  </bibdata>
128
- <local_bibdata>
129
- <language>en</language>
130
- </local_bibdata>
131
128
  <preface>
132
129
  <foreword>
133
130
  <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
@@ -342,7 +339,7 @@ html = <<~OUTPUT
342
339
  </body>
343
340
  </html>
344
341
  OUTPUT
345
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
342
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
346
343
  expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
347
344
  end
348
345
 
@@ -118,8 +118,15 @@ BOILERPLATE =
118
118
  gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’")
119
119
  )
120
120
 
121
+ BOILERPLATE_FR =
122
+ HTMLEntities.new.decode(
123
+ File.read(File.join(File.dirname(__FILE__), "..", "lib", "asciidoctor", "iso", "boilerplate-fr.xml"), encoding: "utf-8").
124
+ gsub(/\{\{ agency \}\}/, "ISO").gsub(/\{\{ docyear \}\}/, Date.today.year.to_s).
125
+ gsub(/\{% if unpublished %\}.*\{% endif %\}/m, "").
126
+ gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’")
127
+ )
121
128
 
122
- BLANK_HDR = <<~"HDR"
129
+ BLANK_HDR1 = <<~"HDR"
123
130
  <?xml version="1.0" encoding="UTF-8"?>
124
131
  <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
125
132
  <bibdata type="standard">
@@ -162,9 +169,18 @@ BLANK_HDR = <<~"HDR"
162
169
  <stagename>International standard</stagename>
163
170
  </ext>
164
171
  </bibdata>
172
+ HDR
173
+
174
+ BLANK_HDR = <<~"HDR"
175
+ #{BLANK_HDR1}
165
176
  #{BOILERPLATE}
166
177
  HDR
167
178
 
179
+ BLANK_HDR_FR = <<~"HDR"
180
+ #{BLANK_HDR1.sub(%r{<language>en</language>}, "<language>fr</language>")}
181
+ #{BOILERPLATE_FR}
182
+ HDR
183
+
168
184
  TERM_BOILERPLATE = <<~END
169
185
  <p id="_">For the purposes of this document,
170
186
  the following terms and definitions apply.</p>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.10
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-11 00:00:00.000000000 Z
11
+ date: 2020-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing
@@ -284,6 +284,7 @@ files:
284
284
  - lib/asciidoctor/iso/base.rb
285
285
  - lib/asciidoctor/iso/basicdoc.rng
286
286
  - lib/asciidoctor/iso/biblio.rng
287
+ - lib/asciidoctor/iso/boilerplate-fr.xml
287
288
  - lib/asciidoctor/iso/boilerplate.xml
288
289
  - lib/asciidoctor/iso/cleanup.rb
289
290
  - lib/asciidoctor/iso/converter.rb