isodoc 1.6.1 → 1.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -12
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/Rakefile +2 -2
- data/isodoc.gemspec +4 -3
- data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
- data/lib/isodoc-yaml/i18n-de.yaml +149 -0
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +151 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc.rb +0 -2
- data/lib/isodoc/common.rb +2 -0
- data/lib/isodoc/convert.rb +8 -2
- data/lib/isodoc/function/blocks.rb +15 -4
- data/lib/isodoc/function/cleanup.rb +52 -43
- data/lib/isodoc/function/form.rb +51 -0
- data/lib/isodoc/function/inline.rb +8 -7
- data/lib/isodoc/function/references.rb +71 -77
- data/lib/isodoc/function/section.rb +28 -16
- data/lib/isodoc/function/table.rb +22 -22
- data/lib/isodoc/function/terms.rb +6 -7
- data/lib/isodoc/function/to_word_html.rb +19 -25
- data/lib/isodoc/function/utils.rb +181 -163
- data/lib/isodoc/gem_tasks.rb +8 -9
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_convert.rb +6 -0
- data/lib/isodoc/html_function/comments.rb +14 -12
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/form.rb +62 -0
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +191 -182
- data/lib/isodoc/html_function/sectionsplit.rb +230 -0
- data/lib/isodoc/i18n.rb +13 -11
- data/lib/isodoc/metadata.rb +22 -20
- data/lib/isodoc/metadata_contributor.rb +31 -28
- data/lib/isodoc/pdf_convert.rb +11 -13
- data/lib/isodoc/presentation_function/bibdata.rb +54 -30
- data/lib/isodoc/presentation_function/inline.rb +70 -120
- data/lib/isodoc/presentation_function/math.rb +84 -0
- data/lib/isodoc/presentation_function/section.rb +55 -19
- data/lib/isodoc/presentation_xml_convert.rb +3 -0
- data/lib/isodoc/sassc_importer.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +28 -24
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref.rb +2 -0
- data/lib/isodoc/xref/xref_counter.rb +1 -2
- data/lib/isodoc/xref/xref_gen.rb +21 -14
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +15 -15
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +624 -997
- data/spec/isodoc/cleanup_spec.rb +40 -42
- data/spec/isodoc/form_spec.rb +156 -0
- data/spec/isodoc/i18n_spec.rb +694 -821
- data/spec/isodoc/inline_spec.rb +1105 -921
- data/spec/isodoc/metadata_spec.rb +384 -379
- data/spec/isodoc/postproc_spec.rb +461 -333
- data/spec/isodoc/presentation_xml_spec.rb +355 -278
- data/spec/isodoc/ref_spec.rb +5 -5
- data/spec/isodoc/section_spec.rb +216 -199
- data/spec/isodoc/sectionsplit_spec.rb +190 -0
- data/spec/isodoc/table_spec.rb +41 -42
- data/spec/isodoc/terms_spec.rb +84 -84
- data/spec/isodoc/xref_spec.rb +974 -932
- metadata +32 -7
@@ -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
|
-
|
8
|
-
|
7
|
+
c.convert_init(<<~"INPUT", "test", false)
|
8
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
9
9
|
INPUT
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
<version>
|
39
|
-
|
40
|
-
|
41
|
-
</version>
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
</bibdata>
|
105
|
-
</iso-standard>
|
106
|
-
INPUT
|
107
|
-
|
108
|
-
:
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
112
|
-
:
|
113
|
-
:
|
114
|
-
:
|
115
|
-
:
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
125
|
-
:
|
126
|
-
:
|
127
|
-
:
|
128
|
-
:
|
129
|
-
:
|
130
|
-
:
|
131
|
-
:
|
132
|
-
:
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
139
|
-
:
|
140
|
-
:
|
141
|
-
:
|
142
|
-
:
|
143
|
-
:
|
144
|
-
:
|
145
|
-
:
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
|
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–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
|
-
|
160
|
-
|
161
|
-
|
162
|
+
c = IsoDoc::Convert.new({})
|
163
|
+
c.convert_init(<<~"INPUT", "test", false)
|
164
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
162
165
|
INPUT
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
</
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
</
|
189
|
-
|
190
|
-
<phone
|
191
|
-
<
|
192
|
-
<
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
</
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
:
|
238
|
-
:
|
239
|
-
:
|
240
|
-
:
|
241
|
-
:
|
242
|
-
:
|
243
|
-
:
|
244
|
-
:
|
245
|
-
:
|
246
|
-
:
|
247
|
-
:
|
248
|
-
:
|
249
|
-
:
|
250
|
-
:
|
251
|
-
:
|
252
|
-
:
|
253
|
-
:
|
254
|
-
:
|
255
|
-
:
|
256
|
-
:
|
257
|
-
:
|
258
|
-
:
|
259
|
-
:
|
260
|
-
:
|
261
|
-
:
|
262
|
-
:
|
263
|
-
:
|
264
|
-
:
|
265
|
-
:
|
266
|
-
:
|
267
|
-
:
|
268
|
-
:
|
269
|
-
:
|
270
|
-
:
|
271
|
-
:
|
272
|
-
:
|
273
|
-
:
|
274
|
-
:
|
275
|
-
:
|
276
|
-
|
277
|
-
|
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
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
<ext>
|
295
|
-
<doctype lang="">international-standard</doctype>
|
296
|
-
<doctype lang="fr">Standard international</doctype>
|
297
|
-
</ext>
|
298
|
-
|
299
|
-
|
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
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
</version>
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
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
|
-
|
357
|
-
:
|
358
|
-
:
|
359
|
-
:
|
360
|
-
:
|
361
|
-
:
|
362
|
-
:
|
363
|
-
:
|
364
|
-
:
|
365
|
-
:
|
366
|
-
:
|
367
|
-
:
|
368
|
-
:
|
369
|
-
:
|
370
|
-
:
|
371
|
-
:
|
372
|
-
:
|
373
|
-
:
|
374
|
-
:
|
375
|
-
:
|
376
|
-
:
|
377
|
-
:
|
378
|
-
:
|
379
|
-
:
|
380
|
-
:
|
381
|
-
:
|
382
|
-
:
|
383
|
-
:
|
384
|
-
:
|
385
|
-
:
|
386
|
-
:
|
387
|
-
:
|
388
|
-
:
|
389
|
-
:
|
390
|
-
|
391
|
-
|
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
|