relaton-iso-bib 1.2.0 → 1.6.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +2 -0
- data/.github/workflows/ubuntu.yml +1 -0
- data/.rubocop.yml +2 -2
- data/README.adoc +145 -217
- data/grammars/isodoc.rng +136 -21
- data/grammars/isostandard.rng +8 -1
- data/lib/relaton_iso_bib/editorial_group.rb +45 -8
- data/lib/relaton_iso_bib/ics.rb +14 -1
- data/lib/relaton_iso_bib/iso_bibliographic_item.rb +22 -28
- data/lib/relaton_iso_bib/structured_identifier.rb +27 -6
- data/lib/relaton_iso_bib/version.rb +1 -1
- data/lib/relaton_iso_bib/xml_parser.rb +1 -13
- data/relaton_iso_bib.gemspec +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e0bfad8bdc84234cff16d6a77a874203302a6668afcdc5aca48541ad1b8625f
|
4
|
+
data.tar.gz: 16623e8e2db48606226605a433ba61fac4cfeff2619f3e9cd02ff99bc51ac1b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b71a6924d547968b3e8bf1c7327c97697d43a7437ec42285a4544ef9e4f052e9e09d55d8d3792a62d33de1c6ea13d6860be60b538d0e870e9514ea4895352fe
|
7
|
+
data.tar.gz: 7c742400dae5d5652e18852a0db3e966fca80db953ffe7767404325170135b8824a62af9cc2ea6f9d7c78901e0513c067b133d1914c9c88a138e0ec83233fa91
|
data/.github/workflows/macos.yml
CHANGED
@@ -26,6 +26,8 @@ jobs:
|
|
26
26
|
- name: Update gems
|
27
27
|
run: |
|
28
28
|
sudo gem install bundler --force
|
29
|
+
ruby -v | grep 2.5 && bundle config set build.debase --with-cflags="-Wno-error=implicit-function-declaration"
|
30
|
+
ruby -v | grep 2.5 && bundle config set build.ruby-debug-ide --with-cflags="-Wno-error=implicit-function-declaration"
|
29
31
|
bundle install --jobs 4 --retry 3
|
30
32
|
- name: Run specs
|
31
33
|
run: |
|
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -40,11 +40,14 @@ item = RelatonIsoBib::IsoBibliographicItem.new(
|
|
40
40
|
),
|
41
41
|
docnumber: "123456",
|
42
42
|
title: [
|
43
|
-
{
|
44
|
-
|
45
|
-
{
|
46
|
-
|
47
|
-
|
43
|
+
{ type: "title-intro", content: "Metadata", language: "en", script: "Latn" },
|
44
|
+
{ type: "title-main", content: "Geographic information", language: "en", script: "Latn" },
|
45
|
+
{ type: "title-part", content: "Part 1: Fundamentals", language: "en", script: "Latn" },
|
46
|
+
{ type: "main", content: "Metadata - Geographic information - Part 1: Fundamentals", language: "en", script: "Latn" },
|
47
|
+
{ type: "title-intro", content: "Métadonnées", language: "fr", script: "Latn" },
|
48
|
+
{ type: "title-main", content: "Information géographique", language: "fr", script: "Latn" },
|
49
|
+
{ type: "title-part", content: "Partie 1: Principes de base", language: "fr", script: "Latn" },
|
50
|
+
{ type: "main", content: "Information géographique - Métadonnées - Partie 1: Principes de base", language: "fr", script: "Latn" },
|
48
51
|
],
|
49
52
|
edition: "1",
|
50
53
|
version: RelatonBib::BibliographicItem::Version.new("2019-04-01", ["draft"]),
|
@@ -52,7 +55,7 @@ item = RelatonIsoBib::IsoBibliographicItem.new(
|
|
52
55
|
script: ["Latn"],
|
53
56
|
type: "international-standard",
|
54
57
|
docstatus: RelatonBib::DocumentStatus.new(stage: "60", substage: "60"),
|
55
|
-
|
58
|
+
date: [{ type: "published", on: "2014-04" }],
|
56
59
|
abstract: [
|
57
60
|
{ content: "ISO 19115-1:2014 defines the schema required for ...",
|
58
61
|
language: "en", script: "Latn", format: "text/plain" },
|
@@ -62,20 +65,21 @@ item = RelatonIsoBib::IsoBibliographicItem.new(
|
|
62
65
|
contributor: [
|
63
66
|
{ entity: { name: "International Organization for Standardization",
|
64
67
|
url: "www.iso.org", abbreviation: "ISO" },
|
65
|
-
role: ["publisher"] },
|
68
|
+
role: [type: "publisher"] },
|
66
69
|
{
|
67
70
|
entity: RelatonBib::Person.new(
|
68
71
|
name: RelatonBib::FullName.new(
|
69
72
|
completename: RelatonBib::LocalizedString.new("John Smith"),
|
70
73
|
),
|
71
74
|
),
|
72
|
-
role: ["author"],
|
75
|
+
role: [type: "author"],
|
73
76
|
},
|
74
77
|
],
|
75
|
-
copyright: {
|
76
|
-
|
77
|
-
|
78
|
-
|
78
|
+
copyright: [{
|
79
|
+
owner: [{
|
80
|
+
name: "International Organization for Standardization",
|
81
|
+
abbreviation: "ISO", url: "www.iso.org"
|
82
|
+
}], from: "2014" }],
|
79
83
|
link: [
|
80
84
|
{ type: "src", content: "https://www.iso.org/standard/53798.html" },
|
81
85
|
{ type: "obp",
|
@@ -90,7 +94,7 @@ item = RelatonIsoBib::IsoBibliographicItem.new(
|
|
90
94
|
formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003"),
|
91
95
|
docstatus: RelatonBib::DocumentStatus.new(stage: "60", substage: "60"),
|
92
96
|
),
|
93
|
-
|
97
|
+
locality: [
|
94
98
|
RelatonBib::BibItemLocality.new("updates", "Reference form"),
|
95
99
|
],
|
96
100
|
),
|
@@ -105,7 +109,7 @@ item = RelatonIsoBib::IsoBibliographicItem.new(
|
|
105
109
|
series: [
|
106
110
|
RelatonBib::Series.new(
|
107
111
|
type: "main",
|
108
|
-
title:
|
112
|
+
title: RelatonBib::TypedTitleString.new(
|
109
113
|
type: "title-main", content: "ISO/IEC FDIS 10118-3", language: "en", script: "Latn",
|
110
114
|
),
|
111
115
|
place: "Serie's place",
|
@@ -133,7 +137,7 @@ item = RelatonIsoBib::IsoBibliographicItem.new(
|
|
133
137
|
),
|
134
138
|
],
|
135
139
|
accesslocation: ["accesslocation1", "accesslocation2"],
|
136
|
-
classification: RelatonBib::Classification.new(type: "type", value: "value"),
|
140
|
+
classification: [RelatonBib::Classification.new(type: "type", value: "value")],
|
137
141
|
validity: RelatonBib::Validity.new(
|
138
142
|
begins: Time.new(2010, 10, 10, 12, 21),
|
139
143
|
ends: Time.new(2011, 2, 3, 18,30),
|
@@ -156,9 +160,9 @@ item = RelatonIsoBib::IsoBibliographicItem.new(
|
|
156
160
|
ics: [{ field: 35, group: 240, subgroup: 70 }],
|
157
161
|
)
|
158
162
|
|
159
|
-
=> #<RelatonIsoBib::IsoBibliographicItem:
|
163
|
+
=> #<RelatonIsoBib::IsoBibliographicItem:0x007fc0b88c66a0
|
160
164
|
@abstract=
|
161
|
-
[#<RelatonBib::FormattedString:
|
165
|
+
[#<RelatonBib::FormattedString:0x007fc0b88c5ae8 @content="ISO 19115-1:2014 defines the schema required for ...", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
162
166
|
...
|
163
167
|
----
|
164
168
|
|
@@ -167,50 +171,44 @@ item = RelatonIsoBib::IsoBibliographicItem.new(
|
|
167
171
|
[source,ruby]
|
168
172
|
----
|
169
173
|
item.title
|
170
|
-
=> [#<
|
171
|
-
@title=#<RelatonBib::FormattedString:
|
172
|
-
@type="title-main">,
|
173
|
-
#<RelatonIsoBib::TypedTitleString:0x007fe5198ac590
|
174
|
-
@title=#<RelatonBib::FormattedString:0x007fe5198a7ab8 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
174
|
+
=> [#<RelatonBib::TypedTitleString:0x007fc08e95a640
|
175
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e95a500 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
175
176
|
@type="title-intro">,
|
176
|
-
#<
|
177
|
-
@title=#<RelatonBib::FormattedString:
|
177
|
+
#<RelatonBib::TypedTitleString:0x007fc08e95a460
|
178
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e95a320 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
179
|
+
@type="title-main">,
|
180
|
+
#<RelatonBib::TypedTitleString:0x007fc08e95a280
|
181
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e95a140 @content="Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
178
182
|
@type="title-part">,
|
179
|
-
#<
|
180
|
-
@title=
|
181
|
-
#<RelatonBib::FormattedString:0x007fe5198a5268 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
183
|
+
#<RelatonBib::TypedTitleString:0x007fc08e95a0a0
|
184
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e959f60 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
182
185
|
@type="main">,
|
183
|
-
#<
|
184
|
-
@title=#<RelatonBib::FormattedString:
|
185
|
-
@type="title-main">,
|
186
|
-
#<RelatonIsoBib::TypedTitleString:0x007fe51989d1a8
|
187
|
-
@title=#<RelatonBib::FormattedString:0x007fe51989cca8 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
186
|
+
#<RelatonBib::TypedTitleString:0x007fc08e959ec0
|
187
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e959d80 @content="Métadonnées", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
188
188
|
@type="title-intro">,
|
189
|
-
#<
|
190
|
-
@title=#<RelatonBib::FormattedString:
|
189
|
+
#<RelatonBib::TypedTitleString:0x007fc08e959ce0
|
190
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e959ba0 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
191
|
+
@type="title-main">,
|
192
|
+
#<RelatonBib::TypedTitleString:0x007fc08e959b00
|
193
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e9599c0 @content="Partie 1: Principes de base", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
191
194
|
@type="title-part">,
|
192
|
-
#<
|
195
|
+
#<RelatonBib::TypedTitleString:0x007fc08e959920
|
193
196
|
@title=
|
194
|
-
#<RelatonBib::FormattedString:
|
195
|
-
@content="Métadonnées - Information géographique - Information géographique",
|
196
|
-
@format="text/plain",
|
197
|
-
@language=["fr"],
|
198
|
-
@script=["Latn"]>,
|
197
|
+
#<RelatonBib::FormattedString:0x007fc08e9597e0 @content="Information géographique - Métadonnées - Partie 1: Principes de base", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
199
198
|
@type="main">]
|
200
199
|
|
201
200
|
item.title(lang: "en")
|
202
|
-
=> [#<
|
203
|
-
@title=#<RelatonBib::FormattedString:
|
204
|
-
@type="title-main">,
|
205
|
-
#<RelatonIsoBib::TypedTitleString:0x007fe5198ac590
|
206
|
-
@title=#<RelatonBib::FormattedString:0x007fe5198a7ab8 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
201
|
+
=> [#<RelatonBib::TypedTitleString:0x007fc08e95a640
|
202
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e95a500 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
207
203
|
@type="title-intro">,
|
208
|
-
#<
|
209
|
-
@title=#<RelatonBib::FormattedString:
|
204
|
+
#<RelatonBib::TypedTitleString:0x007fc08e95a460
|
205
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e95a320 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
206
|
+
@type="title-main">,
|
207
|
+
#<RelatonBib::TypedTitleString:0x007fc08e95a280
|
208
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e95a140 @content="Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
210
209
|
@type="title-part">,
|
211
|
-
#<
|
212
|
-
@title=
|
213
|
-
#<RelatonBib::FormattedString:0x007fe5198a5268 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
210
|
+
#<RelatonBib::TypedTitleString:0x007fc08e95a0a0
|
211
|
+
@title=#<RelatonBib::FormattedString:0x007fc08e959f60 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
214
212
|
@type="main">]
|
215
213
|
|
216
214
|
item.abstract(lang: "en").to_s
|
@@ -222,7 +220,7 @@ item.abstract(lang: "en").to_s
|
|
222
220
|
[source,ruby]
|
223
221
|
----
|
224
222
|
item.shortref(item.structuredidentifier)
|
225
|
-
=> "ISO1-2-2014
|
223
|
+
=> "ISO1-2-2014"
|
226
224
|
----
|
227
225
|
|
228
226
|
=== IsoBibliographicItem URLs
|
@@ -259,11 +257,11 @@ item.ics
|
|
259
257
|
|
260
258
|
[source,ruby]
|
261
259
|
----
|
262
|
-
item.
|
263
|
-
=> [
|
260
|
+
item.date
|
261
|
+
=> [#<RelatonBib::BibliographicDate:0x007fc0aeb88438 @from=nil, @on=#<Date: 2014-04-01 ((2456749j,0s,0n),+0s,2299161j)>, @to=nil, @type="published">]
|
264
262
|
|
265
|
-
item.
|
266
|
-
=> 2014-01
|
263
|
+
item.date.filter(type: "published").first.on
|
264
|
+
=> #<Date: 2014-04-01 ((2456749j,0s,0n),+0s,2299161j)>
|
267
265
|
----
|
268
266
|
|
269
267
|
=== IsoBibliographicItem DocumentStatus
|
@@ -271,7 +269,10 @@ item.dates.filter(type: "published").first.on
|
|
271
269
|
[source,ruby]
|
272
270
|
----
|
273
271
|
item.status
|
274
|
-
=> #<RelatonBib::DocumentStatus:
|
272
|
+
=> #<RelatonBib::DocumentStatus:0x007fc0aeb927d0
|
273
|
+
@iteration=nil,
|
274
|
+
@stage=#<RelatonBib::DocumentStatus::Stage:0x007fc0aeb92708 @abbreviation=nil, @value="60">,
|
275
|
+
@substage=#<RelatonBib::DocumentStatus::Stage:0x007fc0aeb92690 @abbreviation=nil, @value="60">>
|
275
276
|
----
|
276
277
|
|
277
278
|
[source,ruby]
|
@@ -289,10 +290,11 @@ wg = item.editorialgroup
|
|
289
290
|
[source,ruby]
|
290
291
|
----
|
291
292
|
item.relation
|
292
|
-
=>
|
293
|
-
|
294
|
-
|
295
|
-
|
293
|
+
=> #<RelatonBib::DocRelationCollection:0x007fc0aeb819f8
|
294
|
+
@array=
|
295
|
+
[#<RelatonBib::DocumentRelation:0x007fc0aeb90610
|
296
|
+
@bibitem=
|
297
|
+
#<RelatonIsoBib::IsoBibliographicItem:0x007fc0aeb91330
|
296
298
|
...
|
297
299
|
----
|
298
300
|
|
@@ -305,54 +307,52 @@ which strips the part number and part title of the original, and its abstract. T
|
|
305
307
|
|
306
308
|
[source,ruby]
|
307
309
|
----
|
308
|
-
item.to_all_parts
|
309
|
-
=>
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
310
|
+
all_parts_item = item.to_all_parts
|
311
|
+
=> #<RelatonIsoBib::IsoBibliographicItem:0x007fc0aec00960
|
312
|
+
@abstract=[],
|
313
|
+
@accesslocation=["accesslocation1", "accesslocation2"],
|
314
|
+
@all_parts=true,
|
315
|
+
...
|
316
|
+
|
317
|
+
all_arts_item.title(lang: "en")
|
318
|
+
=> [#<RelatonBib::TypedTitleString:0x007fc08f388dd8
|
319
|
+
@title=#<RelatonBib::FormattedString:0x007fc08f388d10 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
317
320
|
@type="title-intro">,
|
318
|
-
#<
|
319
|
-
@title=
|
320
|
-
|
321
|
+
#<RelatonBib::TypedTitleString:0x007fc08f388b58
|
322
|
+
@title=#<RelatonBib::FormattedString:0x007fc08f388b08 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
323
|
+
@type="title-main">,
|
324
|
+
#<RelatonBib::TypedTitleString:0x007fc08f3888d8
|
325
|
+
@title=#<RelatonBib::FormattedString:0x007fc08f388888 @content="Metadata – Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
321
326
|
@type="main">]
|
322
327
|
|
323
|
-
|
324
|
-
=> "ISO1
|
328
|
+
all_arts_item.shortref(item.structuredidentifier)
|
329
|
+
=> "ISO1(allparts):2014: All Parts"
|
325
330
|
|
326
|
-
|
327
|
-
=> [#<
|
328
|
-
@title=#<RelatonBib::FormattedString:
|
329
|
-
@type="title-main">,
|
330
|
-
#<RelatonIsoBib::TypedTitleString:0x007fe51b293350
|
331
|
-
@title=#<RelatonBib::FormattedString:0x007fe51b293288 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
331
|
+
all_arts_item.relation.last.bibitem.title
|
332
|
+
=> [#<RelatonBib::TypedTitleString:0x007fc0aeb7bd28
|
333
|
+
@title=#<RelatonBib::FormattedString:0x007fc0aeb7bad0 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
332
334
|
@type="title-intro">,
|
333
|
-
#<
|
334
|
-
@title=#<RelatonBib::FormattedString:
|
335
|
+
#<RelatonBib::TypedTitleString:0x007fc0aeb7ba30
|
336
|
+
@title=#<RelatonBib::FormattedString:0x007fc0aeb7b8c8 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
337
|
+
@type="title-main">,
|
338
|
+
#<RelatonBib::TypedTitleString:0x007fc0aeb7b800
|
339
|
+
@title=#<RelatonBib::FormattedString:0x007fc0aeb7b5f8 @content="Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
335
340
|
@type="title-part">,
|
336
|
-
#<
|
337
|
-
@title=
|
338
|
-
#<RelatonBib::FormattedString:0x007fe51b292ea0 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
341
|
+
#<RelatonBib::TypedTitleString:0x007fc0aeb7b558
|
342
|
+
@title=#<RelatonBib::FormattedString:0x007fc0aeb7b288 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
339
343
|
@type="main">,
|
340
|
-
#<
|
341
|
-
@title=#<RelatonBib::FormattedString:
|
342
|
-
@type="title-main">,
|
343
|
-
#<RelatonIsoBib::TypedTitleString:0x007fe51b292b58
|
344
|
-
@title=#<RelatonBib::FormattedString:0x007fe51b292ab8 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
344
|
+
#<RelatonBib::TypedTitleString:0x007fc0aeb7b148
|
345
|
+
@title=#<RelatonBib::FormattedString:0x007fc0aeb7ae00 @content="Métadonnées", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
345
346
|
@type="title-intro">,
|
346
|
-
#<
|
347
|
-
@title=#<RelatonBib::FormattedString:
|
347
|
+
#<RelatonBib::TypedTitleString:0x007fc0aeb7ac48
|
348
|
+
@title=#<RelatonBib::FormattedString:0x007fc0aeb7a888 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
349
|
+
@type="title-main">,
|
350
|
+
#<RelatonBib::TypedTitleString:0x007fc0aeb7a6d0
|
351
|
+
@title=#<RelatonBib::FormattedString:0x007fc0aeb7a400 @content="Partie 1: Principes de base", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
348
352
|
@type="title-part">,
|
349
|
-
#<
|
353
|
+
#<RelatonBib::TypedTitleString:0x007fc0aeb7a2c0
|
350
354
|
@title=
|
351
|
-
#<RelatonBib::FormattedString:
|
352
|
-
@content="Métadonnées - Information géographique - Information géographique",
|
353
|
-
@format="text/plain",
|
354
|
-
@language=["fr"],
|
355
|
-
@script=["Latn"]>,
|
355
|
+
#<RelatonBib::FormattedString:0x007fc0aeb79f28 @content="Information géographique - Métadonnées - Partie 1: Principes de base", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
356
356
|
@type="main">]
|
357
357
|
----
|
358
358
|
|
@@ -367,14 +367,14 @@ which strips the date of publication of the original, and its abstract. The oper
|
|
367
367
|
|
368
368
|
[source,ruby]
|
369
369
|
----
|
370
|
-
|
371
|
-
=> [#<RelatonBib::BibliographicDate:
|
370
|
+
all_parts_item.date
|
371
|
+
=> [#<RelatonBib::BibliographicDate:0x007fc0aeb88438 @from=nil, @on=#<Date: 2014-04-01 ((2456749j,0s,0n),+0s,2299161j)>, @to=nil, @type="published">]
|
372
372
|
|
373
|
-
|
374
|
-
|
373
|
+
most_recent_ref_item = all_parts_item.to_most_recent_reference
|
374
|
+
most_recent_ref_item.date
|
375
375
|
=> []
|
376
376
|
|
377
|
-
|
377
|
+
most_recent_ref_item.shortref(most_recent_ref_item.structuredidentifier)
|
378
378
|
=> "ISO1(allparts): All Parts"
|
379
379
|
----
|
380
380
|
|
@@ -390,120 +390,7 @@ item.to_xml(bibdata: true)
|
|
390
390
|
<title type="title-intro" format="text/plain" language="en" script="Latn">Geographic information</title>
|
391
391
|
<title type="title-part" format="text/plain" language="en" script="Latn">Part 1: Fundamentals</title>
|
392
392
|
<title type="main" format="text/plain" language="en" script="Latn">Metadata - Geographic information - Part 1: Fundamentals</title>
|
393
|
-
|
394
|
-
<title type="title-intro" format="text/plain" language="fr" script="Latn">Information géographique</title>
|
395
|
-
<title type="title-part" format="text/plain" language="fr" script="Latn">Information géographique</title>
|
396
|
-
<title type="main" format="text/plain" language="fr" script="Latn">Métadonnées - Information géographique - Information géographique</title>
|
397
|
-
<uri type="src">https://www.iso.org/standard/53798.html</uri>
|
398
|
-
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:53798:en</uri>
|
399
|
-
<uri type="rss">https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</uri>
|
400
|
-
<docnumber>123456</docnumber>
|
401
|
-
<date type="published">
|
402
|
-
<on>2014</on>
|
403
|
-
</date>
|
404
|
-
<contributor>
|
405
|
-
<role type="publisher"/>
|
406
|
-
<organization>
|
407
|
-
<name>International Organization for Standardization</name>
|
408
|
-
<abbreviation>ISO</abbreviation>
|
409
|
-
<uri>www.iso.org</uri>
|
410
|
-
</organization>
|
411
|
-
</contributor>
|
412
|
-
<contributor>
|
413
|
-
<role type="author"/>
|
414
|
-
<person>
|
415
|
-
<name>
|
416
|
-
<completename>John Smith</completename>
|
417
|
-
</name>
|
418
|
-
</person>
|
419
|
-
</contributor>
|
420
|
-
<edition>1</edition>
|
421
|
-
<version>
|
422
|
-
<revision_date>2019-04-01</revision_date>
|
423
|
-
<draft>draft</draft>
|
424
|
-
</version>
|
425
|
-
<language>en</language>
|
426
|
-
<language>fr</language>
|
427
|
-
<script>Latn</script>
|
428
|
-
<abstract format="text/plain" language="en" script="Latn">ISO 19115-1:2014 defines the schema required for ...</abstract>
|
429
|
-
<abstract format="text/plain" language="fr" script="Latn">L'ISO 19115-1:2014 définit le schéma requis pour ...</abstract>
|
430
|
-
<status>
|
431
|
-
<stage>60</stage>
|
432
|
-
<substage>60</substage>
|
433
|
-
</status>
|
434
|
-
<copyright>
|
435
|
-
<from>2014</from>
|
436
|
-
<owner>
|
437
|
-
<organization>
|
438
|
-
<name>International Organization for Standardization</name>
|
439
|
-
<abbreviation>ISO</abbreviation>
|
440
|
-
<uri>www.iso.org</uri>
|
441
|
-
</organization>
|
442
|
-
</owner>
|
443
|
-
</copyright>
|
444
|
-
<relation type="updates">
|
445
|
-
<bibitem>
|
446
|
-
<formattedref>ISO 19115:2003</formattedref>
|
447
|
-
<status>
|
448
|
-
<stage>60</stage>
|
449
|
-
<substage>60</substage>
|
450
|
-
</status>
|
451
|
-
</bibitem>
|
452
|
-
<locality type="updates">
|
453
|
-
<referenceFrom>Reference form</referenceFrom>
|
454
|
-
</locality>
|
455
|
-
</relation>
|
456
|
-
<relation type="updates">
|
457
|
-
<bibitem>
|
458
|
-
<formattedref>ISO 19115:2003/Cor 1:2006</formattedref>
|
459
|
-
</bibitem>
|
460
|
-
</relation>
|
461
|
-
<series type="main">
|
462
|
-
<title type="title-main" language="en" script="Latn">ISO/IEC FDIS 10118-3</title>
|
463
|
-
<place>Serie's place</place>
|
464
|
-
<organization>Serie's organization</organization>
|
465
|
-
<abbreviation language="en" script="Latn">ABVR</abbreviation>
|
466
|
-
<from>2009-02-01</from>
|
467
|
-
<to>2010-12-20</to>
|
468
|
-
<number>serie1234</number>
|
469
|
-
<partnumber>part5678</partnumber>
|
470
|
-
</series>
|
471
|
-
<series type="alt">
|
472
|
-
<formattedref language="en" script="Latn">serieref</formattedref>
|
473
|
-
</series>
|
474
|
-
<medium>
|
475
|
-
<form>medium form</form>
|
476
|
-
<size>medium size</size>
|
477
|
-
<scale>medium scale</scale>
|
478
|
-
</medium>
|
479
|
-
<place>bib place</place>
|
480
|
-
<locality type="section">
|
481
|
-
<referenceFrom>Reference from</referenceFrom>
|
482
|
-
<referenceTo>Reference to</referenceTo>
|
483
|
-
</locality>
|
484
|
-
<accesslocation>accesslocation1</accesslocation>
|
485
|
-
<accesslocation>accesslocation2</accesslocation>
|
486
|
-
<classification type="type">value</classification>
|
487
|
-
<validity>
|
488
|
-
<validityBegins>2010-10-10 12:21</validityBegins>
|
489
|
-
<validityEnds>2011-02-03 18:30</validityEnds>
|
490
|
-
<validityRevision>2011-03-04 09:00</validityRevision>
|
491
|
-
</validity>
|
492
|
-
<ext>
|
493
|
-
<doctype>international-standard</doctype>
|
494
|
-
<editorialgroup>
|
495
|
-
<technical_committee number="211" type="technicalCommittee"> ISO/TC 211 Geographic information/Geomatics</technical_committee>
|
496
|
-
<subcommittee number="122" type="ISO">International Organization for Standardization</subcommittee>
|
497
|
-
<workgroup number="111" type="WG">Workgroup Organization</workgroup>
|
498
|
-
</editorialgroup>
|
499
|
-
<ics>
|
500
|
-
<code>35.240.70</code>
|
501
|
-
<text>IT applications in science</text>
|
502
|
-
</ics>
|
503
|
-
<structuredidentifier type="sid">
|
504
|
-
<project-number part="2" subpart="2">ISO 1-2:2014</project-number>
|
505
|
-
</structuredidentifier>
|
506
|
-
</ext>
|
393
|
+
...
|
507
394
|
</bibdata>"
|
508
395
|
|
509
396
|
item.to_xml(bibdata: true, note: [{ type: "note type", text: "test note" }])
|
@@ -513,6 +400,47 @@ item.to_xml(bibdata: true, note: [{ type: "note type", text: "test note" }])
|
|
513
400
|
...
|
514
401
|
<note format="text/plain" type="note type">test note</note>
|
515
402
|
...
|
403
|
+
</bibdata>"
|
404
|
+
----
|
405
|
+
=== Export bibliographic item to BibTeX
|
406
|
+
|
407
|
+
[source,ruby]
|
408
|
+
----
|
409
|
+
item.to_bibtex
|
410
|
+
=> "@international-standard{john2014a,
|
411
|
+
tile = {Information géographique - Métadonnées - Partie 1: Principes de base},
|
412
|
+
edition = {1},
|
413
|
+
author = {Smith, John},
|
414
|
+
publisher = {International Organization for Standardization},
|
415
|
+
address = {bib place},
|
416
|
+
year = {2014},
|
417
|
+
month = apr,
|
418
|
+
type = {value},
|
419
|
+
timestamp = {2018-10-21},
|
420
|
+
url = {https://www.iso.org/standard/53798.html},
|
421
|
+
month_numeric = {4}
|
422
|
+
}"
|
423
|
+
----
|
424
|
+
|
425
|
+
=== Exporting bibliographic item to AsciiBib
|
426
|
+
|
427
|
+
[source,ruby]
|
428
|
+
----
|
429
|
+
item.to_asciibib
|
430
|
+
=> "[%bibitem]
|
431
|
+
== {blank}
|
432
|
+
id:: ISOTC211
|
433
|
+
fetched:: 2020-08-19
|
434
|
+
title::
|
435
|
+
title.type:: title-intro
|
436
|
+
title.content:: Metadata
|
437
|
+
title.language:: en
|
438
|
+
title.script:: Latn
|
439
|
+
title.format:: text/plain
|
440
|
+
itle::
|
441
|
+
title.type:: title-main
|
442
|
+
title.conten:: Geographic information
|
443
|
+
..."
|
516
444
|
----
|
517
445
|
|
518
446
|
=== Create bibliographic item form YAML
|
data/grammars/isodoc.rng
CHANGED
@@ -43,7 +43,9 @@
|
|
43
43
|
<define name="xref">
|
44
44
|
<element name="xref">
|
45
45
|
<attribute name="target">
|
46
|
-
<data type="
|
46
|
+
<data type="string">
|
47
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
48
|
+
</data>
|
47
49
|
</attribute>
|
48
50
|
<optional>
|
49
51
|
<attribute name="type">
|
@@ -61,6 +63,11 @@
|
|
61
63
|
</choice>
|
62
64
|
</attribute>
|
63
65
|
</optional>
|
66
|
+
<optional>
|
67
|
+
<attribute name="droploc">
|
68
|
+
<data type="boolean"/>
|
69
|
+
</attribute>
|
70
|
+
</optional>
|
64
71
|
<text/>
|
65
72
|
</element>
|
66
73
|
</define>
|
@@ -578,6 +585,8 @@
|
|
578
585
|
<ref name="ol"/>
|
579
586
|
<ref name="dl"/>
|
580
587
|
<ref name="formula"/>
|
588
|
+
<ref name="quote"/>
|
589
|
+
<ref name="sourcecode"/>
|
581
590
|
</choice>
|
582
591
|
</oneOrMore>
|
583
592
|
</element>
|
@@ -661,6 +670,16 @@
|
|
661
670
|
</choice>
|
662
671
|
</attribute>
|
663
672
|
</optional>
|
673
|
+
<optional>
|
674
|
+
<attribute name="valign">
|
675
|
+
<choice>
|
676
|
+
<value>top</value>
|
677
|
+
<value>middle</value>
|
678
|
+
<value>bottom</value>
|
679
|
+
<value>baseline</value>
|
680
|
+
</choice>
|
681
|
+
</attribute>
|
682
|
+
</optional>
|
664
683
|
<choice>
|
665
684
|
<zeroOrMore>
|
666
685
|
<choice>
|
@@ -697,6 +716,16 @@
|
|
697
716
|
</choice>
|
698
717
|
</attribute>
|
699
718
|
</optional>
|
719
|
+
<optional>
|
720
|
+
<attribute name="valign">
|
721
|
+
<choice>
|
722
|
+
<value>top</value>
|
723
|
+
<value>middle</value>
|
724
|
+
<value>bottom</value>
|
725
|
+
<value>baseline</value>
|
726
|
+
</choice>
|
727
|
+
</attribute>
|
728
|
+
</optional>
|
700
729
|
<choice>
|
701
730
|
<zeroOrMore>
|
702
731
|
<choice>
|
@@ -834,6 +863,13 @@
|
|
834
863
|
</define>
|
835
864
|
<define name="standard-document">
|
836
865
|
<element name="standard-document">
|
866
|
+
<attribute name="version"/>
|
867
|
+
<attribute name="type">
|
868
|
+
<choice>
|
869
|
+
<value>semantic</value>
|
870
|
+
<value>presentation</value>
|
871
|
+
</choice>
|
872
|
+
</attribute>
|
837
873
|
<ref name="bibdata"/>
|
838
874
|
<optional>
|
839
875
|
<ref name="boilerplate"/>
|
@@ -855,7 +891,7 @@
|
|
855
891
|
<oneOrMore>
|
856
892
|
<choice>
|
857
893
|
<ref name="content"/>
|
858
|
-
<ref name="
|
894
|
+
<ref name="abstract"/>
|
859
895
|
<ref name="foreword"/>
|
860
896
|
<ref name="introduction"/>
|
861
897
|
<ref name="acknowledgements"/>
|
@@ -922,6 +958,9 @@
|
|
922
958
|
<optional>
|
923
959
|
<attribute name="script"/>
|
924
960
|
</optional>
|
961
|
+
<optional>
|
962
|
+
<attribute name="type"/>
|
963
|
+
</optional>
|
925
964
|
<optional>
|
926
965
|
<attribute name="obligation">
|
927
966
|
<choice>
|
@@ -961,9 +1000,6 @@
|
|
961
1000
|
</define>
|
962
1001
|
<define name="content-subsection">
|
963
1002
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
1003
|
<ref name="Content-Section"/>
|
968
1004
|
</element>
|
969
1005
|
</define>
|
@@ -992,6 +1028,9 @@
|
|
992
1028
|
</choice>
|
993
1029
|
</attribute>
|
994
1030
|
</optional>
|
1031
|
+
<optional>
|
1032
|
+
<attribute name="type"/>
|
1033
|
+
</optional>
|
995
1034
|
<optional>
|
996
1035
|
<ref name="section-title"/>
|
997
1036
|
</optional>
|
@@ -1011,9 +1050,6 @@
|
|
1011
1050
|
</define>
|
1012
1051
|
<define name="clause">
|
1013
1052
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1053
|
<ref name="Clause-Section"/>
|
1018
1054
|
</element>
|
1019
1055
|
</define>
|
@@ -1042,18 +1078,24 @@
|
|
1042
1078
|
</choice>
|
1043
1079
|
</attribute>
|
1044
1080
|
</optional>
|
1081
|
+
<optional>
|
1082
|
+
<attribute name="type"/>
|
1083
|
+
</optional>
|
1045
1084
|
<optional>
|
1046
1085
|
<ref name="section-title"/>
|
1047
1086
|
</optional>
|
1048
1087
|
<group>
|
1049
|
-
<
|
1050
|
-
<
|
1051
|
-
<
|
1052
|
-
|
1053
|
-
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
1088
|
+
<choice>
|
1089
|
+
<group>
|
1090
|
+
<zeroOrMore>
|
1091
|
+
<ref name="BasicBlock"/>
|
1092
|
+
</zeroOrMore>
|
1093
|
+
<zeroOrMore>
|
1094
|
+
<ref name="note"/>
|
1095
|
+
</zeroOrMore>
|
1096
|
+
</group>
|
1097
|
+
<ref name="amend"/>
|
1098
|
+
</choice>
|
1057
1099
|
<zeroOrMore>
|
1058
1100
|
<choice>
|
1059
1101
|
<ref name="clause-subsection"/>
|
@@ -1180,6 +1222,9 @@
|
|
1180
1222
|
<optional>
|
1181
1223
|
<attribute name="script"/>
|
1182
1224
|
</optional>
|
1225
|
+
<optional>
|
1226
|
+
<attribute name="type"/>
|
1227
|
+
</optional>
|
1183
1228
|
<optional>
|
1184
1229
|
<attribute name="obligation">
|
1185
1230
|
<choice>
|
@@ -1447,11 +1492,6 @@
|
|
1447
1492
|
</optional>
|
1448
1493
|
</element>
|
1449
1494
|
</define>
|
1450
|
-
<define name="preface_abstract">
|
1451
|
-
<element name="abstract">
|
1452
|
-
<ref name="Basic-Section"/>
|
1453
|
-
</element>
|
1454
|
-
</define>
|
1455
1495
|
<define name="term-clause">
|
1456
1496
|
<element name="clause">
|
1457
1497
|
<optional>
|
@@ -1501,4 +1541,79 @@
|
|
1501
1541
|
<ref name="CitationType"/>
|
1502
1542
|
</element>
|
1503
1543
|
</define>
|
1544
|
+
<define name="amend">
|
1545
|
+
<element name="amend">
|
1546
|
+
<optional>
|
1547
|
+
<attribute name="id">
|
1548
|
+
<data type="ID"/>
|
1549
|
+
</attribute>
|
1550
|
+
</optional>
|
1551
|
+
<attribute name="change">
|
1552
|
+
<choice>
|
1553
|
+
<value>add</value>
|
1554
|
+
<value>modify</value>
|
1555
|
+
<value>delete</value>
|
1556
|
+
</choice>
|
1557
|
+
</attribute>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="path"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<attribute name="path_end"/>
|
1563
|
+
</optional>
|
1564
|
+
<optional>
|
1565
|
+
<attribute name="title"/>
|
1566
|
+
</optional>
|
1567
|
+
<optional>
|
1568
|
+
<element name="location">
|
1569
|
+
<zeroOrMore>
|
1570
|
+
<ref name="locality"/>
|
1571
|
+
</zeroOrMore>
|
1572
|
+
</element>
|
1573
|
+
</optional>
|
1574
|
+
<zeroOrMore>
|
1575
|
+
<ref name="autonumber"/>
|
1576
|
+
</zeroOrMore>
|
1577
|
+
<optional>
|
1578
|
+
<element name="description">
|
1579
|
+
<zeroOrMore>
|
1580
|
+
<ref name="BasicBlock"/>
|
1581
|
+
</zeroOrMore>
|
1582
|
+
</element>
|
1583
|
+
</optional>
|
1584
|
+
<optional>
|
1585
|
+
<element name="newcontent">
|
1586
|
+
<zeroOrMore>
|
1587
|
+
<ref name="BasicBlock"/>
|
1588
|
+
</zeroOrMore>
|
1589
|
+
</element>
|
1590
|
+
</optional>
|
1591
|
+
<optional>
|
1592
|
+
<element name="description">
|
1593
|
+
<zeroOrMore>
|
1594
|
+
<ref name="BasicBlock"/>
|
1595
|
+
</zeroOrMore>
|
1596
|
+
</element>
|
1597
|
+
</optional>
|
1598
|
+
</element>
|
1599
|
+
</define>
|
1600
|
+
<define name="autonumber">
|
1601
|
+
<element name="autonumber">
|
1602
|
+
<attribute name="type">
|
1603
|
+
<choice>
|
1604
|
+
<value>requirement</value>
|
1605
|
+
<value>recommendation</value>
|
1606
|
+
<value>permission</value>
|
1607
|
+
<value>table</value>
|
1608
|
+
<value>figure</value>
|
1609
|
+
<value>admonition</value>
|
1610
|
+
<value>formula</value>
|
1611
|
+
<value>sourcecode</value>
|
1612
|
+
<value>example</value>
|
1613
|
+
<value>note</value>
|
1614
|
+
</choice>
|
1615
|
+
</attribute>
|
1616
|
+
<text/>
|
1617
|
+
</element>
|
1618
|
+
</define>
|
1504
1619
|
</grammar>
|
data/grammars/isostandard.rng
CHANGED
@@ -253,7 +253,7 @@
|
|
253
253
|
<define name="preface">
|
254
254
|
<element name="preface">
|
255
255
|
<optional>
|
256
|
-
<ref name="
|
256
|
+
<ref name="abstract"/>
|
257
257
|
</optional>
|
258
258
|
<ref name="foreword"/>
|
259
259
|
<optional>
|
@@ -405,6 +405,13 @@
|
|
405
405
|
-->
|
406
406
|
<define name="iso-standard">
|
407
407
|
<element name="iso-standard">
|
408
|
+
<attribute name="version"/>
|
409
|
+
<attribute name="type">
|
410
|
+
<choice>
|
411
|
+
<value>semantic</value>
|
412
|
+
<value>presentation</value>
|
413
|
+
</choice>
|
414
|
+
</attribute>
|
408
415
|
<ref name="bibdata"/>
|
409
416
|
<zeroOrMore>
|
410
417
|
<ref name="termdocsource"/>
|
@@ -33,7 +33,7 @@ module RelatonIsoBib
|
|
33
33
|
# @option workgroup [Integer] :number
|
34
34
|
#
|
35
35
|
# @param secretariat [String, NilClass]
|
36
|
-
def initialize(technical_committee:, **args)
|
36
|
+
def initialize(technical_committee:, **args) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize
|
37
37
|
@technical_committee = technical_committee.map do |tc|
|
38
38
|
tc.is_a?(Hash) ? IsoSubgroup.new(tc) : tc
|
39
39
|
end
|
@@ -46,11 +46,15 @@ module RelatonIsoBib
|
|
46
46
|
@secretariat = args[:secretariat]
|
47
47
|
end
|
48
48
|
|
49
|
-
#
|
49
|
+
# @return [true]
|
50
|
+
def presence?
|
51
|
+
true
|
52
|
+
end
|
50
53
|
|
51
54
|
# @param builder [Nokogiri::XML::Builder]
|
52
|
-
def to_xml(builder)
|
53
|
-
return unless technical_committee || subcommittee || workgroup ||
|
55
|
+
def to_xml(builder) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize, Metrics/MethodLength
|
56
|
+
return unless technical_committee || subcommittee || workgroup ||
|
57
|
+
secretariat
|
54
58
|
|
55
59
|
builder.editorialgroup do
|
56
60
|
technical_committee.each do |tc|
|
@@ -65,16 +69,39 @@ module RelatonIsoBib
|
|
65
69
|
builder.secretariat secretariat if secretariat
|
66
70
|
end
|
67
71
|
end
|
68
|
-
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
69
72
|
|
70
73
|
# @return [Hash]
|
71
|
-
def to_hash
|
72
|
-
hash = {
|
73
|
-
|
74
|
+
def to_hash # rubocop:disable Metrics/AbcSize
|
75
|
+
hash = {
|
76
|
+
"technical_committee" => single_element_array(technical_committee),
|
77
|
+
}
|
78
|
+
if subcommittee&.any?
|
79
|
+
hash["subcommittee"] = single_element_array(subcommittee)
|
80
|
+
end
|
74
81
|
hash["workgroup"] = single_element_array(workgroup) if workgroup&.any?
|
75
82
|
hash["secretariat"] = secretariat if secretariat
|
76
83
|
hash
|
77
84
|
end
|
85
|
+
|
86
|
+
# @param prefix [String]
|
87
|
+
# @return [String]
|
88
|
+
def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
89
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
90
|
+
pref += "editorialgroup"
|
91
|
+
out = ""
|
92
|
+
technical_committee.each do |tc|
|
93
|
+
out += tc.to_asciibib "#{pref}.technical_committee",
|
94
|
+
technical_committee.size
|
95
|
+
end
|
96
|
+
subcommittee.each do |sc|
|
97
|
+
out += sc.to_asciibib "#{pref}.subcommittee", subcommittee.size
|
98
|
+
end
|
99
|
+
workgroup.each do |wg|
|
100
|
+
out += wg.to_asciibib "#{pref}.workgroup", workgroup.size
|
101
|
+
end
|
102
|
+
out += "#{pref}.secretariat:: #{secretariat}\n" if secretariat
|
103
|
+
out
|
104
|
+
end
|
78
105
|
end
|
79
106
|
|
80
107
|
# ISO subgroup.
|
@@ -111,5 +138,15 @@ module RelatonIsoBib
|
|
111
138
|
hash["number"] = number if number
|
112
139
|
hash
|
113
140
|
end
|
141
|
+
|
142
|
+
# @param prefix [String]
|
143
|
+
# @param count [Integer] number of the elements
|
144
|
+
def to_asciibib(prefix, count = 1)
|
145
|
+
out = count > 1 ? "#{prefix}::\n" : ""
|
146
|
+
out += "#{prefix}.type:: #{type}\n" if type
|
147
|
+
out += "#{prefix}.number:: #{number}\n" if number
|
148
|
+
out += "#{prefix}.name:: #{name}\n"
|
149
|
+
out
|
150
|
+
end
|
114
151
|
end
|
115
152
|
end
|
data/lib/relaton_iso_bib/ics.rb
CHANGED
@@ -7,7 +7,8 @@ module RelatonIsoBib
|
|
7
7
|
# @param subgroup [Integer, NilClass]
|
8
8
|
def initialize(code = nil, field: nil, group: nil, subgroup: nil)
|
9
9
|
unless code || field
|
10
|
-
raise ArgumentError,
|
10
|
+
raise ArgumentError,
|
11
|
+
"wrong arguments (should be string or { fieldcode: [String] }"
|
11
12
|
end
|
12
13
|
|
13
14
|
field, group, subgroup = code.split "." if code
|
@@ -28,5 +29,17 @@ module RelatonIsoBib
|
|
28
29
|
hash["code"] = code if code
|
29
30
|
hash
|
30
31
|
end
|
32
|
+
|
33
|
+
# @param prefix [String]
|
34
|
+
# @param count [Integer] number of ICS
|
35
|
+
# @return [String]
|
36
|
+
def to_asciibib(prefix = "", count = 1)
|
37
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
38
|
+
pref += "ics"
|
39
|
+
out = count > 1 ? "#{pref}::\n" : ""
|
40
|
+
out += "#{pref}.code:: #{code}\n"
|
41
|
+
out += "#{pref}.description:: #{description}\n"
|
42
|
+
out
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
require "nokogiri"
|
4
4
|
require "isoics"
|
5
5
|
require "relaton_bib"
|
6
|
-
# require "relaton_iso_bib/typed_title_string"
|
7
6
|
require "relaton_iso_bib/editorial_group"
|
8
7
|
require "relaton_iso_bib/xml_parser"
|
9
8
|
require "relaton_iso_bib/structured_identifier"
|
@@ -127,24 +126,15 @@ module RelatonIsoBib
|
|
127
126
|
check_doctype args[:doctype]
|
128
127
|
|
129
128
|
super_args = args.select do |k|
|
130
|
-
%i[id docnumber language script docstatus date abstract
|
131
|
-
edition version relation biblionote series medium place
|
132
|
-
link fetched docid formattedref extent accesslocation
|
133
|
-
validity doctype keyword].include? k
|
129
|
+
%i[id title docnumber language script docstatus date abstract
|
130
|
+
contributor edition version relation biblionote series medium place
|
131
|
+
copyright link fetched docid formattedref extent accesslocation
|
132
|
+
classification validity doctype keyword].include? k
|
134
133
|
end
|
135
134
|
super super_args
|
136
135
|
|
137
136
|
@type = args[:type] || "standard"
|
138
137
|
|
139
|
-
@title = args.fetch(:title, []).map do |t|
|
140
|
-
if t.is_a? Hash
|
141
|
-
# a + typed_titles(t)
|
142
|
-
RelatonBib::TypedTitleString.new t
|
143
|
-
else
|
144
|
-
t
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
138
|
if args[:editorialgroup]
|
149
139
|
@editorialgroup = if args[:editorialgroup].is_a?(Hash)
|
150
140
|
EditorialGroup.new(args[:editorialgroup])
|
@@ -159,23 +149,20 @@ module RelatonIsoBib
|
|
159
149
|
@id_attribute = true
|
160
150
|
end
|
161
151
|
|
162
|
-
# @
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
end
|
170
|
-
end
|
171
|
-
super builder, **opts do |b|
|
152
|
+
# @param opts [Hash]
|
153
|
+
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
154
|
+
# @option opts [Boolean] :bibdata
|
155
|
+
# @option opts [String] :lang language
|
156
|
+
# @return [String] XML
|
157
|
+
def to_xml(**opts)
|
158
|
+
super **opts do |b|
|
172
159
|
if opts[:bibdata] && (doctype || respond_to?(:committee) && committee ||
|
173
160
|
editorialgroup || ics.any? || structuredidentifier || stagename ||
|
174
161
|
block_given?)
|
175
162
|
b.ext do
|
176
163
|
b.doctype doctype if doctype
|
177
164
|
b.docsubtype docsubtype if respond_to?(:docsubtype) && docsubtype
|
178
|
-
# GB renders gbcommittee elements istead of an editorialgroup
|
165
|
+
# GB renders gbcommittee elements istead of an editorialgroup
|
179
166
|
if respond_to? :committee
|
180
167
|
committee&.to_xml b
|
181
168
|
else
|
@@ -196,12 +183,19 @@ module RelatonIsoBib
|
|
196
183
|
# @return [Hash]
|
197
184
|
def to_hash
|
198
185
|
hash = super
|
199
|
-
hash["editorialgroup"] = editorialgroup.to_hash if editorialgroup
|
200
|
-
hash["ics"] = single_element_array(ics) if ics&.any?
|
201
186
|
hash["stagename"] = stagename if stagename
|
202
187
|
hash
|
203
188
|
end
|
204
189
|
|
190
|
+
# @param prefix [String]
|
191
|
+
# @return [String]
|
192
|
+
def to_asciibib(prefix = "")
|
193
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
194
|
+
out = super
|
195
|
+
out += "#{pref}stagename:: #{stagename}\n" if stagename
|
196
|
+
out
|
197
|
+
end
|
198
|
+
|
205
199
|
private
|
206
200
|
|
207
201
|
# @param doctype [String]
|
@@ -212,7 +206,7 @@ module RelatonIsoBib
|
|
212
206
|
end
|
213
207
|
end
|
214
208
|
|
215
|
-
def makeid(id, attribute, _delim = "")
|
209
|
+
def makeid(id, attribute, _delim = "") # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize
|
216
210
|
return nil if attribute && !@id_attribute
|
217
211
|
|
218
212
|
id ||= @docidentifier.reject { |i| i&.type == "DOI" }[0]
|
@@ -33,11 +33,12 @@ module RelatonIsoBib
|
|
33
33
|
def remove_part
|
34
34
|
@part_number = nil
|
35
35
|
@subpart_number = nil
|
36
|
-
case @type
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
@project_number = case @type
|
37
|
+
when "Chinese Standard"
|
38
|
+
@project_number.sub(/\.\d+/, "")
|
39
|
+
else
|
40
|
+
@project_number = @project_number.sub(/-\d+/, "")
|
41
|
+
end
|
41
42
|
end
|
42
43
|
|
43
44
|
def remove_date
|
@@ -62,7 +63,9 @@ module RelatonIsoBib
|
|
62
63
|
pn = builder.send "project-number", project_number
|
63
64
|
pn[:part] = part if part
|
64
65
|
pn[:subpart] = subpart if subpart
|
65
|
-
|
66
|
+
if tc_document_number
|
67
|
+
builder.send "tc-document-number", tc_document_number
|
68
|
+
end
|
66
69
|
end
|
67
70
|
xml[:type] = type if type
|
68
71
|
end
|
@@ -78,6 +81,24 @@ module RelatonIsoBib
|
|
78
81
|
hash
|
79
82
|
end
|
80
83
|
|
84
|
+
# @param prefix [String]
|
85
|
+
# @return [String]
|
86
|
+
def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
87
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
88
|
+
pref += "structured_identifier"
|
89
|
+
out = ""
|
90
|
+
if tc_document_number
|
91
|
+
out += "#{pref}.tc_document_number:: #{tc_document_number}\n"
|
92
|
+
end
|
93
|
+
if project_number
|
94
|
+
out += "#{pref}.project_number:: #{project_number}\n"
|
95
|
+
end
|
96
|
+
out += "#{pref}.part:: #{part}\n" if part
|
97
|
+
out += "#{pref}.subpart:: #{subpart}\n" if subpart
|
98
|
+
out += "#{pref}.type:: #{type}\n" if type
|
99
|
+
out
|
100
|
+
end
|
101
|
+
|
81
102
|
def presence?
|
82
103
|
true
|
83
104
|
end
|
@@ -41,22 +41,10 @@ module RelatonIsoBib
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
-
# Override RelatonBib::XMLParser.ttitle method.
|
45
|
-
# @param title [Nokogiri::XML::Element]
|
46
|
-
# @return [RelatonBib::TypedTitleString]
|
47
|
-
def ttitle(title)
|
48
|
-
return unless title
|
49
|
-
|
50
|
-
RelatonBib::TypedTitleString.new(
|
51
|
-
type: title[:type], content: title.text, language: title[:language],
|
52
|
-
script: title[:script], format: title[:format]
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
44
|
# @TODO Organization doesn't recreated
|
57
45
|
# @param ext [Nokogiri::XML::Element]
|
58
46
|
# @return [RelatonIsoBib::EditorialGroup]
|
59
|
-
def fetch_editorialgroup(ext)
|
47
|
+
def fetch_editorialgroup(ext) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/PerceivedComplexity
|
60
48
|
eg = ext&.at("./editorialgroup")
|
61
49
|
return unless eg
|
62
50
|
|
data/relaton_iso_bib.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iso-bib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.6.pre
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.6.pre
|
153
153
|
description: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
|
154
154
|
email:
|
155
155
|
- open.source@ribose.com
|
@@ -188,7 +188,7 @@ homepage: https://github.com/relaton/relaton-iso-bib
|
|
188
188
|
licenses:
|
189
189
|
- BSD-2-Clause
|
190
190
|
metadata: {}
|
191
|
-
post_install_message:
|
191
|
+
post_install_message:
|
192
192
|
rdoc_options: []
|
193
193
|
require_paths:
|
194
194
|
- lib
|
@@ -199,12 +199,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: 2.4.0
|
200
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
201
|
requirements:
|
202
|
-
- - "
|
202
|
+
- - ">"
|
203
203
|
- !ruby/object:Gem::Version
|
204
|
-
version:
|
204
|
+
version: 1.3.1
|
205
205
|
requirements: []
|
206
206
|
rubygems_version: 3.0.6
|
207
|
-
signing_key:
|
207
|
+
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
|
210
210
|
test_files: []
|