relaton-iso-bib 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 633c3f713b3ec06ed5794833790143292337d593
4
- data.tar.gz: 38d83f22e5f9313bc5c03f83214b16b0b191b8ea
2
+ SHA256:
3
+ metadata.gz: cb3d96d937a721f78915905103686c4aeb3e76807a7bdb3f8964cb8ebea38c04
4
+ data.tar.gz: 2b5dd91960bbfa14b4cae54aa8d1b4a178f20a583297ff4aeeaccf59fe03df4a
5
5
  SHA512:
6
- metadata.gz: f3ba3c18a820dab8b5d73d96aabebbe9e6101f92d5a0a1a8edeb65d31328688513b81aa79233d27a0cd3f3207970904ed7d0f451701fbe8f57ccefef21798778
7
- data.tar.gz: 07b27a26ad50576fc4ae3d402b50cfeb62cd6361867736bee0f003e6947b53c0aced2f1c270da4cc96961d12860cd34e20c4db22d51ebcacdae5dc58efc8eeea
6
+ metadata.gz: 6c66c8f2925003a3d4c4ace4d12fd31e33ab9652562cbaa8ed4bcaf34a4054a5cf0ee743faaf80c4dc8043b2be633a8e07dbe544c1cfd05c5b18bdeed5cd9da2
7
+ data.tar.gz: 3bb6b8038df81e8a38a2b9245b230016fe0b03b54174790fb74cb66292e5c5a94986050c0eab9394026966aa6bec21f0844428c0d2c0f6e1efd9c952a8b7c567
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-iso-bib (0.1.0)
4
+ relaton-iso-bib (0.2.0)
5
5
  isoics (~> 0.1.6)
6
6
  nokogiri (~> 1.8.4)
7
- relaton-bib (~> 0.1.5)
7
+ relaton-bib (~> 0.2.0)
8
8
  ruby_deep_clone (~> 0.8.0)
9
9
 
10
10
  GEM
@@ -16,9 +16,9 @@ GEM
16
16
  coderay (1.1.2)
17
17
  debase (0.2.2)
18
18
  debase-ruby_core_source (>= 0.10.2)
19
- debase-ruby_core_source (0.10.4)
19
+ debase-ruby_core_source (0.10.5)
20
20
  diff-lcs (1.3)
21
- docile (1.3.1)
21
+ docile (1.3.2)
22
22
  equivalent-xml (0.6.0)
23
23
  nokogiri (>= 1.4.3)
24
24
  isoics (0.1.7)
@@ -35,23 +35,23 @@ GEM
35
35
  pry (~> 0.10)
36
36
  public_suffix (3.1.0)
37
37
  rake (10.5.0)
38
- relaton-bib (0.1.6)
38
+ relaton-bib (0.2.0)
39
39
  addressable
40
40
  nokogiri (~> 1.8.4)
41
41
  rspec (3.8.0)
42
42
  rspec-core (~> 3.8.0)
43
43
  rspec-expectations (~> 3.8.0)
44
44
  rspec-mocks (~> 3.8.0)
45
- rspec-core (3.8.0)
45
+ rspec-core (3.8.1)
46
46
  rspec-support (~> 3.8.0)
47
- rspec-expectations (3.8.2)
47
+ rspec-expectations (3.8.4)
48
48
  diff-lcs (>= 1.2.0, < 2.0)
49
49
  rspec-support (~> 3.8.0)
50
- rspec-mocks (3.8.0)
50
+ rspec-mocks (3.8.1)
51
51
  diff-lcs (>= 1.2.0, < 2.0)
52
52
  rspec-support (~> 3.8.0)
53
- rspec-support (3.8.0)
54
- ruby-debug-ide (0.6.1)
53
+ rspec-support (3.8.2)
54
+ ruby-debug-ide (0.7.0)
55
55
  rake (>= 0.8.1)
56
56
  ruby_deep_clone (0.8.0)
57
57
  simplecov (0.16.1)
data/README.adoc CHANGED
@@ -1,8 +1,8 @@
1
- = IsoBibItem
1
+ = RelatonIsoBib
2
2
 
3
- image:https://img.shields.io/gem/v/iso-bib-item.svg["Gem Version", link="https://rubygems.org/gems/iso-bib-item"]
4
- image:https://img.shields.io/travis/metanorma/iso-bib-item/master.svg["Build Status", link="https://travis-ci.com/metanorma/iso-bib-item"]
5
- image:https://codeclimate.com/github/metanorma/iso-bib-item/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/iso-bib-item"]
3
+ image:https://img.shields.io/gem/v/relaton-iso-bib.svg["Gem Version", link="https://rubygems.org/gems/relaton-iso-bib"]
4
+ image:https://img.shields.io/travis/metanorma/relaton-iso-bib/master.svg["Build Status", link="https://travis-ci.com/metanorma/relaton-iso-bib"]
5
+ image:https://codeclimate.com/github/metanorma/relaton-iso-bib/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-iso-bib"]
6
6
 
7
7
  IsoBib is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
8
8
 
@@ -12,7 +12,7 @@ Add this line to your application's Gemfile:
12
12
 
13
13
  [source,ruby]
14
14
  ----
15
- gem 'iso-bib-item'
15
+ gem 'relaton-iso-bib'
16
16
  ----
17
17
 
18
18
  And then execute:
@@ -21,7 +21,7 @@ And then execute:
21
21
 
22
22
  Or install it yourself as:
23
23
 
24
- $ gem install iso-bib-item
24
+ $ gem install relaton-iso-bib
25
25
 
26
26
  == Usage
27
27
 
@@ -29,64 +29,133 @@ Or install it yourself as:
29
29
 
30
30
  [source,ruby]
31
31
  ----
