isodoc 1.6.2 → 1.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +2 -12
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -6
  5. data/Rakefile +2 -2
  6. data/isodoc.gemspec +3 -2
  7. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  8. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  9. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  10. data/lib/isodoc.rb +0 -2
  11. data/lib/isodoc/convert.rb +7 -1
  12. data/lib/isodoc/function/blocks.rb +5 -4
  13. data/lib/isodoc/function/cleanup.rb +52 -43
  14. data/lib/isodoc/function/inline.rb +7 -7
  15. data/lib/isodoc/function/references.rb +32 -51
  16. data/lib/isodoc/function/section.rb +28 -16
  17. data/lib/isodoc/function/table.rb +21 -22
  18. data/lib/isodoc/function/terms.rb +6 -7
  19. data/lib/isodoc/function/to_word_html.rb +6 -3
  20. data/lib/isodoc/function/utils.rb +181 -163
  21. data/lib/isodoc/gem_tasks.rb +8 -9
  22. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  23. data/lib/isodoc/html_convert.rb +5 -1
  24. data/lib/isodoc/html_function/comments.rb +14 -12
  25. data/lib/isodoc/html_function/footnotes.rb +14 -7
  26. data/lib/isodoc/html_function/html.rb +30 -26
  27. data/lib/isodoc/html_function/postprocess.rb +191 -182
  28. data/lib/isodoc/html_function/sectionsplit.rb +230 -0
  29. data/lib/isodoc/metadata.rb +22 -20
  30. data/lib/isodoc/metadata_contributor.rb +31 -28
  31. data/lib/isodoc/pdf_convert.rb +11 -13
  32. data/lib/isodoc/presentation_function/bibdata.rb +61 -30
  33. data/lib/isodoc/presentation_function/inline.rb +34 -27
  34. data/lib/isodoc/presentation_function/section.rb +54 -19
  35. data/lib/isodoc/presentation_xml_convert.rb +2 -0
  36. data/lib/isodoc/sassc_importer.rb +1 -1
  37. data/lib/isodoc/version.rb +1 -1
  38. data/lib/isodoc/word_function/postprocess.rb +50 -36
  39. data/lib/isodoc/xref.rb +2 -0
  40. data/lib/isodoc/xref/xref_counter.rb +1 -2
  41. data/lib/isodoc/xref/xref_gen.rb +21 -14
  42. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  43. data/lib/isodoc/xref/xref_sect_gen.rb +15 -15
  44. data/spec/assets/scripts_override.html +3 -0
  45. data/spec/isodoc/blocks_spec.rb +624 -997
  46. data/spec/isodoc/cleanup_spec.rb +40 -42
  47. data/spec/isodoc/i18n_spec.rb +694 -821
  48. data/spec/isodoc/inline_spec.rb +482 -328
  49. data/spec/isodoc/metadata_spec.rb +384 -379
  50. data/spec/isodoc/postproc_spec.rb +163 -55
  51. data/spec/isodoc/presentation_xml_spec.rb +355 -278
  52. data/spec/isodoc/ref_spec.rb +5 -5
  53. data/spec/isodoc/section_spec.rb +216 -199
  54. data/spec/isodoc/sectionsplit_spec.rb +190 -0
  55. data/spec/isodoc/table_spec.rb +41 -42
  56. data/spec/isodoc/terms_spec.rb +84 -84
  57. data/spec/isodoc/xref_spec.rb +974 -932
  58. metadata +22 -5
@@ -4,391 +4,396 @@ require "nokogiri"
4
4
  RSpec.describe IsoDoc do
5
5
  it "processes IsoXML metadata" do
6
6
  c = IsoDoc::Convert.new({})
7
- arr = c.convert_init(<<~"INPUT", "test", false)
8
- <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ c.convert_init(<<~"INPUT", "test", false)
8
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
9
9
  INPUT
