iso-bib-item 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +7 -5
- data/README.adoc +4 -0
- data/iso-bib-item.gemspec +1 -0
- data/lib/iso_bib_item/document_relation_collection.rb +9 -4
- data/lib/iso_bib_item/iso_bibliographic_item.rb +29 -0
- data/lib/iso_bib_item/iso_localized_title.rb +4 -0
- data/lib/iso_bib_item/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 186fc45016ad7f72189281554e2fe4a195145ad7765e8718565a4b8fe4d70dfb
|
4
|
+
data.tar.gz: 1416aee5aa32dd0fc815f0055e30c3cccb6690744fa212dfe6bc2587e797adc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 186f877bb88a117b1e1cca056c00cdd4bddfd3727e2de81a461d228298306e962b9b726fd16699c9a7c02a2bd42841a2330ce382c78088dec16b7a80747cd5df
|
7
|
+
data.tar.gz: 6be1a5e689c6039f93e394449430d0eb678adc295c45488c25df87278f22e5e62fa753481d80b0cea29926d0a8139b6c33ad05e2274a9d2f10afe979f3ac0518
|
data/Gemfile.lock
CHANGED
@@ -1,22 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
iso-bib-item (0.1.
|
4
|
+
iso-bib-item (0.1.6)
|
5
|
+
duplicate
|
5
6
|
isoics (~> 0.1.6)
|
6
7
|
nokogiri
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
byebug (10.0.
|
12
|
+
byebug (10.0.2)
|
12
13
|
coderay (1.1.2)
|
13
14
|
diff-lcs (1.3)
|
14
|
-
docile (1.3.
|
15
|
+
docile (1.3.1)
|
16
|
+
duplicate (1.1.1)
|
15
17
|
isoics (0.1.6)
|
16
18
|
json (2.1.0)
|
17
19
|
method_source (0.9.0)
|
18
20
|
mini_portile2 (2.3.0)
|
19
|
-
nokogiri (1.8.
|
21
|
+
nokogiri (1.8.3)
|
20
22
|
mini_portile2 (~> 2.3.0)
|
21
23
|
pry (0.11.3)
|
22
24
|
coderay (~> 1.1.0)
|
@@ -56,4 +58,4 @@ DEPENDENCIES
|
|
56
58
|
simplecov
|
57
59
|
|
58
60
|
BUNDLED WITH
|
59
|
-
1.16.
|
61
|
+
1.16.2
|
data/README.adoc
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
= IsoBibItem
|
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/riboseinc/iso-bib-item/master.svg["Build Status", link="https://travis-ci.org/riboseinc/iso-bib-item"]
|
5
|
+
image:https://codeclimate.com/github/riboseinc/iso-bib-item/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/iso-bib-item"]
|
6
|
+
|
3
7
|
IsoBib is a Ruby gem that implements the https://github.com/riboseinc/isodoc-models#iso-bibliographic-item[IsoBibliographicItem model].
|
4
8
|
|
5
9
|
== Installation
|
data/iso-bib-item.gemspec
CHANGED
@@ -67,18 +67,23 @@ module IsoBibItem
|
|
67
67
|
|
68
68
|
# @param type [String]
|
69
69
|
# @param identifier [String]
|
70
|
-
def initialize(type:, identifier:, url:, bib_locality: [])
|
70
|
+
def initialize(type:, identifier:, url:, bib_locality: [], bibitem: nil)
|
71
71
|
@type = type
|
72
72
|
@identifier = identifier
|
73
73
|
@url = url
|
74
74
|
@bib_locality = bib_locality
|
75
|
+
@bibitem = bibitem
|
75
76
|
end
|
76
77
|
|
77
78
|
def to_xml(builder)
|
78
79
|
builder.relation(type: type) do
|
79
|
-
|
80
|
-
builder.
|
81
|
-
|
80
|
+
if @bibitem.nil?
|
81
|
+
builder.bibitem do
|
82
|
+
builder.formattedref identifier
|
83
|
+
builder.docidentifier identifier
|
84
|
+
end
|
85
|
+
else
|
86
|
+
@bibitem.to_xml(builder, {})
|
82
87
|
end
|
83
88
|
# builder.url url
|
84
89
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'nokogiri'
|
4
4
|
require 'isoics'
|
5
|
+
require 'duplicate'
|
5
6
|
require 'iso_bib_item/bibliographic_item'
|
6
7
|
require 'iso_bib_item/iso_document_status'
|
7
8
|
require 'iso_bib_item/iso_localized_title'
|
@@ -34,6 +35,10 @@ module IsoBibItem
|
|
34
35
|
@part_number = part_number
|
35
36
|
end
|
36
37
|
|
38
|
+
def remove_part
|
39
|
+
@part_number = nil
|
40
|
+
end
|
41
|
+
|
37
42
|
def to_xml(builder)
|
38
43
|
builder.docidentifier(project_number + '-' + part_number)
|
39
44
|
end
|
@@ -127,6 +132,29 @@ module IsoBibItem
|
|
127
132
|
@source = args[:source].map { |s| TypedUri.new(s) }
|
128
133
|
end
|
129
134
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
135
|
+
|
136
|
+
# convert ISO nnn-1 reference into an All Parts reference:
|
137
|
+
# remove title part components and abstract
|
138
|
+
# TODO: make nnn-1 partOf relation of the redacted document
|
139
|
+
def to_all_parts
|
140
|
+
me = Duplicate.duplicate(self)
|
141
|
+
@relations << DocumentRelation.new(type: "partOf", identifier: nil, url: nil, bibitem: me)
|
142
|
+
@title.each { |t| t.remove_part }
|
143
|
+
@abstract = []
|
144
|
+
@docidentifier.remove_part
|
145
|
+
@allParts = true
|
146
|
+
end
|
147
|
+
|
148
|
+
# convert ISO:yyyy reference to reference to most recent
|
149
|
+
# instance of reference, removing date-specific infomration:
|
150
|
+
# date of publication, abstracts. Make dated reference Instance relation
|
151
|
+
# of the redacated document
|
152
|
+
def to_most_recent_reference
|
153
|
+
me = Duplicate.duplicate(self)
|
154
|
+
@relations << DocumentRelation.new(type: "instance", identifier: nil, url: nil, bibitem: me)
|
155
|
+
@abstract = []
|
156
|
+
@dates = []
|
157
|
+
end
|
130
158
|
|
131
159
|
# @param lang [String] language code Iso639
|
132
160
|
# @return [IsoBibItem::IsoLocalizedTitle]
|
@@ -208,6 +236,7 @@ module IsoBibItem
|
|
208
236
|
builder.note("ISO DATE: #{opts[:note]}", format: 'text/plain')
|
209
237
|
end
|
210
238
|
ics.each { |i| i.to_xml builder }
|
239
|
+
builder.allParts "true" if @allParts
|
211
240
|
yield(builder) if block_given?
|
212
241
|
end
|
213
242
|
end
|
data/lib/iso_bib_item/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.6
|
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-06-
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: duplicate
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: 'IsoBibItem: Ruby ISOXMLDOC impementation.'
|
112
126
|
email:
|
113
127
|
- open.source@ribose.com
|
@@ -163,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
177
|
version: '0'
|
164
178
|
requirements: []
|
165
179
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.6
|
180
|
+
rubygems_version: 2.7.6
|
167
181
|
signing_key:
|
168
182
|
specification_version: 4
|
169
183
|
summary: 'IsoBibItem: Ruby ISOXMLDOC impementation.'
|