32
- item = IsoBibItem::IsoBibliographicItem.new(
33
- docid: { project_number: "19115", part_number: "1" },
34
- edition: "1",
35
- language: ["en", "fr"],
36
- script: ["Latn"],
37
- titles: [
38
- {
39
- title_intro: "Geographic information",
40
- title_main: "Metadata",
41
- title_part: "Part 1: Fundamentals",
42
- language: "en", script: "Latn"
32
+ item = RelatonIsoBib::IsoBibliographicItem.new(
33
+ fetched: "2018-10-21",
34
+ structuredidentifier: RelatonIsoBib::StructuredIdentifier.new(
35
+ type: "sid", project_number: "ISO 1-2:2014", part: 2, subpart: 2,
36
+ ),
37
+ docnumber: "123456",
38
+ titles: [
39
+ { title_intro: "Geographic information", title_main: "Metadata",
40
+ title_part: "Part 1: Fundamentals", language: "en", script: "Latn" },
41
+ { title_intro: "Information géographique", title_main: "Métadonnées",
42
+ title_part: "Information géographique", language: "fr",
43
+ script: "Latn" },
44
+ ],
45
+ edition: "1",
46
+ version: RelatonBib::BibliographicItem::Version.new("2019-04-01", ["draft"]),
47
+ language: %w[en fr],
48
+ script: ["Latn"],
49
+ type: "international-standard",
50
+ docstatus: RelatonBib::DocumentStatus.new(stage: "60", substage: "60"),
51
+ dates: [{ type: "published", on: "2014-04" }],
52
+ abstract: [
53
+ { content: "ISO 19115-1:2014 defines the schema required for ...",
54
+ language: "en", script: "Latn", format: "text/plain" },
55
+ { content: "L'ISO 19115-1:2014 définit le schéma requis pour ...",
56
+ language: "fr", script: "Latn", format: "text/plain" },
57
+ ],
58
+ contributors: [
59
+ { entity: { name: "International Organization for Standardization",
60
+ url: "www.iso.org", abbreviation: "ISO" },
61
+ roles: ["publisher"] },
62
+ {
63
+ entity: RelatonBib::Person.new(
64
+ name: RelatonBib::FullName.new(
65
+ completename: RelatonBib::LocalizedString.new("John Smith"),
66
+ ),
67
+ ),
68
+ roles: ["author"],
69
+ },
70
+ ],
71
+ copyright: { owner: {
72
+ name: "International Organization for Standardization",
73
+ abbreviation: "ISO", url: "www.iso.org"
74
+ }, from: "2014" },
75
+ link: [
76
+ { type: "src", content: "https://www.iso.org/standard/53798.html" },
77
+ { type: "obp",
78
+ content: "https://www.iso.org/obp/ui/#!iso:std:53798:en" },
79
+ { type: "rss", content: "https://www.iso.org/contents/data/standard"\
80
+ "/05/37/53798.detail.rss" },
81
+ ],
82
+ relations: [
83
+ RelatonBib::DocumentRelation.new(
84
+ type: "updates",
85
+ bibitem: RelatonIsoBib::IsoBibliographicItem.new(
86
+ formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003"),
87
+ docstatus: RelatonBib::DocumentStatus.new(stage: "60", substage: "60"),
88
+ ),
89
+ bib_locality: [
90
+ RelatonBib::BibItemLocality.new("updates", "Reference form"),
91
+ ],
92
+ ),
93
+ RelatonBib::DocumentRelation.new(
94
+ type: "updates",
95
+ bibitem: RelatonIsoBib::IsoBibliographicItem.new(
96
+ type: "international-standard",
97
+ formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003/Cor 1:2006"),
98
+ ),
99
+ ),
100
+ ],
101
+ series: [
102
+ RelatonBib::Series.new(
103
+ type: "main",
104
+ title: RelatonIsoBib::TypedTitleString.new(
105
+ type: "title-main", content: "ISO/IEC FDIS 10118-3", language: "en", script: "Latn",
106
+ ),
107
+ place: "Serie's place",
108
+ organization: "Serie's organization",
109
+ abbreviation: RelatonBib::LocalizedString.new("ABVR", "en", "Latn"),
110
+ from: "2009-02-01",
111
+ to: "2010-12-20",
112
+ number: "serie1234",
113
+ partnumber: "part5678",
114
+ ),
115
+ RelatonBib::Series.new(
116
+ type: "alt",
117
+ formattedref: RelatonBib::FormattedRef.new(
118
+ content: "serieref", language: "en", script: "Latn",
119
+ ),
120
+ )
121
+ ],
122
+ medium: RelatonBib::Medium.new(
123
+ form: "medium form", size: "medium size", scale: "medium scale",
124
+ ),
125
+ place: ["bib place"],
126
+ extent: [
127
+ RelatonBib::BibItemLocality.new(
128
+ "section", "Reference from", "Reference to"
129
+ ),
130
+ ],
131
+ accesslocation: ["accesslocation1", "accesslocation2"],
132
+ classification: RelatonBib::Classification.new(type: "type", value: "value"),
133
+ validity: RelatonBib::Validity.new(
134
+ begins: Time.new(2010, 10, 10, 12, 21),
135
+ ends: Time.new(2011, 2, 3, 18,30),
136
+ revision: Time.new(2011, 3, 4, 9, 0),
137
+ ),
138
+ editorialgroup: {
139
+ technical_committee: [{
140
+ name: " ISO/TC 211 Geographic information/Geomatics",
141
+ type: "technicalCommittee", number: 211
142
+ }],
143
+ subcommittee: [{
144
+ name: "International Organization for Standardization",
145
+ type: "ISO", number: 122,
146
+ }],
147
+ workgroup: [RelatonIsoBib::IsoSubgroup.new(
148
+ name: "Workgroup Organization",
149
+ type: "WG", number: 111,
150
+ )],
43
151
  },
44
- {
45
- title_intro: "Information géographique",
46
- title_main: "Métadonnées",
47
- title_part: "Partie 1: Principes de base",
48
- language: "fr", script: "Latn"
49
- }
50
- ],
51
- type: "international-standard",
52
- docstatus: { status: "Published", stage: "60", substage: "60" },
53
- ics: [{ field: "35", group: "240", subgroup: "70" }],
54
- dates: [{ type: "published", on: "2014-04" }],
55
- contributors: [{ entity: {
56
- name: "International Organization for Standardization",
57
- url: "www.iso.org", abbreviation: "ISO"
58
- }, roles: ["publisher"]}],
59
- editorialgroup: {
60
- name: "International Organization for Standardization",
61
- abbreviation: "ISO",
62
- url: "www.iso.org",
63
- technical_committee: {
64
- name: "ISO/TC 211Geographic information/Geomatics",
65
- type: "technicalCommittee", number: 211
66
- }
67
- },
68
- abstract: [
69
- {
70
- content: "ISO 19115-1:2014 defines the schema required for describing geographic information and services by means of metadata. It provides information about the identification, the extent, the quality, the spatial and temporal aspects, the content, the spatial reference, the portrayal, distribution, and other properties of digital geographic data and services.ISO 19115-1:2014 is applicable to:-the cataloguing of all types of resources, clearinghouse activities, and the full description of datasets and services;-geographic services, geographic datasets, dataset series, and individual geographic features and feature properties.ISO 19115-1:2014 defines:-mandatory and conditional metadata sections, metadata entities, and metadata elements;-the minimum set of metadata required to serve most metadata applications (data discovery, determining data fitness for use, data access, data transfer, and use of digital data and services);-optional metadata elements to allow for a more extensive standard description of resources, if required;-a method for extending metadata to fit specialized needs.Though ISO 19115-1:2014 is applicable to digital data and services, its principles can be extended to many other types of resources such as maps, charts, and textual documents as well as non-geographic data. Certain conditional metadata elements might not apply to these other forms of data.",
71
- language: "en", script: "Latn"
72
- },
73
- {
74
- content: "L'ISO 19115-1:2014 définit le schéma requis pour décrire des informations géographiques et des services au moyen de métadonnées. Elle fournit des informations concernant l'identification, l'étendue, la qualité, les aspects spatiaux et temporels, le contenu, la référence spatiale, la représentation des données, la distribution et d'autres propriétés des données géographiques numériques et des services.L'ISO 19115-1:2014 est applicable:-au catalogage de tous les types de ressources, des activités des centres d'informations et à la description complète des jeux de données et des services,-aux services géographiques, jeux de données géographiques, séries de jeux de données, entités géographiques individuelles et propriétés d'entités.L'ISO 19115-1:2014 définit:-des sections relatives aux métadonnées obligatoires et facultatives, aux entités de métadonnées et aux éléments de métadonnées,-le jeu minimal de métadonnées requis pour répondre au besoin de la plupart des applications des métadonnées (la découverte des données, la détermination de l'adéquation des données à une utilisation, l'accès aux données, le transfert des données et l'utilisation des données numériques et des services),-les éléments de métadonnées facultatifs pour permettre une description standard plus poussée des ressources, si cela est nécessaire,-un procédé d'extension des métadonnées pour s'adapter aux besoins spéciaux.L'ISO 19115-1:2014 est applicable aux données numériques et services, ses principes peuvent être étendus à bien d'autres types de ressources telles que les cartes, les graphes et les documents textes, de même qu'à des données non géographiques. Certains éléments de métadonnées conditionnels peuvent ne pas s'appliquer à ces autres formes de données.",
75
- language: "fr", script: "Latn"
76
- }
77
- ],
78
- copyright: { owner: { name: "ISO" }, from: "2014" },
79
- link: [
80
- { type: "src", content: "https://www.iso.org/standard/53798.html" },
81
- { type: "obp", content: "https://www.iso.org/obp/ui/#!iso:std:53798:en" },
82
- { type: "rss", content: "https://www.iso.org/contents/data/standard/05/37/53798.detail.rss" }
83
- ],
84
- relations: [
85
- { type: "obsoletes", identifier: "ISO 19115:2003", url: "/standard/26020.html" },
86
- { type: "obsoletes", identifier: "ISO 19115:2003/Cor 1:2006", url: "/standard/44361.html" },
87
- { type: "updates", identifier: "ISO 19115-1:2014/Amd 1:2018", url: "/standard/73118.html" }
88
- ]
89
- )
152
+ ics: [{ field: 35, group: 240, subgroup: 70 }],
153
+ )
154
+
155
+ => #<RelatonIsoBib::IsoBibliographicItem:0x007fe5198c4370
156
+ @abstract=
157
+ [#<RelatonBib::FormattedString:0x007fe5198bcaa8 @content="ISO 19115-1:2014 defines the schema required for ...", @format="text/plain", @language=["en"], @script=["Latn"]>,
158
+ ...
90
159
  ----
91
160
 
92
161
  === IsoBibliographicItem Localized Strings
@@ -94,42 +163,62 @@ item = IsoBibItem::IsoBibliographicItem.new(
94
163
  [source,ruby]
95
164
  ----
96
165
  item.title
97
- [<IsoBibItem::IsoLocalizedTitle:0x007fd1d92e2b30
98
- @language="en",
99
- @script="Latn",
100
- @title_intro="Geographic information",
101
- @title_main="Metadata",
102
- @title_part="Part 1: Fundamentals">,
103
- <IsoBibItem::IsoLocalizedTitle:0x007fd1d92e2ae0
104
- @language="fr",
105
- @script="Latn",
106
- @title_intro="Information géographique",
107
- @title_main="Métadonnées",
108
- @title_part="Partie 1: Principes de base">]
166
+ => [#<RelatonIsoBib::TypedTitleString:0x007fe5198ad4e0
167
+ @title=#<RelatonBib::FormattedString:0x007fe5198acd10 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
168
+ @type="title-main">,
169
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198ac590
170
+ @title=#<RelatonBib::FormattedString:0x007fe5198a7ab8 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
171
+ @type="title-intro">,
172
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198a6f00
173
+ @title=#<RelatonBib::FormattedString:0x007fe5198a6578 @content="Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
174
+ @type="title-part">,
175
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198a5d08
176
+ @title=
177
+ #<RelatonBib::FormattedString:0x007fe5198a5268 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
178
+ @type="main">,
179
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198a4980
180
+ @title=#<RelatonBib::FormattedString:0x007fe51989edf0 @content="Métadonnées", @format="text/plain", @language=["fr"], @script=["Latn"]>,
181
+ @type="title-main">,
182
+ #<RelatonIsoBib::TypedTitleString:0x007fe51989d1a8
183
+ @title=#<RelatonBib::FormattedString:0x007fe51989cca8 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
184
+ @type="title-intro">,
185
+ #<RelatonIsoBib::TypedTitleString:0x007fe51989c960
186
+ @title=#<RelatonBib::FormattedString:0x007fe519897d20 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
187
+ @type="title-part">,
188
+ #<RelatonIsoBib::TypedTitleString:0x007fe519896088
189
+ @title=
190
+ #<RelatonBib::FormattedString:0x007fe519895b88
191
+ @content="Métadonnées - Information géographique - Information géographique",
192
+ @format="text/plain",
193
+ @language=["fr"],
194
+ @script=["Latn"]>,
195
+ @type="main">]
109
196
 
110
197
  item.title(lang: "en")
111
- => <IsoBibItem::IsoLocalizedTitle:0x007fd1d92e2b30
112
- @language="en",
113
- @script="Latn",
114
- @title_intro="Geographic information",
115
- @title_main="Metadata",
116
- @title_part="Part 1: Fundamentals">
117
-
118
- item.title(lang: "en").to_s
119
- => "Geographic information -- Metadata -- Part 1: Fundamentals"
198
+ => [#<RelatonIsoBib::TypedTitleString:0x007fe5198ad4e0
199
+ @title=#<RelatonBib::FormattedString:0x007fe5198acd10 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
200
+ @type="title-main">,
201
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198ac590
202
+ @title=#<RelatonBib::FormattedString:0x007fe5198a7ab8 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
203
+ @type="title-intro">,
204
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198a6f00
205
+ @title=#<RelatonBib::FormattedString:0x007fe5198a6578 @content="Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
206
+ @type="title-part">,
207
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198a5d08
208
+ @title=
209
+ #<RelatonBib::FormattedString:0x007fe5198a5268 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
210
+ @type="main">]
120
211
 
121
212
  item.abstract(lang: "en").to_s
122
- => "ISO 19115-1:2014 defines the schema required for describing geographic information and services by means of metadata. It provides information about the identification, the extent, the quality, the spatial and temporal aspects, the content, the spatial reference, the portrayal, distribution, and other properties of digital geographic data and services.
123
- ...
124
- "
213
+ => "ISO 19115-1:2014 defines the schema required for ..."
125
214
  ----
126
215
 
127
216
  === IsoBibliographicItem references
128
217
 
129
218
  [source,ruby]
130
219
  ----
131
- item.shortref
132
- => "ISO 19115-1:2014"
220
+ item.shortref(item.structuredidentifier)
221
+ => "ISO1-2-2014:2014"
133
222
  ----
134
223
 
135
224
  === IsoBibliographicItem URLs
@@ -152,7 +241,7 @@ item.url(:rss)
152
241
  [source,ruby]
153
242
  ----
154
243
  item.ics
155
- [<IsoBibItem::Ics:0x007fd1d92334f0
244
+ [<RelatonIsoBib::Ics:0x007fd1d92334f0
156
245
  @code="35.240.70",
157
246
  @description="IT applications in science",
158
247
  @description_full="Information technology. Applications of information technology. IT applications in science.",
@@ -167,7 +256,7 @@ item.ics
167
256
  [source,ruby]
168
257
  ----
169
258
  item.dates
170
- => [<IsoBibItem::BibliographicDate:0x007fd1d92e33c8 @on=2014-01-04 00:00:00 +0100, @type="published">]
259
+ => [<RelatonIsoBib::BibliographicDate:0x007fd1d92e33c8 @on=2014-01-04 00:00:00 +0100, @type="published">]
171
260
 
172
261
  item.dates.filter(type: "published").first.on
173
262
  => 2014-01-04 00:00:00 +0100
@@ -178,25 +267,17 @@ item.dates.filter(type: "published").first.on
178
267
  [source,ruby]
179
268
  ----
180
269
  item.status
181
- => <IsoBibItem::IsoDocumentStatus:0x007f983c3c2658
182
- @stage="60",
183
- @status=#<IsoBibItem::LocalizedString:0x007f983c3c2608 @content="Published", @language=[], @script=[]>,
184
- @substage="60">
270
+ => #<RelatonBib::DocumentStatus:0x007fe5198d7808 @iteration=nil, @stage="60", @substage="60">
185
271
  ----
186
272
 
187
273
  [source,ruby]
188
274
  ----
189
275
  wg = item.editorialgroup
190
- => <IsoBibItem::EditorialGroup:0x007f983e0d91b0
191
- @abbreviation=#<IsoBibItem::LocalizedString:0x007f983e0d8558 @content="ISO", @language=[], @script=[]>,
192
- @contacts=[],
193
- @identifiers=[],
194
- @name=#<IsoBibItem::LocalizedString:0x007f983e0d8828 @content="International Organization for Standardization", @language=[], @script=[]>,
195
- @technical_committe=#<IsoBibItem::IsoSubgroup:0x007f983e0d8148 @name="ISO/TC 211Geographic information/Geomatics", @number=211, @type="technicalCommittee">,
196
- @uri=#<URI::Generic www.iso.org>>
197
-
198
- wg.uri
199
- => <URI::Generic www.iso.org>
276
+ => #<RelatonIsoBib::EditorialGroup:0x007fe519895200
277
+ @secretariat=nil,
278
+ @subcommittee=[#<RelatonIsoBib::IsoSubgroup:0x007fe519894a58 @name="International Organization for Standardization", @number=122, @type="ISO">],
279
+ @technical_committee=[#<RelatonIsoBib::IsoSubgroup:0x007fe519894d78 @name=" ISO/TC 211 Geographic information/Geomatics", @number=211, @type="technicalCommittee">],
280
+ @workgroup=[#<RelatonIsoBib::IsoSubgroup:0x007fe5198c4668 @name="Workgroup Organization", @number=111, @type="WG">]>
200
281
  ----
201
282
 
202
283
  === Document relations of a standard
@@ -204,9 +285,11 @@ wg.uri
204
285
  [source,ruby]
205
286
  ----
206
287
  item.relations
207
- => [<IsoBibItem::DocumentRelation:0x007f983c3c2a18 @bib_locality=[], @identifier="ISO 19115:2003", @type="obsoletes", @url="/standard/26020.html">,
208
- <IsoBibItem::DocumentRelation:0x007f983c3c2950 @bib_locality=[], @identifier="ISO 19115:2003/Cor 1:2006", @type="obsoletes", @url="/standard/44361.html">,
209
- <IsoBibItem::DocumentRelation:0x007f983c3c28d8 @bib_locality=[], @identifier="ISO 19115-1:2014/Amd 1:2018", @type="updates", @url="/standard/73118.html">]
288
+ => [#<RelatonBib::DocumentRelation:0x007fe5198cec80
289
+ @bib_locality=[#<RelatonBib::BibItemLocality:0x007fe5198cef78 @reference_from="Reference form", @reference_to=nil, @type="updates">],
290
+ @bibitem=
291
+ #<RelatonIsoBib::IsoBibliographicItem:0x007fe5198d4ae0
292
+ ...
210
293
  ----
211
294
 
212
295
  === Reference modification: convert to all parts reference
@@ -219,26 +302,54 @@ which strips the part number and part title of the original, and its abstract. T
219
302
  [source,ruby]
220
303
  ----
221
304
  item.to_all_parts
305
+ => true
306
+
222
307
  item.title(lang: "en")
223
- => <IsoBibItem::IsoLocalizedTitle:0x007fd1d92e2b30
224
- @language="en",
225
- @script="Latn",
226
- @title_intro="Geographic information",
227
- @title_main="Metadata",
228
- @title_part=nil>
229
- item.shortref
230
- => "ISO 19115:2014"
231
- item.relations.last
232
- => <IsoBibItem::DocumentRelation:0x00007f94009a2158 @type="partOf", @identifier=nil, @url=nil, @bib_locality=[],
233
- @bibitem=#<IsoBibItem::IsoBibliographicItem:0x00007f94009f37d8
234
- @id=nil,
235
- @title=[#<IsoBibItem::IsoLocalizedTitle:0x00007f94009f3530
236
- @title_intro="Geographic information",
237
- @title_main="Metadata",
238
- @title_part="Part 1: Fundamentals",
239
- @language="en",
240
- @script="Latn">
241
- ....
308
+ => [#<RelatonIsoBib::TypedTitleString:0x007fe5198ad4e0
309
+ @title=#<RelatonBib::FormattedString:0x007fe5198acd10 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
310
+ @type="title-main">,
311
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198ac590
312
+ @title=#<RelatonBib::FormattedString:0x007fe5198a7ab8 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
313
+ @type="title-intro">,
314
+ #<RelatonIsoBib::TypedTitleString:0x007fe5198a5d08
315
+ @title=
316
+ #<RelatonBib::FormattedString:0x007fe5198a5268 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
317
+ @type="main">]
318
+
319
+ item.shortref(item.structuredidentifier)
320
+ => "ISO1-2014(allparts):2014: All Parts"
321
+
322
+ item.relations.last.bibitem.title
323
+ => [#<RelatonIsoBib::TypedTitleString:0x007fe51b293620
324
+ @title=#<RelatonBib::FormattedString:0x007fe51b293530 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
325
+ @type="title-main">,
326
+ #<RelatonIsoBib::TypedTitleString:0x007fe51b293350
327
+ @title=#<RelatonBib::FormattedString:0x007fe51b293288 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
328
+ @type="title-intro">,
329
+ #<RelatonIsoBib::TypedTitleString:0x007fe51b293120
330
+ @title=#<RelatonBib::FormattedString:0x007fe51b293080 @content="Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
331
+ @type="title-part">,
332
+ #<RelatonIsoBib::TypedTitleString:0x007fe51b292f68
333
+ @title=
334
+ #<RelatonBib::FormattedString:0x007fe51b292ea0 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
335
+ @type="main">,
336
+ #<RelatonIsoBib::TypedTitleString:0x007fe51b292d60
337
+ @title=#<RelatonBib::FormattedString:0x007fe51b292cc0 @content="Métadonnées", @format="text/plain", @language=["fr"], @script=["Latn"]>,
338
+ @type="title-main">,
339
+ #<RelatonIsoBib::TypedTitleString:0x007fe51b292b58
340
+ @title=#<RelatonBib::FormattedString:0x007fe51b292ab8 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
341
+ @type="title-intro">,
342
+ #<RelatonIsoBib::TypedTitleString:0x007fe51b2929a0
343
+ @title=#<RelatonBib::FormattedString:0x007fe51b292900 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
344
+ @type="title-part">,
345
+ #<RelatonIsoBib::TypedTitleString:0x007fe51b2927c0
346
+ @title=
347
+ #<RelatonBib::FormattedString:0x007fe51b292720
348
+ @content="Métadonnées - Information géographique - Information géographique",
349
+ @format="text/plain",
350
+ @language=["fr"],
351
+ @script=["Latn"]>,
352
+ @type="main">]
242
353
  ----
243
354
 
244
355
  === Reference modification: convert to most recent reference
@@ -253,20 +364,14 @@ which strips the date of publication of the original, and its abstract. The oper
253
364
  [source,ruby]
254
365
  ----
255
366
  item.dates
256
- => [#<IsoBibItem::BibliographicDate:0x00007f9994977680 @type="published", @on=2014-01-04 00:00:00 +1100>]
367
+ => [#<RelatonBib::BibliographicDate:0x007fe5198beba0 @from=nil, @on=2014-04-01 00:00:00 +0200, @to=nil, @type="published">]
368
+
257
369
  item.to_most_recent_reference
258
370
  item.dates
259
- []
260
- item.shortref
261
- => "ISO 19115-1"
262
- item.relations.last
263
- => <IsoBibItem::DocumentRelation:0x00007f9a33976a60 @type="instance", @identifier=nil, @url=nil, @bib_locality=[],
264
- @bibitem=#<IsoBibItem::IsoBibliographicItem:0x00007f9a3399ea60
265
- @id=nil,
266
- @title=[#<IsoBibItem::IsoLocalizedTitle:0x00007f9a3399e650 @title_intro="Geographic information", @title_main="Metadata", @title_part="Part 1: Fundamentals", @language="en", @script="Latn">, #<IsoBibItem::IsoLocalizedTitle:0x00007f9a3399e2e0 @title_intro="Information géographique", @title_main="Métadonnées", @title_part="Partie 1: Principes de base", @language="fr", @script="Latn">],
267
- @docidentifier=#<IsoBibItem::IsoDocumentId:0x00007f9a3399e010 @project_number="19115", @part_number="1">,
268
- @dates=[#<IsoBibItem::BibliographicDate:0x00007f9a3399dd90 @type="published", @on=2014-01-04 00:00:00 +1100>],
269
- ....
371
+ => []
372
+
373
+ item.shortref(item.structuredidentifier)
374
+ => "ISO1(allparts): All Parts"
270
375
  ----
271
376
 
272
377
 
@@ -274,106 +379,136 @@ item.relations.last
274
379
 
275
380
  [source,ruby]
276
381
  ----
277
- item.to_xml
278
- =>"<bibitem type='international-standard' id='ISO19115-1'>
279
- <title format='text/plain' language='en' script='Latn'>Geographic information -- Metadata -- Part 1: Fundamentals</title>
280
- <title format='text/plain' language='fr' script='Latn'>Information géographique -- Métadonnées -- Partie 1: Principes de base</title>
281
- <link type='src'>https://www.iso.org/standard/53798.html</link>
282
- <link type='obp'>https://www.iso.org/obp/ui/#!iso:std:53798:en</link>
283
- <link type='rss'>https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</link>
284
- <docidentifier>ISO 19115-1</docidentifier>
285
- <date type='published'>
382
+ item.to_xml(bibdata: true)
383
+ => "<bibdata>
384
+ <fetched>2018-10-21</fetched>
385
+ <title type="title-main" format="text/plain" language="en" script="Latn">Metadata</title>
386
+ <title type="title-intro" format="text/plain" language="en" script="Latn">Geographic information</title>
387
+ <title type="title-part" format="text/plain" language="en" script="Latn">Part 1: Fundamentals</title>
388
+ <title type="main" format="text/plain" language="en" script="Latn">Metadata - Geographic information - Part 1: Fundamentals</title>
389
+ <title type="title-main" format="text/plain" language="fr" script="Latn">Métadonnées</title>
390
+ <title type="title-intro" format="text/plain" language="fr" script="Latn">Information géographique</title>
391
+ <title type="title-part" format="text/plain" language="fr" script="Latn">Information géographique</title>
392
+ <title type="main" format="text/plain" language="fr" script="Latn">Métadonnées - Information géographique - Information géographique</title>
393
+ <uri type="src">https://www.iso.org/standard/53798.html</uri>
394
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:53798:en</uri>
395
+ <uri type="rss">https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</uri>
396
+ <docnumber>123456</docnumber>
397
+ <date type="published">
286
398
  <on>2014</on>
287
399
  </date>
288
400
  <contributor>
289
- <role type='publisher'/>
401
+ <role type="publisher"/>
290
402
  <organization>
291
403
  <name>International Organization for Standardization</name>
292
404
  <abbreviation>ISO</abbreviation>
293
405
  <uri>www.iso.org</uri>
294
406
  </organization>
295
407
  </contributor>
408
+ <contributor>
409
+ <role type="author"/>
410
+ <person>
411
+ <name>
412
+ <completename>John Smith</completename>
413
+ </name>
414
+ </person>
415
+ </contributor>
296
416
  <edition>1</edition>
417
+ <version>
418
+ <revision_date>2019-04-01</revision_date>
419
+ <draft>draft</draft>
420
+ </version>
297
421
  <language>en</language>
298
422
  <language>fr</language>
299
423
  <script>Latn</script>
300
- <abstract format='plain' language='en' script='Latn'>
301
- ISO 19115-1:2014 defines the schema required for describing geographic
302
- information and services by means of metadata. It provides information about
303
- the identification, the extent, the quality, the spatial and temporal
304
- aspects, the content, the spatial reference, the portrayal, distribution,
305
- and other properties of digital geographic data and services.ISO
306
- 19115-1:2014 is applicable to:-the cataloguing of all types of resources,
307
- clearinghouse activities, and the full description of datasets and
308
- services;-geographic services, geographic datasets, dataset series, and
309
- individual geographic features and feature properties.ISO 19115-1:2014
310
- defines:-mandatory and conditional metadata sections, metadata entities, and
311
- metadata elements;-the minimum set of metadata required to serve most
312
- metadata applications (data discovery, determining data fitness for use,
313
- data access, data transfer, and use of digital data and services);-optional
314
- metadata elements to allow for a more extensive standard description of
315
- resources, if required;-a method for extending metadata to fit specialized
316
- needs.Though ISO 19115-1:2014 is applicable to digital data and services,
317
- its principles can be extended to many other types of resources such as
318
- maps, charts, and textual documents as well as non-geographic data. Certain
319
- conditional metadata elements might not apply to these other forms of data.
320
- </abstract>
321
- <abstract format='plain' language='fr' script='Latn'>
322
- L'ISO 19115-1:2014 définit le schéma requis pour décrire des informations
323
- géographiques et des services au moyen de métadonnées. Elle fournit des
324
- informations concernant l'identification, l'étendue, la qualité, les aspects
325
- spatiaux et temporels, le contenu, la référence spatiale, la représentation
326
- des données, la distribution et d'autres propriétés des données
327
- géographiques numériques et des services.L'ISO 19115-1:2014 est
328
- applicable:-au catalogage de tous les types de ressources, des activités des
329
- centres d'informations et à la description complète des jeux de données et
330
- des services,-aux services géographiques, jeux de données géographiques,
331
- séries de jeux de données, entités géographiques individuelles et propriétés
332
- d'entités.L'ISO 19115-1:2014 définit:-des sections relatives aux métadonnées
333
- obligatoires et facultatives, aux entités de métadonnées et aux éléments de
334
- métadonnées,-le jeu minimal de métadonnées requis pour répondre au besoin de
335
- la plupart des applications des métadonnées (la découverte des données, la
336
- détermination de l'adéquation des données à une utilisation, l'accès aux
337
- données, le transfert des données et l'utilisation des données numériques et
338
- des services),-les éléments de métadonnées facultatifs pour permettre une
339
- description standard plus poussée des ressources, si cela est nécessaire,-un
340
- procédé d'extension des métadonnées pour s'adapter aux besoins
341
- spéciaux.L'ISO 19115-1:2014 est applicable aux données numériques et
342
- services, ses principes peuvent être étendus à bien d'autres types de
343
- ressources telles que les cartes, les graphes et les documents textes, de
344
- même qu'à des données non géographiques. Certains éléments de métadonnées
345
- conditionnels peuvent ne pas s'appliquer à ces autres formes de données.
346
- </abstract>
347
- <status>Published</status>
424
+ <abstract format="text/plain" language="en" script="Latn">ISO 19115-1:2014 defines the schema required for ...</abstract>
425
+ <abstract format="text/plain" language="fr" script="Latn">L'ISO 19115-1:2014 définit le schéma requis pour ...</abstract>
426
+ <status>
427
+ <stage>60</stage>
428
+ <substage>60</substage>
429
+ </status>
348
430
  <copyright>
349
431
  <from>2014</from>
350
432
  <owner>
351
433
  <organization>
352
- <name>ISO</name>
353
- <abbreviation/>
434
+ <name>International Organization for Standardization</name>
435
+ <abbreviation>ISO</abbreviation>
436
+ <uri>www.iso.org</uri>
354
437
  </organization>
355
438
  </owner>
356
439
  </copyright>
357
- <relation type='obsoletes'>
440
+ <relation type="updates">
358
441
  <bibitem>
359
442
  <formattedref>ISO 19115:2003</formattedref>
360
- <docidentifier>ISO 19115:2003</docidentifier>
443
+ <status>
444
+ <stage>60</stage>
445
+ <substage>60</substage>
446
+ </status>
361
447
  </bibitem>
448
+ <locality type="updates">
449
+ <referenceFrom>Reference form</referenceFrom>
450
+ </locality>
362
451
  </relation>
363
- <relation type='obsoletes'>
452
+ <relation type="updates">
364
453
  <bibitem>
365
454
  <formattedref>ISO 19115:2003/Cor 1:2006</formattedref>
366
- <docidentifier>ISO 19115:2003/Cor 1:2006</docidentifier>
367
- </bibitem>
368
- </relation>
369
- <relation type='updates'>
370
- <bibitem>
371
- <formattedref>ISO 19115-1:2014/Amd 1:2018</formattedref>
372
- <docidentifier>ISO 19115-1:2014/Amd 1:2018</docidentifier>
373
455
  </bibitem>
374
456
  </relation>
375
- <ics>IT applications in science</ics>
376
- </bibitem>"
457
+ <series type="main">
458
+ <title type="title-main" language="en" script="Latn">ISO/IEC FDIS 10118-3</title>
459
+ <place>Serie's place</place>
460
+ <organization>Serie's organization</organization>
461
+ <abbreviation language="en" script="Latn">ABVR</abbreviation>
462
+ <from>2009-02-01</from>
463
+ <to>2010-12-20</to>
464
+ <number>serie1234</number>
465
+ <partnumber>part5678</partnumber>
466
+ </series>
467
+ <series type="alt">
468
+ <formattedref language="en" script="Latn">serieref</formattedref>
469
+ </series>
470
+ <medium>
471
+ <form>medium form</form>
472
+ <size>medium size</size>
473
+ <scale>medium scale</scale>
474
+ </medium>
475
+ <place>bib place</place>
476
+ <locality type="section">
477
+ <referenceFrom>Reference from</referenceFrom>
478
+ <referenceTo>Reference to</referenceTo>
479
+ </locality>
480
+ <accesslocation>accesslocation1</accesslocation>
481
+ <accesslocation>accesslocation2</accesslocation>
482
+ <classification type="type">value</classification>
483
+ <validity>
484
+ <validityBegins>2010-10-10 12:21</validityBegins>
485
+ <validityEnds>2011-02-03 18:30</validityEnds>
486
+ <validityRevision>2011-03-04 09:00</validityRevision>
487
+ </validity>
488
+ <ext>
489
+ <doctype>international-standard</doctype>
490
+ <editorialgroup>
491
+ <technical_committee number="211" type="technicalCommittee"> ISO/TC 211 Geographic information/Geomatics</technical_committee>
492
+ <subcommittee number="122" type="ISO">International Organization for Standardization</subcommittee>
493
+ <workgroup number="111" type="WG">Workgroup Organization</workgroup>
494
+ </editorialgroup>
495
+ <ics>
496
+ <code>35.240.70</code>
497
+ <text>IT applications in science</text>
498
+ </ics>
499
+ <structuredidentifier type="sid">
500
+ <project-number part="2" subpart="2">ISO 1-2:2014</project-number>
501
+ </structuredidentifier>
502
+ </ext>
503
+ </bibdata>"
504
+
505
+ item.to_xml(bibdata: true, note: [{ type: "note type", text: "test note" }])
506
+ => "<bibdata>
507
+ <fetched>2018-10-21</fetched>
508
+ <title type="title-main" format="text/plain" language="en" script="Latn">Metadata</title>
509
+ ...
510
+ <note format="text/plain" type="note type">test note</note>
511
+ ...
377
512
  ----
378
513
 
379
514
  == BibliographicItem
@@ -411,7 +546,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
411
546
 
412
547
  == Contributing
413
548
 
414
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/iso-bib-item.
549
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/relaton-iso-bib.
415
550
 
416
551
  == License
417
552
 
@@ -49,6 +49,7 @@ module RelatonIsoBib
49
49
  # @param builder [Nokogiri::XML::Builder]
50
50
  def to_xml(builder)
51
51
  return unless technical_committee || subcommittee || workgroup || secretariat
52
+
52
53
  builder.editorialgroup do
53
54
  technical_committee.each do |tc|
54
55
  builder.technical_committee { tc.to_xml builder }
@@ -122,19 +122,9 @@ module RelatonIsoBib
122
122
  #
123
123
  # @raise [ArgumentError]
124
124
  def initialize(**args)
125
- if args[:type] && !TYPES.include?(args[:type])
126
- raise ArgumentError, "invalid type: #{args[:type]}"
127
- end
128
-
129
- args.fetch(:language, []).each do |lang|
130
- unless %w[en fr].include? lang
131
- raise ArgumentError, "invalid language: #{lang}"
132
- end
133
- end
134
-
135
- args.fetch(:script, []).each do |scr|
136
- raise ArgumentError, "invalid script: #{scr}" unless scr == "Latn"
137
- end
125
+ check_type args[:type]
126
+ check_language args.fetch(:language, [])
127
+ check_script args.fetch(:script, [])
138
128
 
139
129
  super_args = args.select do |k|
140
130
  %i[id docnumber language script docstatus dates abstract contributors
@@ -144,8 +134,6 @@ module RelatonIsoBib
144
134
  end
145
135
  super(super_args)
146
136
 
147
- @structuredidentifier = args[:structuredidentifier]
148
-
149
137
  @title = args.fetch(:titles, []).reduce([]) do |a, t|
150
138
  if t.is_a? Hash
151
139
  a + typed_titles(t)
@@ -161,7 +149,8 @@ module RelatonIsoBib
161
149
  end
162
150
  end
163
151
 
164
- @doctype = args[:type]
152
+ @structuredidentifier = args[:structuredidentifier]
153
+ @doctype ||= args[:type]
165
154
  @ics = args.fetch(:ics, []).map { |i| i.is_a?(Hash) ? Ics.new(i) : i }
166
155
  @link = args.fetch(:link, []).map do |s|
167
156
  s.is_a?(Hash) ? RelatonBib::TypedUri.new(s) : s
@@ -182,7 +171,12 @@ module RelatonIsoBib
182
171
  @relations << RelatonBib::DocumentRelation.new(
183
172
  type: "partOf", bibitem: me,
184
173
  )
185
- @title.delete_if { |t| t.type == "title-part" }
174
+ @language.each do |l|
175
+ @title.delete_if { |t| t.type == "title-part" }
176
+ ttl = @title.select { |t| t.type != "main" && t.title.language.include?(l) }
177
+ tm_en = ttl.map { |t| t.title.content }.join " - "
178
+ @title.detect { |t| t.type == "main" && t.title.language.include?(l) }.title.content = tm_en
179
+ end
186
180
  @abstract = []
187
181
  @docidentifier.each(&:remove_part)
188
182
  @docidentifier.each(&:all_parts)
@@ -202,7 +196,7 @@ module RelatonIsoBib
202
196
  @abstract = []
203
197
  @dates = []
204
198
  @docidentifier.each &:remove_date
205
- @structuredidentifier.remove_date
199
+ @structuredidentifier&.remove_date
206
200
  @id&.sub! /-[12]\d\d\d/, ""
207
201
  end
208
202
 
@@ -224,10 +218,10 @@ module RelatonIsoBib
224
218
 
225
219
  # @return [String]
226
220
  def to_xml(builder = nil, **opts, &block)
227
- if opts[:note] && !opts[:note].empty?
221
+ if opts[:note]&.any?
228
222
  opts.fetch(:note, []).each do |n|
229
223
  @biblionote << RelatonBib::BiblioNote.new(
230
- content: n[:text], type: n[:type], format: "text/plain"
224
+ content: n[:text], type: n[:type], format: "text/plain",
231
225
  )
232
226
  end
233
227
  end
@@ -235,9 +229,15 @@ module RelatonIsoBib
235
229
  if opts[:bibdata]
236
230
  b.ext do
237
231
  b.doctype doctype if doctype
238
- editorialgroup&.to_xml b
232
+ # GB renders gbcommittee elements istead of an editorialgroup element.
233
+ if respond_to? :committee
234
+ committee&.to_xml b
235
+ else
236
+ editorialgroup&.to_xml b
237
+ end
239
238
  ics.each { |i| i.to_xml b }
240
- structuredidentifier.to_xml b
239
+ structuredidentifier&.to_xml b
240
+ yield b if block_given?
241
241
  end
242
242
  end
243
243
  end
@@ -245,6 +245,32 @@ module RelatonIsoBib
245
245
 
246
246
  private
247
247
 
248
+ # @param language [Array<String>]
249
+ # @raise ArgumentError
250
+ def check_language(language)
251
+ language.each do |lang|
252
+ unless %w[en fr].include? lang
253
+ raise ArgumentError, "invalid language: #{lang}"
254
+ end
255
+ end
256
+ end
257
+
258
+ # @param script [Array<String>]
259
+ # @raise ArgumentError
260
+ def check_script(script)
261
+ script.each do |scr|
262
+ raise ArgumentError, "invalid script: #{scr}" unless scr == "Latn"
263
+ end
264
+ end
265
+
266
+ # @param script [String]
267
+ # @raise ArgumentError
268
+ def check_type(type)
269
+ if type && !TYPES.include?(type)
270
+ raise ArgumentError, "invalid type: #{type}"
271
+ end
272
+ end
273
+
248
274
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
249
275
 
250
276
  # @param title [Hash]
@@ -286,9 +312,8 @@ module RelatonIsoBib
286
312
 
287
313
  titles
288
314
  end
289
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
290
315
 
291
- def makeid(id, attribute, _delim = '')
316
+ def makeid(id, attribute, _delim = "")
292
317
  return nil if attribute && !@id_attribute
293
318
 
294
319
  id ||= @docidentifier.reject { |i| i&.type == "DOI" }[0]
@@ -304,54 +329,6 @@ module RelatonIsoBib
304
329
  # if id.part_number&.size&.positive? then idstr += "-#{id.part_number}"
305
330
  idstr&.gsub(/:/, "-")&.gsub(/\s/, "")&.strip
306
331
  end
307
-
308
- # def xml_attrs(type)
309
- # attrs = {}
310
- # attrs[:type] = type if type
311
- # # attr_id = makeid(nil, true)&.gsub(/ /, "")
312
- # # attrs[:id] = attr_id if attr_id
313
- # attrs
314
- # end
315
-
316
- # @param builder [Nokogiri::XML::Builder]
317
- # def render_xml(builder, **opts)
318
- # builder.send("iso-standard", xml_attrs(type)) do
319
- # builder.fetched fetched if fetched
320
- # formattedref.to_xml builder if formattedref
321
- # title.each { |t| t.to_xml builder }
322
- # link.each { |s| s.to_xml builder }
323
- # docidentifier.each { |i| i.to_xml builder }
324
- # builder.docnumber docnumber if docnumber
325
- # dates.each { |d| d.to_xml builder, opts }
326
- # contributors.each do |c|
327
- # builder.contributor do
328
- # c.role.each { |r| r.to_xml builder }
329
- # c.to_xml builder
330
- # end
331
- # end
332
- # builder.edition edition if edition
333
- # version.to_xml builder if version
334
- # if opts[:note]
335
- # builder.note("ISO DATE: #{opts[:note]}", format: 'text/plain')
336
- # end
337
- # language.each { |l| builder.language l }
338
- # script.each { |s| builder.script s }
339
- # abstract.each { |a| builder.abstract { a.to_xml(builder) } }
340
- # status.to_xml builder if status
341
- # copyright.to_xml builder if copyright
342
- # relations.each { |r| r.to_xml builder }
343
- # series.each { |s| s.to_xml builder } if series
344
- # medium.to_xml builder if medium
345
- # place.each { |pl| builder.place pl }
346
- # extent.each { |e| e.to_xml builder }
347
- # accesslocation.each { |al| builder.accesslocation al }
348
- # classification.to_xml builder if classification
349
- # validity.to_xml builder if validity
350
- # editorialgroup.to_xml builder if editorialgroup
351
- # ics.each { |i| i.to_xml builder }
352
- # builder.allparts 'true' if @all_parts
353
- # yield(builder) if block_given?
354
- # end
355
- # end
332
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
356
333
  end
357
334
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIsoBib
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
@@ -35,6 +35,8 @@ module RelatonIsoBib
35
35
  # @return [RelatonIsoBib::StructuredIdentifier]
36
36
  def fetch_structuredidentifier(ext)
37
37
  sid = ext.at "./structuredidentifier"
38
+ return unless sid
39
+
38
40
  pn = sid.at "project-number"
39
41
  tdn = sid.at "tc-document-number"
40
42
  RelatonIsoBib::StructuredIdentifier.new(
@@ -67,6 +69,8 @@ module RelatonIsoBib
67
69
  # @return [RelatonIsoBib::EditorialGroup]
68
70
  def fetch_editorialgroup(ext)
69
71
  eg = ext.at("./editorialgroup")
72
+ return unless eg
73
+
70
74
  tc = eg&.xpath("technical_committee")&.map { |t| iso_subgroup(t) }
71
75
  sc = eg&.xpath("subcommittee")&.map { |s| iso_subgroup(s) }
72
76
  wg = eg&.xpath("workgroup")&.map { |w| iso_subgroup(w) }
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_dependency "isoics", "~> 0.1.6"
37
37
  spec.add_dependency "nokogiri", "~> 1.8.4"
38
- spec.add_dependency "relaton-bib", "~>0.1.5"
38
+ spec.add_dependency "relaton-bib", "~>0.2.0"
39
39
  spec.add_dependency "ruby_deep_clone", "~> 0.8.0"
40
40
  end
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: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-28 00:00:00.000000000 Z
11
+ date: 2019-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.1.5
159
+ version: 0.2.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.1.5
166
+ version: 0.2.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: ruby_deep_clone
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -193,7 +193,6 @@ files:
193
193
  - Gemfile.lock
194
194
  - LICENSE.txt
195
195
  - README.adoc
196
- - README.md
197
196
  - Rakefile
198
197
  - bin/console
199
198
  - bin/setup
@@ -227,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
226
  version: '0'
228
227
  requirements: []
229
228
  rubyforge_project:
230
- rubygems_version: 2.6.12
229
+ rubygems_version: 2.7.6
231
230
  signing_key:
232
231
  specification_version: 4
233
232
  summary: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
data/README.md DELETED
@@ -1,39 +0,0 @@
1
- # RelatonIsoBib
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/relaton_iso_bib`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'relaton_iso_bib'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install relaton_iso_bib
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/relaton_iso_bib.
36
-
37
- ## License
38
-
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).