iso-bib-item 0.1.10 → 0.1.11

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
2
  SHA256:
3
- metadata.gz: 5c55d46b221d43dfbcd9224d18f314807b33926a0a4bb8951b039a23b0c258be
4
- data.tar.gz: 71e7a963f3ea926687b5f6e36ed791dabdec532bfe82670101ec59e87992b63b
3
+ metadata.gz: 35146363462622bb4a40fd392cd10ee47b411bbfee238108da476e365944f263
4
+ data.tar.gz: a1ed4d24e83c8ace967b7c38d4a745b160497744f43e956a5644610641d0eda5
5
5
  SHA512:
6
- metadata.gz: e99e3d0aff6f4da0b6d8aeee1ce712d629d4c97ffd8b1ef12dc5fe75e79006420c22bfcfa24dfa89087e3df4c85ecb46e764acfca84aa99797f2dfdb14f6c15e
7
- data.tar.gz: 259ff3b47c827b1e5c3475214b2fd4f844ccf9454be4d773554730890a61d492191d5c34868397a235495e489e94cc727ea152a506f26f7a1054a087ee5f4043
6
+ metadata.gz: b62d9e9c5aeab6ab50f62a2fd3f81b0e4d981034dd258cd05c15279be94afe4f410a99e1fbfd8fc028a7f596a4cf00e564d581b89c6ed0651244554e51d280e3
7
+ data.tar.gz: 69921f12e852458b2047f01825412e35228a4fcd9df581b30b6ec82d1bb4755f152bca5aedde1a3cbdfaa360eeed031bb0f6f52b18c95a4e0b507d077d5ef811
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iso-bib-item (0.1.9)
5
- duplicate
4
+ iso-bib-item (0.1.11)
6
5
  isoics (~> 0.1.6)
7
- nokogiri
6
+ nokogiri (~> 1.8.4)
7
+ ruby_deep_clone (~> 0.8.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -13,14 +13,13 @@ GEM
13
13
  coderay (1.1.2)
14
14
  diff-lcs (1.3)
15
15
  docile (1.3.1)
16
- duplicate (1.1.1)
17
16
  equivalent-xml (0.6.0)
18
17
  nokogiri (>= 1.4.3)
19
18
  isoics (0.1.6)
20
19
  json (2.1.0)
21
20
  method_source (0.9.0)
22
21
  mini_portile2 (2.3.0)
23
- nokogiri (1.8.3)
22
+ nokogiri (1.8.4)
24
23
  mini_portile2 (~> 2.3.0)
25
24
  pry (0.11.3)
26
25
  coderay (~> 1.1.0)
@@ -42,6 +41,7 @@ GEM
42
41
  diff-lcs (>= 1.2.0, < 2.0)
43
42
  rspec-support (~> 3.7.0)
44
43
  rspec-support (3.7.1)
44
+ ruby_deep_clone (0.8.0)
45
45
  simplecov (0.16.1)
46
46
  docile (~> 1.1)
47
47
  json (>= 1.8, < 3)
data/README.adoc CHANGED
@@ -76,7 +76,7 @@ item = IsoBibItem::IsoBibliographicItem.new(
76
76
  }
77
77
  ],
78
78
  copyright: { owner: { name: "ISO" }, from: "2014" },
