isodoc 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/.rubocop.yml +1 -1
- data/isodoc.gemspec +2 -1
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/convert.rb +3 -1
- data/lib/isodoc/function/blocks.rb +5 -4
- data/lib/isodoc/function/references.rb +32 -51
- data/lib/isodoc/function/section.rb +0 -1
- data/lib/isodoc/function/table.rb +21 -22
- data/lib/isodoc/function/terms.rb +6 -7
- data/lib/isodoc/gem_tasks.rb +8 -9
- data/lib/isodoc/html_convert.rb +5 -1
- data/lib/isodoc/html_function/comments.rb +12 -12
- data/lib/isodoc/html_function/html.rb +2 -2
- data/lib/isodoc/html_function/postprocess.rb +191 -185
- data/lib/isodoc/html_function/sectionsplit.rb +230 -0
- data/lib/isodoc/metadata.rb +22 -20
- data/lib/isodoc/metadata_contributor.rb +31 -28
- data/lib/isodoc/presentation_function/section.rb +39 -1
- data/lib/isodoc/presentation_xml_convert.rb +1 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref.rb +2 -0
- data/spec/isodoc/blocks_spec.rb +184 -447
- data/spec/isodoc/cleanup_spec.rb +40 -42
- data/spec/isodoc/i18n_spec.rb +694 -821
- data/spec/isodoc/inline_spec.rb +43 -42
- data/spec/isodoc/metadata_spec.rb +384 -379
- data/spec/isodoc/postproc_spec.rb +53 -6
- data/spec/isodoc/presentation_xml_spec.rb +4 -4
- 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 +1 -1
- data/spec/isodoc/xref_spec.rb +974 -932
- metadata +19 -3
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -19,13 +19,13 @@ RSpec.describe IsoDoc do
|
|
19
19
|
output = <<~OUTPUT
|
20
20
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
21
21
|
<sections>
|
22
|
-
<clause id='A'>
|
22
|
+
<clause id='A' displayorder="1">
|
23
23
|
<title>1.</title>
|
24
24
|
<formula id='B'>
|
25
25
|
<name>1</name>
|
26
26
|
</formula>
|
27
27
|
</clause>
|
28
|
-
<clause id='C'>
|
28
|
+
<clause id='C' displayorder="2">
|
29
29
|
<title>2.</title>
|
30
30
|
<p>
|
31
31
|
This is
|
@@ -122,7 +122,7 @@ RSpec.describe IsoDoc do
|
|
122
122
|
output = <<~OUTPUT
|
123
123
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
124
124
|
<preface>
|
125
|
-
<foreword>
|
125
|
+
<foreword displayorder="1">
|
126
126
|
<p/>
|
127
127
|
</foreword>
|
128
128
|
</preface>
|
@@ -221,7 +221,7 @@ RSpec.describe IsoDoc do
|
|
221
221
|
presxml = <<~OUTPUT
|
222
222
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
223
223
|
<preface>
|
224
|
-
<foreword>
|
224
|
+
<foreword displayorder="1">
|
225
225
|
<p>
|
226
226
|
<ul>
|
227
227
|
<li>
|
@@ -309,7 +309,7 @@ RSpec.describe IsoDoc do
|
|
309
309
|
</foreword>
|
310
310
|
</preface>
|
311
311
|
<sections>
|
312
|
-
<clause id='clause1'>
|
312
|
+
<clause id='clause1' displayorder="3">
|
313
313
|
<title depth='1'>
|
314
314
|
2.
|
315
315
|
<tab/>
|
@@ -318,7 +318,7 @@ RSpec.describe IsoDoc do
|
|
318
318
|
</clause>
|
319
319
|
</sections>
|
320
320
|
<bibliography>
|
321
|
-
<references id='_normative_references' obligation='informative' normative='true'>
|
321
|
+
<references id='_normative_references' obligation='informative' normative='true' displayorder="2">
|
322
322
|
<title depth='1'>
|
323
323
|
1.
|
324
324
|
<tab/>
|
@@ -746,7 +746,7 @@ RSpec.describe IsoDoc do
|
|
746
746
|
INPUT
|
747
747
|
presxml = <<~OUTPUT
|
748
748
|
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
749
|
-
<preface><foreword>
|
749
|
+
<preface><foreword displayorder="1">
|
750
750
|
<p>
|
751
751
|
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
|
752
752
|
<eref type="inline" bibitemid="ISO712">ISO 712</eref>
|
@@ -767,7 +767,8 @@ RSpec.describe IsoDoc do
|
|
767
767
|
<eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, clause 1</eref>
|
768
768
|
</p>
|
769
769
|
</foreword></preface>
|
770
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true"
|
770
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder=
|
771
|
+
"2"><title depth='1'>1.<tab/>Normative References</title>
|
771
772
|
<bibitem id="ISO712" type="standard">
|
772
773
|
<title format="text/plain">Cereals and cereal products</title>
|
773
774
|
<docidentifier>ISO 712</docidentifier>
|
@@ -887,7 +888,7 @@ RSpec.describe IsoDoc do
|
|
887
888
|
presxml = <<~OUTPUT
|
888
889
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
889
890
|
<preface>
|
890
|
-
<foreword>
|
891
|
+
<foreword displayorder="1">
|
891
892
|
<p>
|
892
893
|
<eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
|
893
894
|
<eref type='inline' bibitemid='ISO712'>ISO 712</eref>
|
@@ -922,7 +923,7 @@ RSpec.describe IsoDoc do
|
|
922
923
|
</foreword>
|
923
924
|
</preface>
|
924
925
|
<bibliography>
|
925
|
-
<references id='_normative_references' obligation='informative' normative='true'>
|
926
|
+
<references id='_normative_references' obligation='informative' normative='true' displayorder="2">
|
926
927
|
<title depth='1'>1.<tab/>Normative References</title>
|
927
928
|
<bibitem id='ISO712' type='standard'>
|
928
929
|
<title format='text/plain'>Cereals and cereal products</title>
|
@@ -1103,36 +1104,36 @@ RSpec.describe IsoDoc do
|
|
1103
1104
|
</iso-standard>
|
1104
1105
|
INPUT
|
1105
1106
|
output = <<~OUTPUT
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1107
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1108
|
+
<bibdata>
|
1109
|
+
<language current='true'>en</language>
|
1110
|
+
<script current='true'>Latn</script>
|
1111
|
+
</bibdata>
|
1112
|
+
<preface>
|
1113
|
+
<clause id='A' displayorder='1'>
|
1114
|
+
<title depth='1'>ABC</title>
|
1115
|
+
</clause>
|
1116
|
+
<clause id='A1' displayorder='2'>
|
1117
|
+
<title depth='1'>ABC/DEF</title>
|
1118
|
+
</clause>
|
1119
|
+
<clause id='A2' displayorder='3'>
|
1120
|
+
<title depth='1'>ABC</title>
|
1121
|
+
</clause>
|
1122
|
+
<clause id='B' displayorder='4'>
|
1123
|
+
<title depth='1'>GHI/JKL</title>
|
1124
|
+
</clause>
|
1125
|
+
<clause id='C' displayorder='5'>
|
1126
|
+
<title depth='1'>DEF</title>
|
1127
|
+
</clause>
|
1128
|
+
<clause id='C1' displayorder='6'>
|
1129
|
+
<title depth='1'>ABC/DEF</title>
|
1130
|
+
</clause>
|
1131
|
+
<clause id='C2' displayorder='7'>
|
1132
|
+
<title depth='1'>DEF</title>
|
1133
|
+
</clause>
|
1134
|
+
<p displayorder='8'>A B D E</p>
|
1135
|
+
</preface>
|
1136
|
+
</iso-standard>
|
1136
1137
|
OUTPUT
|
1137
1138
|
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1138
1139
|
.convert("test", input, true)
|
@@ -1163,13 +1164,13 @@ RSpec.describe IsoDoc do
|
|
1163
1164
|
<?xml version='1.0'?>
|
1164
1165
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
1165
1166
|
<sections>
|
1166
|
-
<clause id='A'>
|
1167
|
+
<clause id='A' displayorder="1">
|
1167
1168
|
<title>1.</title>
|
1168
1169
|
<table id='B'>
|
1169
1170
|
<name>Tabelo 1</name>
|
1170
1171
|
</table>
|
1171
1172
|
</clause>
|
1172
|
-
<clause id='C'>
|
1173
|
+
<clause id='C' displayorder="2">
|
1173
1174
|
<title>2.</title>
|
1174
1175
|
<p>
|
1175
1176
|
This is
|
@@ -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
|