10
- expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
11
- <iso-standard xmlns="http://riboseinc.com/isoxml">
12
- <bibdata type="standard">
13
- <title>The Incredible Mr Ripley</title>
14
- <title language="en">Cereals and pulses</title>
15
- <uri>URL A</uri>
16
- <uri type="html">URL B</uri>
17
- <uri type="xml">URL C</uri>
18
- <uri type="pdf">URL D</uri>
19
- <uri type="doc">URL E</uri>
20
- <docidentifier>17301-1</docidentifier>
21
- <docidentifier type="ISBN">ISBN 13</docidentifier>
22
- <docidentifier type="ISBN10">ISBN 10</docidentifier>
23
- <docnumber>17301</docnumber>
24
- <date type="published"><on>2011</on></date>
25
- <date type="accessed"><on>2012</on></date>
26
- <date type="created"><from>2010</from><to>2011</to></date>
27
- <date type="activated"><on>2013</on></date>
28
- <date type="obsoleted"><on>2014</on></date>
29
- <date type="circulated"><on>2015</on></date>
30
- <date type="copied"><on>2016</on></date>
31
- <date type="confirmed"><on>2017</on></date>
32
- <date type="updated"><on>2018</on></date>
33
- <date type="unchanged"><on>2019</on></date>
34
- <date type="transmitted"><on>2020</on></date>
35
- <date type="vote-started"><on>2021</on></date>
36
- <date type="vote-ended"><on>2022</on></date>
37
- <edition>2</edition>
38
- <version>
39
- <revision-date>2016-05-01</revision-date>
40
- <draft>0.4</draft>
41
- </version>
42
- <contributor>
43
- <role type="author"/>
44
- <organization>
45
- <abbreviation>ISO</abbreviation>
46
- </organization>
47
- </contributor>
48
- <contributor>
49
- <role type="publisher"/>
50
- <organization>
51
- <abbreviation>ISO</abbreviation>
52
- </organization>
53
- </contributor>
54
- <contributor>
55
- <role type="editor"/>
56
- <person>
57
- <name>
58
- <forename>Barney</forename>
59
- <surname>Rubble</surname>
60
- </name>
61
- <affiliation>
62
- <organization><name>Slate Inc.</name>
63
- <subdivision>Hermeneutics Unit</subdivision>
64
- <subdivision>Exegesis Subunit</subdivision>
65
- <address>
66
- <formattedAddress>Bedrock</formattedAddress>
67
- </address>
68
- </organization>
69
- </affiliation>
70
- </person>
71
- </contributor>
72
- <contributor>
73
- <role type="author"/>
74
- <person>
75
- <name>
76
- <completename>Fred Flintstone</completename>
77
- </name>
78
- </person>
79
- </contributor>
80
- <note type="title-footnote"><p>A footnote</p></note>
81
- <note type="iso"><p>A note</p></note>
82
- <note type="title-footnote"><p>Another footnote</p></note>
83
- <language>en</language>
84
- <script>Latn</script>
85
- <status>
86
- <stage>Committee Draft</stage>
87
- <substage>Withdrawn</substage>
88
- <iteration>2</iteration>
89
- </status>
90
- <copyright>
91
- <from>2016</from>
92
- <owner>
93
- <organization>
94
- <abbreviation>ISO</abbreviation>
95
- </organization>
96
- </owner>
97
- </copyright>
98
- <keyword>KW2</keyword>
99
- <keyword>KW1</keyword>
100
- <keyword>KW3</keyword>
101
- <ext>
102
- <doctype>international-standard</doctype>
103
- </ext>
104
- </bibdata>
105
- </iso-standard>
106
- INPUT
107
- {:accesseddate=>"2012",
108
- :activateddate=>"2013",
109
- :agency=>"ISO",
110
- :authors=>["Barney Rubble", "Fred Flintstone"],
111
- :authors_affiliations=>{"Slate Inc., Hermeneutics Unit, Exegesis Subunit, Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]},
112
- :circulateddate=>"2015",
113
- :confirmeddate=>"2017",
114
- :copieddate=>"2016",
115
- :createddate=>"2010&ndash;2011",
116
- :doc=>"URL E",
117
- :docnumber=>"17301-1",
118
- :docnumeric=>"17301",
119
- :doctitle=>"Cereals and pulses",
120
- :doctype=>"International Standard",
121
- :doctype_display=>"International Standard",
122
- :docyear=>"2016",
123
- :draft=>"0.4",
124
- :draftinfo=>" (draft 0.4, 2016-05-01)",
125
- :edition=>"2",
126
- :html=>"URL B",
127
- :implementeddate=>"XXX",
128
- :isbn=>"ISBN 13",
129
- :isbn10=>"ISBN 10",
130
- :issueddate=>"XXX",
131
- :iteration=>"2",
132
- :keywords=>["KW2", "KW1", "KW3"],
133
- :lang=>"en",
134
- :obsoleteddate=>"2014",
135
- :pdf=>"URL D",
136
- :publisheddate=>"2011",
137
- :receiveddate=>"XXX",
138
- :revdate=>"2016-05-01",
139
- :revdate_monthyear=>"May 2016",
140
- :script=>"Latn",
141
- :stage=>"Committee Draft",
142
- :stage_display=>"Committee Draft",
143
- :stageabbr=>"CD",
144
- :substage=>"Withdrawn",
145
- :substage_display=>"Withdrawn",
146
- :title_footnote=>["A footnote", "Another footnote"],
147
- :transmitteddate=>"2020",
148
- :unchangeddate=>"2019",
149
- :unpublished=>true,
150
- :updateddate=>"2018",
151
- :url=>"URL A",
152
- :vote_endeddate=>"2022",
153
- :vote_starteddate=>"2021",
154
- :xml=>"URL C"}
155
- OUTPUT
10
+ input = <<~INPUT
11
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
12
+ <bibdata type="standard">
13
+ <title>The Incredible Mr Ripley</title>
14
+ <title language="en">Cereals and pulses</title>
15
+ <uri>URL A</uri>
16
+ <uri type="html">URL B</uri>
17
+ <uri type="xml">URL C</uri>
18
+ <uri type="pdf">URL D</uri>
19
+ <uri type="doc">URL E</uri>
20
+ <docidentifier>17301-1</docidentifier>
21
+ <docidentifier type="ISBN">ISBN 13</docidentifier>
22
+ <docidentifier type="ISBN10">ISBN 10</docidentifier>
23
+ <docnumber>17301</docnumber>
24
+ <date type="published"><on>2011</on></date>
25
+ <date type="accessed"><on>2012</on></date>
26
+ <date type="created"><from>2010</from><to>2011</to></date>
27
+ <date type="activated"><on>2013</on></date>
28
+ <date type="obsoleted"><on>2014</on></date>
29
+ <date type="circulated"><on>2015</on></date>
30
+ <date type="copied"><on>2016</on></date>
31
+ <date type="confirmed"><on>2017</on></date>
32
+ <date type="updated"><on>2018</on></date>
33
+ <date type="unchanged"><on>2019</on></date>
34
+ <date type="transmitted"><on>2020</on></date>
35
+ <date type="vote-started"><on>2021</on></date>
36
+ <date type="vote-ended"><on>2022</on></date>
37
+ <edition>2</edition>
38
+ <version>
39
+ <revision-date>2016-05-01</revision-date>
40
+ <draft>0.4</draft>
41
+ </version>
42
+ <contributor>
43
+ <role type="author"/>
44
+ <organization>
45
+ <abbreviation>ISO</abbreviation>
46
+ </organization>
47
+ </contributor>
48
+ <contributor>
49
+ <role type="publisher"/>
50
+ <organization>
51
+ <abbreviation>ISO</abbreviation>
52
+ </organization>
53
+ </contributor>
54
+ <contributor>
55
+ <role type="editor"/>
56
+ <person>
57
+ <name>
58
+ <forename>Barney</forename>
59
+ <surname>Rubble</surname>
60
+ </name>
61
+ <affiliation>
62
+ <organization><name>Slate Inc.</name>
63
+ <subdivision>Hermeneutics Unit</subdivision>
64
+ <subdivision>Exegesis Subunit</subdivision>
65
+ <address>
66
+ <formattedAddress>Bedrock</formattedAddress>
67
+ </address>
68
+ </organization>
69
+ </affiliation>
70
+ </person>
71
+ </contributor>
72
+ <contributor>
73
+ <role type="author"/>
74
+ <person>
75
+ <name>
76
+ <completename>Fred Flintstone</completename>
77
+ </name>
78
+ </person>
79
+ </contributor>
80
+ <note type="title-footnote"><p>A footnote</p></note>
81
+ <note type="iso"><p>A note</p></note>
82
+ <note type="title-footnote"><p>Another footnote</p></note>
83
+ <language>en</language>
84
+ <script>Latn</script>
85
+ <status>
86
+ <stage>Committee Draft</stage>
87
+ <substage>Withdrawn</substage>
88
+ <iteration>2</iteration>
89
+ </status>
90
+ <copyright>
91
+ <from>2016</from>
92
+ <owner>
93
+ <organization>
94
+ <abbreviation>ISO</abbreviation>
95
+ </organization>
96
+ </owner>
97
+ </copyright>
98
+ <keyword>KW2</keyword>
99
+ <keyword>KW1</keyword>
100
+ <keyword>KW3</keyword>
101
+ <ext>
102
+ <doctype>international-standard</doctype>
103
+ </ext>
104
+ </bibdata>
105
+ </iso-standard>
106
+ INPUT
107
+ output = <<~OUTPUT
108
+ {:accesseddate=>"2012",
109
+ :activateddate=>"2013",
110
+ :agency=>"ISO",
111
+ :authors=>["Barney Rubble", "Fred Flintstone"],
112
+ :authors_affiliations=>{"Slate Inc., Hermeneutics Unit, Exegesis Subunit, Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]},
113
+ :circulateddate=>"2015",
114
+ :confirmeddate=>"2017",
115
+ :copieddate=>"2016",
116
+ :createddate=>"2010&ndash;2011",
117
+ :doc=>"URL E",
118
+ :docnumber=>"17301-1",
119
+ :docnumeric=>"17301",
120
+ :doctitle=>"Cereals and pulses",
121
+ :doctype=>"International Standard",
122
+ :doctype_display=>"International Standard",
123
+ :docyear=>"2016",
124
+ :draft=>"0.4",
125
+ :draftinfo=>" (draft 0.4, 2016-05-01)",
126
+ :edition=>"2",
127
+ :html=>"URL B",
128
+ :implementeddate=>"XXX",
129
+ :isbn=>"ISBN 13",
130
+ :isbn10=>"ISBN 10",
131
+ :issueddate=>"XXX",
132
+ :iteration=>"2",
133
+ :keywords=>["KW2", "KW1", "KW3"],
134
+ :lang=>"en",
135
+ :obsoleteddate=>"2014",
136
+ :pdf=>"URL D",
137
+ :publisheddate=>"2011",
138
+ :receiveddate=>"XXX",
139
+ :revdate=>"2016-05-01",
140
+ :revdate_monthyear=>"May 2016",
141
+ :script=>"Latn",
142
+ :stage=>"Committee Draft",
143
+ :stage_display=>"Committee Draft",
144
+ :stageabbr=>"CD",
145
+ :substage=>"Withdrawn",
146
+ :substage_display=>"Withdrawn",
147
+ :title_footnote=>["A footnote", "Another footnote"],
148
+ :transmitteddate=>"2020",
149
+ :unchangeddate=>"2019",
150
+ :unpublished=>true,
151
+ :updateddate=>"2018",
152
+ :url=>"URL A",
153
+ :vote_endeddate=>"2022",
154
+ :vote_starteddate=>"2021",
155
+ :xml=>"URL C"}
156
+ OUTPUT
157
+ expect(metadata(c.info(Nokogiri::XML(input), nil)))
158
+ .to be_equivalent_to output
156
159
  end
157
160
 
158
161
  it "processes IsoXML metadata" do
159
- c = IsoDoc::Convert.new({})
160
- arr = c.convert_init(<<~"INPUT", "test", false)
161
- <iso-standard xmlns="http://riboseinc.com/isoxml">
162
+ c = IsoDoc::Convert.new({})
163
+ c.convert_init(<<~"INPUT", "test", false)
164
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
162
165
  INPUT
163
- expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
164
- <iso-standard xmlns="http://riboseinc.com/isoxml">
165
- <bibdata type="standard">
166
- <title language="fr" format="text/plain">Céréales et légumineuses</ti>
167
- <title language="en" format="text/plain">Cereals and pulses</title>
168
- <docidentifier>17301-1-3</docidentifier>
169
- <docnumber>17301</docnumber>
170
- <date type="published"><on>2011-01</on></date>
171
- <version>
172
- <revision-date>2016-05</revision-date>
173
- </version>
174
- <contributor>
175
- <role type="author"/>
176
- <organization>
177
- <name>ISO</name>
178
- </organization>
179
- </contributor>
180
- <contributor>
181
- <role type="publisher"/>
182
- <organization>
183
- <name>International Organization for Standardization</name>
184
- <subdivision>Subdivision</subdivision>
185
- <abbreviation>ISO</abbreviation>
186
- <address>
187
- <formattedAddress>1 Infinity Loop + California</formattedAddress>
188
- </address>
189
- <phone>3333333</phone>
190
- <phone type='fax'>4444444</phone>
191
- <email>x@example.com</email>
192
- <uri>http://www.example.com</uri>
193
- </organization>
194
- </contributor>
195
- <contributor>
196
- <role type="publisher"/>
197
- <organization>
198
- <name>International Electrotechnical Commission</name>
199
- <abbreviation>IEC</abbreviation>
200
- </organization>
201
- </contributor>
202
- <contributor>
203
- <role type="publisher"/>
204
- <organization>
205
- <name>Institute of Electrical and Electronics Engineers</name>
206
- <abbreviation>IEEE</abbreviation>
207
- </organization>
208
- </contributor>
209
- <language>en</language>
210
- <script>Latn</script>
211
- <status><stage>Published</stage></status>
212
- <copyright>
213
- <from>2016</from>
214
- <owner>
215
- <organization>
216
- <name>International Organization for Standardization</name>
217
- </organization>
218
- </owner>
219
- </copyright>
220
- <relation type="obsoletes">
221
- <locality type="clause"><referenceFrom>3.1</referenceFrom></locality>
222
- <docidentifier>IEC 8121</docidentifier>
223
- </relation>
224
- <relation type="partOf">
225
- <docidentifier>IEC 8122</docidentifier>
226
- </relation>
227
- <ext>
228
- <doctype>international-standard</doctype>
229
- </ext>
230
- </bibdata><version>
231
- <revision-date>2016-05-01</revision-date>
232
- <draft>12</draft>
233
- </version>
234
- </iso-standard>
235
- INPUT
236
- {:accesseddate=>"XXX",
237
- :agency=>"ISO/IEC/IEEE",
238
- :circulateddate=>"XXX",
239
- :confirmeddate=>"XXX",
240
- :copieddate=>"XXX",
241
- :createddate=>"XXX",
242
- :docnumber=>"17301-1-3",
243
- :docnumeric=>"17301",
244
- :doctitle=>"Cereals and pulses",
245
- :doctype=>"International Standard",
246
- :doctype_display=>"International Standard",
247
- :docyear=>"2016",
248
- :draft=>"12",
249
- :draftinfo=>" (draft 12, 2016-05)",
250
- :implementeddate=>"XXX",
251
- :issueddate=>"XXX",
252
- :lang=>"en",
253
- :obsoleteddate=>"XXX",
254
- :obsoletes=>"IEC 8121",
255
- :obsoletes_part=>"3.1",
256
- :partof=>"IEC 8122",
257
- :pub_address=>"1 Infinity Loop + California",
258
- :pub_email=>"x@example.com",
259
- :pub_fax=>"4444444",
260
- :pub_phone=>"3333333",
261
- :pub_uri=>"http://www.example.com",
262
- :publisheddate=>"2011-01",
263
- :publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers",
264
- :receiveddate=>"XXX",
265
- :revdate=>"2016-05",
266
- :revdate_monthyear=>"May 2016",
267
- :script=>"Latn",
268
- :stage=>"Published",
269
- :stage_display=>"Published",
270
- :subdivision=>"Subdivision",
271
- :transmitteddate=>"XXX",
272
- :unchangeddate=>"XXX",
273
- :unpublished=>false,
274
- :updateddate=>"XXX",
275
- :vote_endeddate=>"XXX",
276
- :vote_starteddate=>"XXX"}
277
- OUTPUT
166
+ input = <<~INPUT
167
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
168
+ <bibdata type="standard">
169
+ <title language="fr" format="text/plain">Céréales et légumineuses</ti>
170
+ <title language="en" format="text/plain">Cereals and pulses</title>
171
+ <docidentifier>17301-1-3</docidentifier>
172
+ <docnumber>17301</docnumber>
173
+ <date type="published"><on>2011-01</on></date>
174
+ <version>
175
+ <draft>12</draft>
176
+ <revision-date>2016-05</revision-date>
177
+ </version>
178
+ <contributor>
179
+ <role type="author"/>
180
+ <organization>
181
+ <name>ISO</name>
182
+ </organization>
183
+ </contributor>
184
+ <contributor>
185
+ <role type="publisher"/>
186
+ <organization>
187
+ <name>International Organization for Standardization</name>
188
+ <subdivision>Subdivision</subdivision>
189
+ <abbreviation>ISO</abbreviation>
190
+ <address>
191
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
192
+ </address>
193
+ <phone>3333333</phone>
194
+ <phone type='fax'>4444444</phone>
195
+ <email>x@example.com</email>
196
+ <uri>http://www.example.com</uri>
197
+ </organization>
198
+ </contributor>
199
+ <contributor>
200
+ <role type="publisher"/>
201
+ <organization>
202
+ <name>International Electrotechnical Commission</name>
203
+ <abbreviation>IEC</abbreviation>
204
+ </organization>
205
+ </contributor>
206
+ <contributor>
207
+ <role type="publisher"/>
208
+ <organization>
209
+ <name>Institute of Electrical and Electronics Engineers</name>
210
+ <abbreviation>IEEE</abbreviation>
211
+ </organization>
212
+ </contributor>
213
+ <language>en</language>
214
+ <script>Latn</script>
215
+ <status><stage>Published</stage></status>
216
+ <copyright>
217
+ <from>2016</from>
218
+ <owner>
219
+ <organization>
220
+ <name>International Organization for Standardization</name>
221
+ </organization>
222
+ </owner>
223
+ </copyright>
224
+ <relation type="obsoletes">
225
+ <locality type="clause"><referenceFrom>3.1</referenceFrom></locality>
226
+ <docidentifier>IEC 8121</docidentifier>
227
+ </relation>
228
+ <relation type="partOf">
229
+ <docidentifier>IEC 8122</docidentifier>
230
+ </relation>
231
+ <ext>
232
+ <doctype>international-standard</doctype>
233
+ </ext>
234
+ </bibdata>
235
+ </iso-standard>
236
+ INPUT
237
+ output = <<~OUTPUT
238
+ {:accesseddate=>"XXX",
239
+ :agency=>"ISO/IEC/IEEE",
240
+ :circulateddate=>"XXX",
241
+ :confirmeddate=>"XXX",
242
+ :copieddate=>"XXX",
243
+ :createddate=>"XXX",
244
+ :docnumber=>"17301-1-3",
245
+ :docnumeric=>"17301",
246
+ :doctitle=>"Cereals and pulses",
247
+ :doctype=>"International Standard",
248
+ :doctype_display=>"International Standard",
249
+ :docyear=>"2016",
250
+ :draft=>"12",
251
+ :draftinfo=>" (draft 12, 2016-05)",
252
+ :implementeddate=>"XXX",
253
+ :issueddate=>"XXX",
254
+ :lang=>"en",
255
+ :obsoleteddate=>"XXX",
256
+ :obsoletes=>"IEC 8121",
257
+ :obsoletes_part=>"3.1",
258
+ :partof=>"IEC 8122",
259
+ :pub_address=>"1 Infinity Loop + California",
260
+ :pub_email=>"x@example.com",
261
+ :pub_fax=>"4444444",
262
+ :pub_phone=>"3333333",
263
+ :pub_uri=>"http://www.example.com",
264
+ :publisheddate=>"2011-01",
265
+ :publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers",
266
+ :receiveddate=>"XXX",
267
+ :revdate=>"2016-05",
268
+ :revdate_monthyear=>"May 2016",
269
+ :script=>"Latn",
270
+ :stage=>"Published",
271
+ :stage_display=>"Published",
272
+ :subdivision=>"Subdivision",
273
+ :transmitteddate=>"XXX",
274
+ :unchangeddate=>"XXX",
275
+ :unpublished=>false,
276
+ :updateddate=>"XXX",
277
+ :vote_endeddate=>"XXX",
278
+ :vote_starteddate=>"XXX"}
279
+ OUTPUT
280
+ expect(metadata(c.info(Nokogiri::XML(input), nil)))
281
+ .to be_equivalent_to output
278
282
  end
279
283
 
280
- it "processes IsoXML metadata in French" do
281
- c = IsoDoc::Convert.new({})
282
- arr = c.convert_init(<<~"INPUT", "test", false)
283
- <iso-standard xmlns="http://riboseinc.com/isoxml">
284
- <bibdata type="standard">
285
- <language>fr</language>
286
- <script>Latn</script>
287
- <status>
288
- <stage lang="">Committee Draft</stage>
289
- <stage lang=fr">Projet de comité</stage>
290
- <substage lang="">Withdrawn</substage>
291
- <substage lang="fr">Rétiré</substage>
292
- <iteration>2</iteration>
293
- </status>
294
- <ext>
295
- <doctype lang="">international-standard</doctype>
296
- <doctype lang="fr">Standard international</doctype>
297
- </ext>
298
- </bibdata>
299
- </iso-standard>
284
+ it "processes IsoXML metadata in French" do
285
+ c = IsoDoc::Convert.new({})
286
+ c.convert_init(<<~"INPUT", "test", false)
287
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
288
+ <bibdata type="standard">
289
+ <language>fr</language>
290
+ <script>Latn</script>
291
+ <status>
292
+ <stage lang="">Committee Draft</stage>
293
+ <stage lang=fr">Projet de comité</stage>
294
+ <substage lang="">Withdrawn</substage>
295
+ <substage lang="fr">Rétiré</substage>
296
+ <iteration>2</iteration>
297
+ </status>
298
+ <ext>
299
+ <doctype lang="">international-standard</doctype>
300
+ <doctype lang="fr">Standard international</doctype>
301
+ </ext>
302
+ </bibdata>
303
+ </iso-standard>
300
304
  INPUT
301
- expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
302
- <iso-standard xmlns="http://riboseinc.com/isoxml">
303
- <bibdata type="standard">
304
- <title language="fr" format="text/plain">Céréales et légumineuses</ti>
305
- <title language="en" format="text/plain">Cereals and pulses</title>
306
- <docidentifier>17301-1-3</docidentifier>
307
- <docnumber>17301</docnumber>
308
- <date type="published"><on>2011-01</on></date>
309
- <version>
310
- <revision-date>2016-05</revision-date>
311
- </version>
312
- <contributor>
313
- <role type="author"/>
314
- <organization>
315
- <name>ISO</name>
316
- </organization>
317
- </contributor>
318
- <contributor>
319
- <role type="publisher"/>
320
- <organization>
321
- <name>International Organization for Standardization</name>
322
- <abbreviation>ISO</abbreviation>
323
- </organization>
324
- </contributor>
325
- <contributor>
326
- <role type="publisher"/>
327
- <organization>
328
- <name>International Electrotechnical Commission</name>
329
- <abbreviation>IEC</abbreviation>
330
- </organization>
331
- </contributor>
332
- <language>fr</language>
333
- <script>Latn</script>
334
- <status>
335
- <stage language="">Committee Draft</stage>
336
- <stage language="fr">Projet de comité</stage>
337
- <substage language="">Withdrawn</substage>
338
- <substage language="fr">Rétiré</substage>
339
- <iteration>2</iteration>
340
- </status>
341
- <copyright>
342
- <from>2016</from>
343
- <owner>
344
- <organization>
345
- <name>International Organization for Standardization</name>
346
- </organization>
347
- </owner>
348
- </copyright>
349
- <ext>
350
- <doctype language="">international-standard</doctype>
351
- <doctype language="fr">Standard international</doctype>
352
- </ext>
353
- </bibdata>
354
- </iso-standard>
355
- INPUT
356
- {:accesseddate=>"XXX",
357
- :agency=>"ISO/IEC",
358
- :circulateddate=>"XXX",
359
- :confirmeddate=>"XXX",
360
- :copieddate=>"XXX",
361
- :createddate=>"XXX",
362
- :docnumber=>"17301-1-3",
363
- :docnumeric=>"17301",
364
- :doctitle=>"Céréales et légumineuses",
365
- :doctype=>"International Standard",
366
- :doctype_display=>"Standard International",
367
- :docyear=>"2016",
368
- :implementeddate=>"XXX",
369
- :issueddate=>"XXX",
370
- :iteration=>"2",
371
- :lang=>"fr",
372
- :obsoleteddate=>"XXX",
373
- :publisheddate=>"2011-01",
374
- :publisher=>"International Organization for Standardization et International Electrotechnical Commission",
375
- :receiveddate=>"XXX",
376
- :revdate=>"2016-05",
377
- :revdate_monthyear=>"Mai 2016",
378
- :script=>"Latn",
379
- :stage=>"Committee Draft",
380
- :stage_display=>"Projet De Comité",
381
- :stageabbr=>"CD",
382
- :substage=>"Withdrawn",
383
- :substage_display=>"Rétiré",
384
- :transmitteddate=>"XXX",
385
- :unchangeddate=>"XXX",
386
- :unpublished=>true,
387
- :updateddate=>"XXX",
388
- :vote_endeddate=>"XXX",
389
- :vote_starteddate=>"XXX"}
390
- OUTPUT
391
- end
392
-
393
-
305
+ input = <<~INPUT
306
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
307
+ <bibdata type="standard">
308
+ <title language="fr" format="text/plain">Céréales et légumineuses</ti>
309
+ <title language="en" format="text/plain">Cereals and pulses</title>
310
+ <docidentifier>17301-1-3</docidentifier>
311
+ <docnumber>17301</docnumber>
312
+ <date type="published"><on>2011-01</on></date>
313
+ <version>
314
+ <revision-date>2016-05</revision-date>
315
+ </version>
316
+ <contributor>
317
+ <role type="author"/>
318
+ <organization>
319
+ <name>ISO</name>
320
+ </organization>
321
+ </contributor>
322
+ <contributor>
323
+ <role type="publisher"/>
324
+ <organization>
325
+ <name>International Organization for Standardization</name>
326
+ <abbreviation>ISO</abbreviation>
327
+ </organization>
328
+ </contributor>
329
+ <contributor>
330
+ <role type="publisher"/>
331
+ <organization>
332
+ <name>International Electrotechnical Commission</name>
333
+ <abbreviation>IEC</abbreviation>
334
+ </organization>
335
+ </contributor>
336
+ <language>fr</language>
337
+ <script>Latn</script>
338
+ <status>
339
+ <stage language="">Committee Draft</stage>
340
+ <stage language="fr">Projet de comité</stage>
341
+ <substage language="">Withdrawn</substage>
342
+ <substage language="fr">Rétiré</substage>
343
+ <iteration>2</iteration>
344
+ </status>
345
+ <copyright>
346
+ <from>2016</from>
347
+ <owner>
348
+ <organization>
349
+ <name>International Organization for Standardization</name>
350
+ </organization>
351
+ </owner>
352
+ </copyright>
353
+ <ext>
354
+ <doctype language="">international-standard</doctype>
355
+ <doctype language="fr">Standard international</doctype>
356
+ </ext>
357
+ </bibdata>
358
+ </iso-standard>
359
+ INPUT
360
+ output = <<~OUTPUT
361
+ {:accesseddate=>"XXX",
362
+ :agency=>"ISO/IEC",
363
+ :circulateddate=>"XXX",
364
+ :confirmeddate=>"XXX",
365
+ :copieddate=>"XXX",
366
+ :createddate=>"XXX",
367
+ :docnumber=>"17301-1-3",
368
+ :docnumeric=>"17301",
369
+ :doctitle=>"Céréales et légumineuses",
370
+ :doctype=>"International Standard",
371
+ :doctype_display=>"Standard International",
372
+ :docyear=>"2016",
373
+ :implementeddate=>"XXX",
374
+ :issueddate=>"XXX",
375
+ :iteration=>"2",
376
+ :lang=>"fr",
377
+ :obsoleteddate=>"XXX",
378
+ :publisheddate=>"2011-01",
379
+ :publisher=>"International Organization for Standardization et International Electrotechnical Commission",
380
+ :receiveddate=>"XXX",
381
+ :revdate=>"2016-05",
382
+ :revdate_monthyear=>"Mai 2016",
383
+ :script=>"Latn",
384
+ :stage=>"Committee Draft",
385
+ :stage_display=>"Projet De Comité",
386
+ :stageabbr=>"CD",
387
+ :substage=>"Withdrawn",
388
+ :substage_display=>"Rétiré",
389
+ :transmitteddate=>"XXX",
390
+ :unchangeddate=>"XXX",
391
+ :unpublished=>true,
392
+ :updateddate=>"XXX",
393
+ :vote_endeddate=>"XXX",
394
+ :vote_starteddate=>"XXX"}
395
+ OUTPUT
396
+ expect(metadata(c.info(Nokogiri::XML(input), nil)))
397
+ .to be_equivalent_to output
398
+ end
394
399
  end