relaton-bib 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +24 -19
- data/README.adoc +185 -136
- data/bin/rspec +29 -0
- data/docs/hash.adoc +130 -20
- data/lib/relaton_bib/bibliographic_item.rb +176 -9
- data/lib/relaton_bib/bibtex_parser.rb +236 -0
- data/lib/relaton_bib/contribution_info.rb +1 -1
- data/lib/relaton_bib/hash_converter.rb +12 -6
- data/lib/relaton_bib/place.rb +37 -0
- data/lib/relaton_bib/series.rb +2 -2
- data/lib/relaton_bib/typed_title_string.rb +1 -1
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +10 -5
- data/relaton-bib.gemspec +2 -1
- metadata +33 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ce6cabec8231c8496286a8b792efc2842abbfceee27f8ee27ed9c7759574416
|
4
|
+
data.tar.gz: efdd0740c622358066675c5e37d278c1b66e43b4cf0420bcd1afafb708140c15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc52f3fb46b5491c7e83a1fd71602e8c9af0123823ea88faacf5d6a5f6f77dfd17bdbbcc5ec19f9ea878697961cbd55d4ab488595da7d659688e8958b50949fd
|
7
|
+
data.tar.gz: 7d3154b81eb5c7cc465b9257cc17c596ac2c71453b371b5f9767194bcbbe1c6c495247cb2a1c389fd40830e6fa7cc57f6fd27425a21b07b447ff99cf3121be88
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
relaton-bib (0.
|
4
|
+
relaton-bib (0.5.0)
|
5
5
|
addressable
|
6
|
+
bibtex-ruby
|
7
|
+
iso639
|
6
8
|
nokogiri
|
7
9
|
|
8
10
|
GEM
|
@@ -10,39 +12,43 @@ GEM
|
|
10
12
|
specs:
|
11
13
|
addressable (2.7.0)
|
12
14
|
public_suffix (>= 2.0.2, < 5.0)
|
15
|
+
bibtex-ruby (5.0.1)
|
16
|
+
latex-decode (~> 0.0)
|
13
17
|
byebug (11.0.1)
|
14
|
-
debase (0.2.
|
18
|
+
debase (0.2.4.1)
|
15
19
|
debase-ruby_core_source (>= 0.10.2)
|
16
|
-
debase-ruby_core_source (0.10.
|
20
|
+
debase-ruby_core_source (0.10.7)
|
17
21
|
diff-lcs (1.3)
|
18
22
|
docile (1.3.2)
|
19
23
|
equivalent-xml (0.6.0)
|
20
24
|
nokogiri (>= 1.4.3)
|
21
|
-
|
25
|
+
iso639 (1.3.2)
|
26
|
+
json (2.3.0)
|
27
|
+
latex-decode (0.3.1)
|
22
28
|
mini_portile2 (2.4.0)
|
23
|
-
nokogiri (1.10.
|
29
|
+
nokogiri (1.10.7)
|
24
30
|
mini_portile2 (~> 2.4.0)
|
25
31
|
optout (0.0.2)
|
26
|
-
public_suffix (4.0.
|
32
|
+
public_suffix (4.0.3)
|
27
33
|
rake (10.5.0)
|
28
|
-
rspec (3.
|
29
|
-
rspec-core (~> 3.
|
30
|
-
rspec-expectations (~> 3.
|
31
|
-
rspec-mocks (~> 3.
|
32
|
-
rspec-core (3.
|
33
|
-
rspec-support (~> 3.
|
34
|
-
rspec-expectations (3.
|
34
|
+
rspec (3.9.0)
|
35
|
+
rspec-core (~> 3.9.0)
|
36
|
+
rspec-expectations (~> 3.9.0)
|
37
|
+
rspec-mocks (~> 3.9.0)
|
38
|
+
rspec-core (3.9.0)
|
39
|
+
rspec-support (~> 3.9.0)
|
40
|
+
rspec-expectations (3.9.0)
|
35
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.
|
37
|
-
rspec-mocks (3.
|
42
|
+
rspec-support (~> 3.9.0)
|
43
|
+
rspec-mocks (3.9.0)
|
38
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-support (3.
|
45
|
+
rspec-support (~> 3.9.0)
|
46
|
+
rspec-support (3.9.0)
|
41
47
|
ruby-debug-ide (0.7.0)
|
42
48
|
rake (>= 0.8.1)
|
43
49
|
ruby-jing (0.0.1)
|
44
50
|
optout (>= 0.0.2)
|
45
|
-
simplecov (0.17.
|
51
|
+
simplecov (0.17.1)
|
46
52
|
docile (~> 1.1)
|
47
53
|
json (>= 1.8, < 3)
|
48
54
|
simplecov-html (~> 0.10.0)
|
@@ -52,7 +58,6 @@ PLATFORMS
|
|
52
58
|
ruby
|
53
59
|
|
54
60
|
DEPENDENCIES
|
55
|
-
bundler (~> 2.0)
|
56
61
|
byebug
|
57
62
|
debase
|
58
63
|
equivalent-xml (~> 0.6)
|
data/README.adoc
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
= RelatonBib
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/relaton-bib.svg["Gem Version", link="https://rubygems.org/gems/relaton-bib"]
|
4
|
-
image:https://
|
5
|
-
image:https://
|
4
|
+
image:https://github.com/relaton/relaton-bib/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-bib/actions?workflow=macos"]
|
5
|
+
image:https://github.com/relaton/relaton-bib/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-bib/actions?workflow=windows"]
|
6
|
+
image:https://github.com/relaton/relaton-bib/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-bib/actions?workflow=ubuntu"]
|
7
|
+
image:https://codeclimate.com/github/relaton/relaton-bib/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-bib"]
|
8
|
+
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bib.svg["Pull Requests", link="https://github.com/relaton/relaton-bib/pulls"]
|
9
|
+
image:https://img.shields.io/github/commits-since/relaton/relaton-bib/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bib/releases"]
|
6
10
|
|
7
11
|
RlatonBib is a Ruby gem that implements the https://github.com/metanorma/relaton-models#bibliography-uml-models[BibliographicItem model].
|
8
12
|
|
@@ -30,62 +34,144 @@ Or install it yourself as:
|
|
30
34
|
[source,ruby]
|
31
35
|
----
|
32
36
|
item = RelatonBib::BibliographicItem.new(
|
33
|
-
id: "
|
34
|
-
fetched: Date.today.to_s,
|
35
|
-
type: "standard",
|
37
|
+
id: "ISOTC211", fetched: Date.today.to_s,
|
36
38
|
title: [
|
37
39
|
{ type: "main", content: "Geographic information", language: "en", script: "Latn" },
|
38
40
|
{
|
39
41
|
content: "Information géographique", language: "fr", script: "Latn"
|
40
42
|
},
|
41
43
|
],
|
42
|
-
|
43
|
-
{ type: "src", content: "https://www.iso.org/standard/53798.html" },
|
44
|
-
{ type: "obp",
|
45
|
-
content: "https://www.iso.org/obp/ui/#!iso:std:53798:en" },
|
46
|
-
{ type: "rss", content: "https://www.iso.org/contents/data/standard"\
|
47
|
-
"/05/37/53798.detail.rss" }
|
48
|
-
],
|
44
|
+
type: "standard",
|
49
45
|
docid: [
|
50
|
-
RelatonBib::DocumentIdentifier.new(id: "TC211", type: "ISO")
|
46
|
+
RelatonBib::DocumentIdentifier.new(id: "TC211", type: "ISO"),
|
47
|
+
RelatonBib::DocumentIdentifier.new(id: "ISBN", type: "isbn"),
|
48
|
+
RelatonBib::DocumentIdentifier.new(id: "LCCN", type: "lccn"),
|
49
|
+
RelatonBib::DocumentIdentifier.new(id: "ISSN", type: "issn"),
|
51
50
|
],
|
52
51
|
docnumber: "123456",
|
52
|
+
edition: "1", language: %w[en fr], script: ["Latn"],
|
53
|
+
version: RelatonBib::BibliographicItem::Version.new("2019-04-01", ["draft"]),
|
54
|
+
biblionote: [
|
55
|
+
RelatonBib::BiblioNote.new(content: "note"),
|
56
|
+
RelatonBib::BiblioNote.new(content: "An note", type: "annote"),
|
57
|
+
RelatonBib::BiblioNote.new(content: "How published", type: "howpublished"),
|
58
|
+
RelatonBib::BiblioNote.new(content: "Comment", type: "comment"),
|
59
|
+
RelatonBib::BiblioNote.new(content: "Table Of Contents", type: "tableOfContents"),
|
60
|
+
],
|
61
|
+
docstatus: RelatonBib::DocumentStatus.new(
|
62
|
+
stage: "stage", substage: "substage", iteration: "final",
|
63
|
+
),
|
53
64
|
date: [
|
54
65
|
{ type: "issued", on: "2014" },
|
55
66
|
{ type: "published", on: "2014-04" },
|
56
|
-
{ type: "accessed", on: "2015-05-20" }
|
57
|
-
],
|
58
|
-
contributor: [
|
59
|
-
{ entity: {
|
60
|
-
name: "International Organization for Standardization",
|
61
|
-
url: "www.iso.org", abbreviation: "ISO", subdivision: "division" },
|
62
|
-
role: [["publisher", ["Publisher role"]]], }
|
67
|
+
{ type: "accessed", on: "2015-05-20" },
|
63
68
|
],
|
64
|
-
edition: "1",
|
65
|
-
version: RelatonBib::BibliographicItem::Version.new("2019-04-01", ["draft"]),
|
66
|
-
language: ["en", "fr"],
|
67
|
-
script: ["Latn"],
|
68
69
|
abstract: [
|
69
70
|
{ content: "ISO 19115-1:2014 defines the schema required for ...",
|
70
71
|
language: "en", script: "Latn", format: "text/plain" },
|
71
72
|
{ content: "L'ISO 19115-1:2014 définit le schéma requis pour ...",
|
72
73
|
language: "fr", script: "Latn", format: "text/plain" },
|
73
74
|
],
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
contributor: [
|
76
|
+
{
|
77
|
+
entity: {
|
78
|
+
name: "International Organization for Standardization",
|
79
|
+
url: "www.iso.org", abbreviation: "ISO", subdivision: "division",
|
80
|
+
},
|
81
|
+
role: [{ type: "publisher", description: ["Publisher role"] }],
|
80
82
|
},
|
81
|
-
|
83
|
+
{
|
84
|
+
entity: RelatonBib::Person.new(
|
85
|
+
name: RelatonBib::FullName.new(
|
86
|
+
completename: RelatonBib::LocalizedString.new("A. Bierman", "en"),
|
87
|
+
),
|
88
|
+
affiliation: [RelatonBib::Affilation.new(
|
89
|
+
organization: RelatonBib::Organization.new(
|
90
|
+
name: "IETF",
|
91
|
+
abbreviation: RelatonBib::LocalizedString.new("IETF"),
|
92
|
+
identifier: [RelatonBib::OrgIdentifier.new("uri", "www.ietf.org")],
|
93
|
+
)
|
94
|
+
)],
|
95
|
+
contact: [
|
96
|
+
RelatonBib::Address.new(
|
97
|
+
street: ["Street"], city: "City", postcode: "123456",
|
98
|
+
country: "Country", state: "State"
|
99
|
+
),
|
100
|
+
RelatonBib::Contact.new(type: "phone", value: "223322"),
|
101
|
+
]
|
102
|
+
),
|
103
|
+
role: [type: "author"],
|
104
|
+
},
|
105
|
+
RelatonBib::ContributionInfo.new(
|
106
|
+
entity: RelatonBib::Organization.new(
|
107
|
+
name: "IETF",
|
108
|
+
abbreviation: "IETF",
|
109
|
+
identifier: [RelatonBib::OrgIdentifier.new("uri", "www.ietf.org")],
|
110
|
+
),
|
111
|
+
role: [type: "publisher"],
|
112
|
+
),
|
113
|
+
{
|
114
|
+
entity: RelatonBib::Person.new(
|
115
|
+
name: RelatonBib::FullName.new(
|
116
|
+
initial: [RelatonBib::LocalizedString.new("A.", "en")],
|
117
|
+
surname: RelatonBib::LocalizedString.new("Bierman", "en"),
|
118
|
+
forename: [RelatonBib::LocalizedString.new("Forename", "en")],
|
119
|
+
addition: [RelatonBib::LocalizedString.new("Addition", "en")],
|
120
|
+
prefix: [RelatonBib::LocalizedString.new("Prefix", "en")],
|
121
|
+
),
|
122
|
+
affiliation: [RelatonBib::Affilation.new(
|
123
|
+
organization: RelatonBib::Organization.new(name: "IETF", abbreviation: "IETF"),
|
124
|
+
description: [RelatonBib::LocalizedString.new("Description", "en")]
|
125
|
+
)],
|
126
|
+
contact: [
|
127
|
+
RelatonBib::Address.new(
|
128
|
+
street: ["Street"], city: "City", postcode: "123456",
|
129
|
+
country: "Country", state: "State"
|
130
|
+
),
|
131
|
+
RelatonBib::Contact.new(type: "phone", value: "223322"),
|
132
|
+
],
|
133
|
+
identifier: [RelatonBib::PersonIdentifier.new("uri", "www.person.com")],
|
134
|
+
),
|
135
|
+
role: [type: "author"],
|
136
|
+
},
|
137
|
+
{ entity: { name: "Institution" }, role: [type: "sponsor"] }
|
138
|
+
],
|
139
|
+
copyright: { owner: {
|
140
|
+
name: "International Organization for Standardization",
|
141
|
+
abbreviation: "ISO", url: "www.iso.org"
|
142
|
+
}, from: "2014", to: "2020" },
|
143
|
+
link: [
|
144
|
+
{ type: "src", content: "https://www.iso.org/standard/53798.html" },
|
145
|
+
{ type: "obp",
|
146
|
+
content: "https://www.iso.org/obp/ui/#!iso:std:53798:en" },
|
147
|
+
{ type: "rss", content: "https://www.iso.org/contents/data/standard"\
|
148
|
+
"/05/37/53798.detail.rss" },
|
149
|
+
{ type: "doi", content: "http://standrd.org/doi-123" },
|
150
|
+
{ type: "file", content: "file://path/file" },
|
151
|
+
],
|
82
152
|
relation: [
|
83
|
-
{
|
153
|
+
{
|
154
|
+
type: "updates",
|
84
155
|
bibitem: RelatonBib::BibliographicItem.new(
|
85
156
|
formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003"),
|
86
157
|
),
|
87
|
-
bib_locality: [
|
88
|
-
|
158
|
+
bib_locality: [
|
159
|
+
RelatonBib::BibItemLocality.new("section", "Reference from"),
|
160
|
+
],
|
161
|
+
},
|
162
|
+
{
|
163
|
+
type: "updates",
|
164
|
+
bibitem: RelatonBib::BibliographicItem.new(
|
165
|
+
type: "standard",
|
166
|
+
formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003/Cor 1:2006"),
|
167
|
+
),
|
168
|
+
},
|
169
|
+
{
|
170
|
+
type: "partOf",
|
171
|
+
bibitem: RelatonBib::BibliographicItem.new(
|
172
|
+
title: [RelatonBib::TypedTitleString.new(type: "main", content: "Book title")],
|
173
|
+
),
|
174
|
+
},
|
89
175
|
],
|
90
176
|
series: [
|
91
177
|
RelatonBib::Series.new(
|
@@ -96,7 +182,7 @@ item = RelatonBib::BibliographicItem.new(
|
|
96
182
|
),
|
97
183
|
place: "Serie's place",
|
98
184
|
organization: "Serie's organization",
|
99
|
-
abbreviation: RelatonBib::LocalizedString.new("ABVR"
|
185
|
+
abbreviation: RelatonBib::LocalizedString.new("ABVR"),
|
100
186
|
from: "2009-02-01",
|
101
187
|
to: "2010-12-20",
|
102
188
|
number: "serie1234",
|
@@ -105,25 +191,37 @@ item = RelatonBib::BibliographicItem.new(
|
|
105
191
|
RelatonBib::Series.new(
|
106
192
|
type: "alt",
|
107
193
|
formattedref: RelatonBib::FormattedRef.new(
|
108
|
-
content: "serieref", language: "en", script: "Latn"
|
194
|
+
content: "serieref", language: "en", script: "Latn",
|
109
195
|
),
|
110
|
-
)
|
196
|
+
),
|
197
|
+
RelatonBib::Series.new(
|
198
|
+
type: "journal", title: RelatonBib::TypedTitleString.new(content: "Journal"), number: "7"
|
199
|
+
),
|
200
|
+
RelatonBib::Series.new(title: RelatonBib::TypedTitleString.new(content: "Series")),
|
111
201
|
],
|
112
202
|
medium: RelatonBib::Medium.new(
|
113
|
-
form: "medium form", size: "medium size", scale: "medium scale"
|
203
|
+
form: "medium form", size: "medium size", scale: "medium scale",
|
114
204
|
),
|
115
|
-
place: [
|
205
|
+
place: [
|
206
|
+
"bib place",
|
207
|
+
RelatonBib::Place.new(name: "Geneva", uri: "geneva.place", region: "Switzelznd")
|
208
|
+
],
|
116
209
|
extent: [
|
117
|
-
RelatonBib::BibItemLocality.new(
|
118
|
-
|
119
|
-
),
|
210
|
+
RelatonBib::BibItemLocality.new("section", "Reference from", "Reference to"),
|
211
|
+
RelatonBib::BibItemLocality.new("chapter", "4"),
|
212
|
+
RelatonBib::BibItemLocality.new("page", "10", "20"),
|
213
|
+
RelatonBib::BibItemLocality.new("volume", "1"),
|
120
214
|
],
|
121
215
|
accesslocation: ["accesslocation1", "accesslocation2"],
|
122
|
-
classification:
|
216
|
+
classification: [
|
217
|
+
RelatonBib::Classification.new(type: "type", value: "value"),
|
218
|
+
RelatonBib::Classification.new(type: "keyword", value: "Keywords"),
|
219
|
+
RelatonBib::Classification.new(type: "mendeley", value: "Mendeley Tags"),
|
220
|
+
],
|
123
221
|
validity: RelatonBib::Validity.new(
|
124
222
|
begins: Time.new(2010, 10, 10, 12, 21),
|
125
223
|
ends: Time.new(2011, 2, 3, 18,30),
|
126
|
-
revision: Time.new(2011, 3, 4, 9, 0)
|
224
|
+
revision: Time.new(2011, 3, 4, 9, 0),
|
127
225
|
)
|
128
226
|
)
|
129
227
|
----
|
@@ -171,96 +269,13 @@ item.to_xml
|
|
171
269
|
<fetched>2019-04-30</fetched>
|
172
270
|
<title type=\"main\" language=\"en\" script=\"Latn\">Geographic information</title>
|
173
271
|
<title language=\"fr\" script=\"Latn\">Information géographique</title>
|
174
|
-
|
175
|
-
<uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:53798:en</uri>
|
176
|
-
<uri type=\"rss\">https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</uri>
|
177
|
-
<docidentifier type=\"ISO\">TC211</docidentifier>
|
178
|
-
<docnumber>123456</docnumber>
|
179
|
-
<date type="issued">
|
180
|
-
<on>2014</on>
|
181
|
-
</date>
|
182
|
-
<date type="published">
|
183
|
-
<on>2014</on>
|
184
|
-
</date>
|
185
|
-
<date type="accessed">
|
186
|
-
<on>2015</on>
|
187
|
-
</date>
|
188
|
-
<contributor>
|
189
|
-
<role type=\"publisher\">
|
190
|
-
<description>Publisher role</description>
|
191
|
-
</role>
|
192
|
-
<organization>
|
193
|
-
<name>International Organization for Standardization</name>
|
194
|
-
<subdivision>division</subdivision>
|
195
|
-
<abbreviation>ISO</abbreviation>
|
196
|
-
<uri>www.iso.org</uri>
|
197
|
-
</organization>
|
198
|
-
</contributor>
|
199
|
-
<edition>1</edition>
|
200
|
-
<version>
|
201
|
-
<revision_date>2019-04-01</revision_date>
|
202
|
-
<draft>draft</draft>
|
203
|
-
</version>
|
204
|
-
<language>en</language>
|
205
|
-
<language>fr</language>
|
206
|
-
<script>Latn</script>
|
207
|
-
<abstract format=\"text/plain\" language=\"en\" script=\"Latn\">ISO 19115-1:2014 defines the schema required for ...</abstract>
|
208
|
-
<abstract format=\"text/plain\" language=\"fr\" script=\"Latn\">L'ISO 19115-1:2014 définit le schéma requis pour ...</abstract>
|
209
|
-
<status language=\"en\" script=\"Latn\">standard</status>
|
210
|
-
<copyright>
|
211
|
-
<from>2014</from>
|
212
|
-
<to>2020</to>
|
213
|
-
<owner>
|
214
|
-
<organization>
|
215
|
-
<name>International Organization for Standardization</name>
|
216
|
-
<abbreviation>ISO</abbreviation>
|
217
|
-
<uri>www.iso.org</uri>
|
218
|
-
</organization>
|
219
|
-
</owner>
|
220
|
-
</copyright>
|
221
|
-
<relation type=\"updates\">
|
222
|
-
<bibitem>
|
223
|
-
<formattedref>ISO 19115:2003</formattedref>
|
224
|
-
</bibitem>
|
225
|
-
<locality type=\"updates\">
|
226
|
-
<referenceFrom>Reference form</referenceFrom>
|
227
|
-
</locality>
|
228
|
-
</relation>
|
229
|
-
<series type=\"main\">
|
230
|
-
<title type=\"original\" format=\"text/plain\" language=\"en\" script=\"Latn\">ISO/IEC FDIS 10118-3</title>
|
231
|
-
<place>Serie's place</place>
|
232
|
-
<organization>Serie's organization</organization>
|
233
|
-
<abbreviation language=\"en\" script=\"Latn\">ABVR</abbreviation>
|
234
|
-
<from>2009-02-01</from>
|
235
|
-
<to>2010-12-20</to>
|
236
|
-
<number>serie1234</number>
|
237
|
-
<partnumber>part5678</partnumber>
|
238
|
-
</series>
|
239
|
-
<series type=\"alt\">
|
240
|
-
<formattedref language=\"en\" script=\"Latn\">serieref</formattedref>
|
241
|
-
</series>
|
242
|
-
<medium>
|
243
|
-
<form>medium form</form>
|
244
|
-
<size>medium size</size>
|
245
|
-
<scale>medium scale</scale>
|
246
|
-
</medium>
|
247
|
-
<place>bib place</place>
|
248
|
-
<locality type=\"section\">
|
249
|
-
<referenceFrom>Reference from</referenceFrom>
|
250
|
-
<referenceTo>Reference to</referenceTo>
|
251
|
-
</locality>
|
252
|
-
<accesslocation>accesslocation1</accesslocation>
|
253
|
-
<accesslocation>accesslocation2</accesslocation>
|
254
|
-
<classification type=\"type\">value</classification>
|
255
|
-
<validity>
|
256
|
-
<validityBegins>2010-10-10 12:21</validityBegins>
|
257
|
-
<validityEnds>2011-02-03 18:30</validityEnds>
|
258
|
-
<validityRevision>2011-03-04 09:00</validityRevision>
|
259
|
-
</validity>
|
272
|
+
...
|
260
273
|
</bibitem>"
|
261
274
|
----
|
275
|
+
|
262
276
|
Default root element is `bibitem`. With argument `bibdata: true` the XML wrapped with `bibdata` element.
|
263
277
|
[source,ruby]
|
278
|
+
|
264
279
|
----
|
265
280
|
item.to_xml
|
266
281
|
=> "<bibitem id=\"ISO/TC211\" type=\"standard\">
|
@@ -269,20 +284,18 @@ item.to_xml
|
|
269
284
|
...
|
270
285
|
</bibdata>"
|
271
286
|
----
|
287
|
+
|
272
288
|
==== Date format
|
289
|
+
|
273
290
|
By default date elements are formatted as year (yyyy). Option `:date_format` allows to output date elements in `:short` (yyyy-mm) and `:full` (yyyy-mm-dd) additiona formats.
|
274
291
|
[surce,ruby]
|
292
|
+
|
275
293
|
----
|
276
294
|
item.to_xml date_format: :short
|
277
295
|
=> "<bibitem id=\"ISO/TC211\" type=\"standard\">
|
278
296
|
<fetched>2019-04-30</fetched>
|
279
297
|
<title type=\"main\" language=\"en\" script=\"Latn\">Geographic information</title>
|
280
|
-
|
281
|
-
<uri type=\"src\">https://www.iso.org/standard/53798.html</uri>
|
282
|
-
<uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:53798:en</uri>
|
283
|
-
<uri type=\"rss\">https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</uri>
|
284
|
-
<docidentifier type=\"ISO\">TC211</docidentifier>
|
285
|
-
<docnumber>123456</docnumber>
|
298
|
+
...
|
286
299
|
<date type="issued">
|
287
300
|
<on>2014-01</on>
|
288
301
|
</date>
|
@@ -308,7 +321,9 @@ item.to_xml date_format: :full
|
|
308
321
|
</date>
|
309
322
|
...
|
310
323
|
----
|
324
|
+
|
311
325
|
=== Create bibliographic item form YAML
|
326
|
+
|
312
327
|
[source,ruby]
|
313
328
|
----
|
314
329
|
hash = YAML.load_file 'spec/examples/bib_item.yml'
|
@@ -324,6 +339,40 @@ RelatonBib::BibliographicItem.new bib_hash
|
|
324
339
|
...
|
325
340
|
----
|
326
341
|
|
342
|
+
=== Export bibliographic item to Hash
|
343
|
+
|
344
|
+
[source,ruby]
|
345
|
+
----
|
346
|
+
item.to_hash
|
347
|
+
=> {"id"=>"ISOTC211",
|
348
|
+
"title"=>
|
349
|
+
[{"type"=>"main", "content"=>"Geographic information", "language"=>"en", "script"=>"Latn", "format"=>"text/plain"},
|
350
|
+
{"content"=>"Information géographique", "language"=>"fr", "script"=>"Latn", "format"=>"text/plain"}],
|
351
|
+
...
|
352
|
+
----
|
353
|
+
|
354
|
+
=== Create bibliographic item from BibTeX
|
355
|
+
|
356
|
+
[source,ruby]
|
357
|
+
----
|
358
|
+
RelatonBib::BibtexParser.from_bibtex File.read('spec/examples/bibitem.bib')
|
359
|
+
=> {"ISOTC211"=>
|
360
|
+
#<RelatonBib::BibliographicItem:0x007fedee0a2ab0
|
361
|
+
...
|
362
|
+
----
|
363
|
+
|
364
|
+
=== Export bibliographic item to BibTeX
|
365
|
+
|
366
|
+
[source,ruby]
|
367
|
+
----
|
368
|
+
item.to_bibtex
|
369
|
+
@misc{ISOTC211,
|
370
|
+
tile = {Geographic information},
|
371
|
+
edition = {1},
|
372
|
+
author = {Bierman, A. and Bierman, Forename},
|
373
|
+
...
|
374
|
+
----
|
375
|
+
|
327
376
|
== Development
|
328
377
|
|
329
378
|
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.
|