79
- source: [
79
+ link: [
80
80
  { type: "src", content: "https://www.iso.org/standard/53798.html" },
81
81
  { type: "obp", content: "https://www.iso.org/obp/ui/#!iso:std:53798:en" },
82
82
  { type: "rss", content: "https://www.iso.org/contents/data/standard/05/37/53798.detail.rss" }
@@ -278,9 +278,9 @@ item.to_xml
278
278
  =>"<bibitem type='international-standard' id='ISO19115-1'>
279
279
  <title format='text/plain' language='en' script='Latn'>Geographic information -- Metadata -- Part 1: Fundamentals</title>
280
280
  <title format='text/plain' language='fr' script='Latn'>Information géographique -- Métadonnées -- Partie 1: Principes de base</title>
281
- <source type='src'>https://www.iso.org/standard/53798.html</source>
282
- <source type='obp'>https://www.iso.org/obp/ui/#!iso:std:53798:en</source>
283
- <source type='rss'>https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</source>
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
284
  <docidentifier>ISO 19115-1</docidentifier>
285
285
  <date type='published'>
286
286
  <on>2014</on>
data/iso-bib-item.gemspec CHANGED
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
31
31
 
32
32
  spec.add_dependency 'isoics', '~> 0.1.6'
33
- spec.add_dependency 'nokogiri'
34
- spec.add_dependency 'duplicate'
33
+ spec.add_dependency 'nokogiri', "~> 1.8.4"
34
+ spec.add_dependency 'ruby_deep_clone', "~> 0.8.0"
35
35
  end
@@ -88,7 +88,7 @@ module IsoBibItem
88
88
  end
89
89
 
90
90
  def to_xml(builder)
91
- builder.link(content.to_s, type: type)
91
+ builder.uri(content.to_s, type: type)
92
92
  end
93
93
  end
94
94
 
@@ -68,6 +68,7 @@ module IsoBibItem
68
68
  # @param type [String]
69
69
  # @param identifier [String]
70
70
  def initialize(type:, identifier:, url:, bib_locality: [], bibitem: nil)
71
+ type = "obsoletes" if type == "Now withdrawn"
71
72
  @type = type
72
73
  @identifier = identifier
73
74
  @url = url
@@ -0,0 +1,27 @@
1
+ require 'nokogiri'
2
+ module IsoBibItem
3
+ class << self
4
+ def from_xml(doc)
5
+ xml = Nokogiri::XML(doc)
6
+ IsoBibliographicItem.new(
7
+ =begin
8
+ docid: fetch_docid(doc),
9
+ edition: edition,
10
+ language: langs(doc).map { |l| l[:lang] },
11
+ script: langs(doc).map { |l| script(l[:lang]) }.uniq,
12
+ titles: titles,
13
+ type: fetch_type(hit_data['title']),
14
+ docstatus: fetch_status(doc, hit_data['status']),
15
+ ics: fetch_ics(doc),
16
+ dates: fetch_dates(doc),
17
+ contributors: fetch_contributors(hit_data['title']),
18
+ workgroup: fetch_workgroup(doc),
19
+ abstract: abstract,
20
+ copyright: fetch_copyright(hit_data['title'], doc),
21
+ link: fetch_link(doc, url),
22
+ relations: fetch_relations(doc)
23
+ =end
24
+ )
25
+ end
26
+ end
27
+ end
@@ -2,12 +2,13 @@
2
2
 
3
3
  require 'nokogiri'
4
4
  require 'isoics'
5
- require 'duplicate'
5
+ require 'deep_clone'
6
6
  require 'iso_bib_item/bibliographic_item'
7
7
  require 'iso_bib_item/iso_document_status'
8
8
  require 'iso_bib_item/iso_localized_title'
9
9
  require 'iso_bib_item/iso_project_group'
10
10
  require 'iso_bib_item/document_relation_collection'
11
+ require 'iso_bib_item/from_xml'
11
12
 
12
13
  # Add filter method to Array.
13
14
  class Array
@@ -142,7 +143,8 @@ module IsoBibItem
142
143
  # convert ISO nnn-1 reference into an All Parts reference:
143
144
  # remove title part components and abstract
144
145
  def to_all_parts
145
- me = Duplicate.duplicate(self)
146
+ #me = Duplicate.duplicate(self)
147
+ me = DeepClone.clone(self)
146
148
  me.disable_id_attribute
147
149
  @relations << DocumentRelation.new(type: "partOf", identifier: nil, url: nil, bibitem: me)
148
150
 
@@ -157,7 +159,8 @@ module IsoBibItem
157
159
  # date of publication, abstracts. Make dated reference Instance relation
158
160
  # of the redacated document
159
161
  def to_most_recent_reference
160
- me = Duplicate.duplicate(self)
162
+ #me = Duplicate.duplicate(self)
163
+ me = DeepClone.clone(self)
161
164
  me.disable_id_attribute
162
165
  @relations << DocumentRelation.new(type: "instance", identifier: nil, url: nil, bibitem: me)
163
166
  @abstract = []
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module IsoBibItem
4
- VERSION = '0.1.10'.freeze
4
+ VERSION = '0.1.11'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso-bib-item
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,30 +112,30 @@ dependencies:
112
112
  name: nokogiri
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 1.8.4
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 1.8.4
125
125
  - !ruby/object:Gem::Dependency
126
- name: duplicate
126
+ name: ruby_deep_clone
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 0.8.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: 0.8.0
139
139
  description: 'IsoBibItem: Ruby ISOXMLDOC impementation.'
140
140
  email:
141
141
  - open.source@ribose.com
@@ -163,6 +163,7 @@ files:
163
163
  - lib/iso_bib_item/document_relation_collection.rb
164
164
  - lib/iso_bib_item/document_status.rb
165
165
  - lib/iso_bib_item/formatted_string.rb
166
+ - lib/iso_bib_item/from_xml.rb
166
167
  - lib/iso_bib_item/iso_bibliographic_item.rb
167
168
  - lib/iso_bib_item/iso_document_status.rb
168
169
  - lib/iso_bib_item/iso_localized_title.rb