relaton-bib 1.4.0 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/integration-tests.yml +54 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +24 -0
- data/.gitignore +4 -1
- data/.rubocop.yml +3 -1
- data/CLAUDE.md +108 -0
- data/Gemfile +11 -0
- data/README.adoc +229 -314
- data/bin/console +1 -1
- data/docs/hash.adoc +132 -83
- data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
- data/lib/relaton/bib/converter/asciibib.rb +13 -0
- data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
- data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
- data/lib/relaton/bib/converter/bibtex.rb +23 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +386 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +308 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
- data/lib/relaton/bib/converter/bibxml.rb +51 -0
- data/lib/relaton/bib/hash_parser_v1.rb +767 -0
- data/lib/relaton/bib/item_data.rb +229 -0
- data/lib/relaton/bib/model/abstract.rb +16 -0
- data/lib/relaton/bib/model/address.rb +22 -0
- data/lib/relaton/bib/model/affiliation.rb +16 -0
- data/lib/relaton/bib/model/bibdata.rb +9 -0
- data/lib/relaton/bib/model/bibdata_shared.rb +10 -0
- data/lib/relaton/bib/model/bibitem.rb +9 -0
- data/lib/relaton/bib/model/bibitem_shared.rb +10 -0
- data/lib/relaton/bib/model/contact.rb +14 -0
- data/lib/relaton/bib/model/contribution_info.rb +16 -0
- data/lib/relaton/bib/model/contributor.rb +29 -0
- data/lib/relaton/bib/model/copyright.rb +27 -0
- data/lib/relaton/bib/model/date.rb +29 -0
- data/lib/relaton/bib/model/depiction.rb +16 -0
- data/lib/relaton/bib/model/docidentifier.rb +34 -0
- data/lib/relaton/bib/model/doctype.rb +14 -0
- data/lib/relaton/bib/model/edition.rb +14 -0
- data/lib/relaton/bib/model/ext.rb +35 -0
- data/lib/relaton/bib/model/extent.rb +16 -0
- data/lib/relaton/bib/model/formattedref.rb +43 -0
- data/lib/relaton/bib/model/full_name_type.rb +64 -0
- data/lib/relaton/bib/model/fullname.rb +11 -0
- data/lib/relaton/bib/model/ics.rb +49 -0
- data/lib/relaton/bib/model/image.rb +28 -0
- data/lib/relaton/bib/model/item.rb +44 -0
- data/lib/relaton/bib/model/item_base.rb +20 -0
- data/lib/relaton/bib/model/item_shared.rb +88 -0
- data/lib/relaton/bib/model/keyword.rb +30 -0
- data/lib/relaton/bib/model/locality.rb +18 -0
- data/lib/relaton/bib/model/locality_stack.rb +14 -0
- data/lib/relaton/bib/model/localized_string.rb +48 -0
- data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
- data/lib/relaton/bib/model/logo.rb +14 -0
- data/lib/relaton/bib/model/medium.rb +22 -0
- data/lib/relaton/bib/model/note.rb +16 -0
- data/lib/relaton/bib/model/organization.rb +11 -0
- data/lib/relaton/bib/model/organization_type.rb +40 -0
- data/lib/relaton/bib/model/person.rb +36 -0
- data/lib/relaton/bib/model/phone.rb +14 -0
- data/lib/relaton/bib/model/place.rb +33 -0
- data/lib/relaton/bib/model/price.rb +14 -0
- data/lib/relaton/bib/model/relation.rb +41 -0
- data/lib/relaton/bib/model/series.rb +32 -0
- data/lib/relaton/bib/model/size.rb +23 -0
- data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
- data/lib/relaton/bib/model/status.rb +27 -0
- data/lib/relaton/bib/model/structured_identifier.rb +48 -0
- data/lib/relaton/bib/model/subdivision.rb +16 -0
- data/lib/relaton/bib/model/title.rb +56 -0
- data/lib/relaton/bib/model/type/plain_date.rb +16 -0
- data/lib/relaton/bib/model/type/string_date.rb +48 -0
- data/lib/relaton/bib/model/uri.rb +18 -0
- data/lib/relaton/bib/model/validity.rb +16 -0
- data/lib/relaton/bib/model/version.rb +43 -0
- data/lib/relaton/bib/model_autoload.rb +85 -0
- data/lib/relaton/bib/namespace_helper.rb +21 -0
- data/lib/relaton/bib/sanitizer.rb +74 -0
- data/lib/relaton/bib/util.rb +18 -0
- data/lib/relaton/bib/version.rb +5 -0
- data/lib/relaton/bib/versions.json +35 -0
- data/lib/relaton/bib.rb +41 -0
- data/relaton-bib.gemspec +12 -16
- metadata +118 -129
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -39
- data/.github/workflows/windows.yml +0 -41
- data/grammars/basicdoc.rng +0 -986
- data/grammars/biblio.rng +0 -1237
- data/grammars/isodoc.rng +0 -1613
- data/grammars/reqt.rng +0 -165
- data/lib/relaton_bib/bib_item_locality.rb +0 -107
- data/lib/relaton_bib/biblio_note.rb +0 -44
- data/lib/relaton_bib/biblio_version.rb +0 -49
- data/lib/relaton_bib/bibliographic_date.rb +0 -90
- data/lib/relaton_bib/bibliographic_item.rb +0 -726
- data/lib/relaton_bib/bibtex_parser.rb +0 -245
- data/lib/relaton_bib/classification.rb +0 -40
- data/lib/relaton_bib/contribution_info.rb +0 -109
- data/lib/relaton_bib/contributor.rb +0 -215
- data/lib/relaton_bib/copyright_association.rb +0 -77
- data/lib/relaton_bib/deep_dup.rb +0 -30
- data/lib/relaton_bib/document_identifier.rb +0 -95
- data/lib/relaton_bib/document_relation.rb +0 -94
- data/lib/relaton_bib/document_relation_collection.rb +0 -46
- data/lib/relaton_bib/document_status.rb +0 -93
- data/lib/relaton_bib/editorial_group.rb +0 -41
- data/lib/relaton_bib/formatted_ref.rb +0 -17
- data/lib/relaton_bib/formatted_string.rb +0 -55
- data/lib/relaton_bib/hash_converter.rb +0 -497
- data/lib/relaton_bib/hit.rb +0 -46
- data/lib/relaton_bib/hit_collection.rb +0 -73
- data/lib/relaton_bib/ics.rb +0 -37
- data/lib/relaton_bib/localized_string.rb +0 -93
- data/lib/relaton_bib/medium.rb +0 -44
- data/lib/relaton_bib/organization.rb +0 -135
- data/lib/relaton_bib/person.rb +0 -206
- data/lib/relaton_bib/place.rb +0 -49
- data/lib/relaton_bib/series.rb +0 -134
- data/lib/relaton_bib/structured_identifier.rb +0 -171
- data/lib/relaton_bib/technical_committee.rb +0 -36
- data/lib/relaton_bib/typed_title_string.rb +0 -96
- data/lib/relaton_bib/typed_uri.rb +0 -47
- data/lib/relaton_bib/validity.rb +0 -52
- data/lib/relaton_bib/version.rb +0 -3
- data/lib/relaton_bib/workers_pool.rb +0 -43
- data/lib/relaton_bib/workgroup.rb +0 -46
- data/lib/relaton_bib/xml_parser.rb +0 -463
- data/lib/relaton_bib.rb +0 -44
data/README.adoc
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
=
|
|
1
|
+
= Relaton::Bib
|
|
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://github.com/relaton/relaton-bib/workflows/
|
|
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"]
|
|
4
|
+
image:https://github.com/relaton/relaton-bib/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton-bib/actions?workflow=rake"]
|
|
7
5
|
image:https://codeclimate.com/github/relaton/relaton-bib/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-bib"]
|
|
8
6
|
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bib.svg["Pull Requests", link="https://github.com/relaton/relaton-bib/pulls"]
|
|
9
7
|
image:https://img.shields.io/github/commits-since/relaton/relaton-bib/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bib/releases"]
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
Relaton::Bib is a Ruby gem that implements the https://github.com/metanorma/relaton-models#bibliography-uml-models[BibliographicItem model].
|
|
12
10
|
|
|
13
11
|
== Installation
|
|
14
12
|
|
|
@@ -29,254 +27,93 @@ Or install it yourself as:
|
|
|
29
27
|
|
|
30
28
|
== Usage
|
|
31
29
|
|
|
30
|
+
[source,ruby]
|
|
31
|
+
----
|
|
32
|
+
require 'relaton/bib'
|
|
33
|
+
=> true
|
|
34
|
+
----
|
|
35
|
+
|
|
32
36
|
=== Create bibliographic item
|
|
33
37
|
|
|
34
38
|
[source,ruby]
|
|
35
39
|
----
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
type: "standard",
|
|
45
|
-
docid: [
|
|
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"),
|
|
50
|
-
],
|
|
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
|
-
),
|
|
64
|
-
date: [
|
|
65
|
-
{ type: "issued", on: "2014" },
|
|
66
|
-
{ type: "published", on: "2014-04" },
|
|
67
|
-
{ type: "accessed", on: "2015-05-20" },
|
|
68
|
-
],
|
|
69
|
-
abstract: [
|
|
70
|
-
{ content: "ISO 19115-1:2014 defines the schema required for ...",
|
|
71
|
-
language: "en", script: "Latn", format: "text/plain" },
|
|
72
|
-
{ content: "L'ISO 19115-1:2014 définit le schéma requis pour ...",
|
|
73
|
-
language: "fr", script: "Latn", format: "text/plain" },
|
|
74
|
-
],
|
|
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"] }],
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
entity: RelatonBib::Person.new(
|
|
85
|
-
name: RelatonBib::FullName.new(
|
|
86
|
-
completename: RelatonBib::LocalizedString.new("A. Bierman", "en"),
|
|
87
|
-
),
|
|
88
|
-
affiliation: [RelatonBib::Affiliation.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::Affiliation.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: [{
|
|
140
|
-
owner: [{
|
|
141
|
-
name: "International Organization for Standardization",
|
|
142
|
-
abbreviation: "ISO", url: "www.iso.org"
|
|
143
|
-
}],
|
|
144
|
-
from: "2014", to: "2020"
|
|
145
|
-
}],
|
|
146
|
-
link: [
|
|
147
|
-
{ type: "src", content: "https://www.iso.org/standard/53798.html" },
|
|
148
|
-
{ type: "obp",
|
|
149
|
-
content: "https://www.iso.org/obp/ui/#!iso:std:53798:en" },
|
|
150
|
-
{ type: "rss", content: "https://www.iso.org/contents/data/standard"\
|
|
151
|
-
"/05/37/53798.detail.rss" },
|
|
152
|
-
{ type: "doi", content: "http://standrd.org/doi-123" },
|
|
153
|
-
{ type: "file", content: "file://path/file" },
|
|
154
|
-
],
|
|
155
|
-
relation: [
|
|
156
|
-
{
|
|
157
|
-
type: "updates",
|
|
158
|
-
bibitem: RelatonBib::BibliographicItem.new(
|
|
159
|
-
formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003"),
|
|
160
|
-
),
|
|
161
|
-
locality: [
|
|
162
|
-
RelatonBib::LocalityStack.new([
|
|
163
|
-
RelatonBib::Locality.new("volume", "1"),
|
|
164
|
-
RelatonBib::Locality.new("section", "2"),
|
|
165
|
-
]),
|
|
166
|
-
],
|
|
167
|
-
source_locality: [
|
|
168
|
-
RelatonBib::SourceLocalityStack.new([
|
|
169
|
-
RelatonBib::SourceLocality.new("chapter", "4"),
|
|
170
|
-
]),
|
|
171
|
-
],
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
type: "updates",
|
|
175
|
-
bibitem: RelatonBib::BibliographicItem.new(
|
|
176
|
-
type: "standard",
|
|
177
|
-
formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003/Cor 1:2006"),
|
|
178
|
-
),
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
type: "partOf",
|
|
182
|
-
bibitem: RelatonBib::BibliographicItem.new(
|
|
183
|
-
title: [RelatonBib::TypedTitleString.new(type: "main", content: "Book title")],
|
|
184
|
-
),
|
|
185
|
-
},
|
|
186
|
-
],
|
|
187
|
-
series: [
|
|
188
|
-
RelatonBib::Series.new(
|
|
189
|
-
type: "main",
|
|
190
|
-
title: RelatonBib::TypedTitleString.new(
|
|
191
|
-
type: "original", content: "ISO/IEC FDIS 10118-3", language: "en",
|
|
192
|
-
script: "Latn", format: "text/plain",
|
|
193
|
-
),
|
|
194
|
-
place: "Serie's place",
|
|
195
|
-
organization: "Serie's organization",
|
|
196
|
-
abbreviation: RelatonBib::LocalizedString.new("ABVR"),
|
|
197
|
-
from: "2009-02-01",
|
|
198
|
-
to: "2010-12-20",
|
|
199
|
-
number: "serie1234",
|
|
200
|
-
partnumber: "part5678",
|
|
201
|
-
),
|
|
202
|
-
RelatonBib::Series.new(
|
|
203
|
-
type: "alt",
|
|
204
|
-
formattedref: RelatonBib::FormattedRef.new(
|
|
205
|
-
content: "serieref", language: "en", script: "Latn",
|
|
206
|
-
),
|
|
207
|
-
),
|
|
208
|
-
RelatonBib::Series.new(
|
|
209
|
-
type: "journal", title: RelatonBib::TypedTitleString.new(content: "Journal"), number: "7"
|
|
210
|
-
),
|
|
211
|
-
RelatonBib::Series.new(title: RelatonBib::TypedTitleString.new(content: "Series")),
|
|
212
|
-
],
|
|
213
|
-
medium: RelatonBib::Medium.new(
|
|
214
|
-
form: "medium form", size: "medium size", scale: "medium scale",
|
|
215
|
-
),
|
|
216
|
-
place: [
|
|
217
|
-
"bib place",
|
|
218
|
-
RelatonBib::Place.new(name: "Geneva", uri: "geneva.place", region: "Switzelznd")
|
|
219
|
-
],
|
|
220
|
-
extent: [
|
|
221
|
-
RelatonBib::BibItemLocality.new("section", "Reference from", "Reference to"),
|
|
222
|
-
RelatonBib::BibItemLocality.new("chapter", "4"),
|
|
223
|
-
RelatonBib::BibItemLocality.new("page", "10", "20"),
|
|
224
|
-
RelatonBib::BibItemLocality.new("volume", "1"),
|
|
225
|
-
],
|
|
226
|
-
accesslocation: ["accesslocation1", "accesslocation2"],
|
|
227
|
-
classification: [
|
|
228
|
-
RelatonBib::Classification.new(type: "type", value: "value"),
|
|
229
|
-
RelatonBib::Classification.new(type: "keyword", value: "Keywords"),
|
|
230
|
-
RelatonBib::Classification.new(type: "mendeley", value: "Mendeley Tags"),
|
|
231
|
-
],
|
|
232
|
-
validity: RelatonBib::Validity.new(
|
|
233
|
-
begins: Time.new(2010, 10, 10, 12, 21),
|
|
234
|
-
ends: Time.new(2011, 2, 3, 18,30),
|
|
235
|
-
revision: Time.new(2011, 3, 4, 9, 0),
|
|
236
|
-
)
|
|
237
|
-
)
|
|
238
|
-
|
|
239
|
-
=> #<RelatonBib::BibliographicItem:0x007fc8b6c796c0
|
|
240
|
-
@abstract=
|
|
241
|
-
[#<RelatonBib::FormattedString:0x007fc8b6c726b8 @content="ISO 19115-1:2014 defines the schema required for ...", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
|
242
|
-
----
|
|
243
|
-
|
|
244
|
-
=== BibliographicItem Typed Title Strings
|
|
40
|
+
yaml = File.read 'spec/fixtures/item.yaml'
|
|
41
|
+
=> "id: ISO1231994\ntype: standard\nschema_version: 1.0.0\nfetched: \"2022-05-02\"\nformattedref: ISO 123:1994\ntitle..."
|
|
42
|
+
|
|
43
|
+
item = Relaton::Bib::Item.from_yaml yaml
|
|
44
|
+
=> #<Relaton::Bib::ItemData:0x000000012838bfc0 ...
|
|
45
|
+
----
|
|
46
|
+
|
|
47
|
+
=== Title
|
|
245
48
|
|
|
246
49
|
[source,ruby]
|
|
247
50
|
----
|
|
248
51
|
item.title
|
|
249
|
-
=> [#<
|
|
250
|
-
@
|
|
251
|
-
@
|
|
252
|
-
|
|
253
|
-
@
|
|
52
|
+
=> [#<Relaton::Bib::Title:0x00000001270a6810
|
|
53
|
+
@content="Geographic information -- Metadata",
|
|
54
|
+
@format=nil,
|
|
55
|
+
@language="en",
|
|
56
|
+
@locale="en-US",
|
|
57
|
+
@script="Latn",
|
|
58
|
+
@type=nil>,
|
|
59
|
+
#<Relaton::Bib::Title:0x00000001270a5cd0
|
|
60
|
+
@content="Information géographique -- Métadonnées",
|
|
61
|
+
@format=nil,
|
|
62
|
+
@language="fr",
|
|
63
|
+
@locale="fr-FR",
|
|
64
|
+
@script="Latn",
|
|
254
65
|
@type=nil>]
|
|
255
66
|
|
|
256
|
-
item.title
|
|
257
|
-
=> [#<
|
|
258
|
-
@
|
|
67
|
+
item.title "fr"
|
|
68
|
+
=> [#<Relaton::Bib::Title:0x00000001270a5cd0
|
|
69
|
+
@content="Information géographique -- Métadonnées",
|
|
70
|
+
@format=nil,
|
|
71
|
+
@language="fr",
|
|
72
|
+
@locale="fr-FR",
|
|
73
|
+
@script="Latn",
|
|
259
74
|
@type=nil>]
|
|
260
75
|
----
|
|
261
76
|
|
|
262
|
-
===
|
|
77
|
+
=== Abstract
|
|
263
78
|
|
|
264
79
|
[source,ruby]
|
|
265
80
|
----
|
|
266
81
|
item.abstract
|
|
267
|
-
=> [#<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
82
|
+
=> [#<Relaton::Bib::LocalizedMarkedUpString:0x0000000126c05748
|
|
83
|
+
@content="This is an abstract. <em>This is emphasized</em>",
|
|
84
|
+
@language="en",
|
|
85
|
+
@locale="en-US",
|
|
86
|
+
@script="Latn">]
|
|
87
|
+
|
|
88
|
+
item.abstract("en")
|
|
89
|
+
=> [#<Relaton::Bib::LocalizedMarkedUpString:0x0000000126c05748
|
|
90
|
+
@content="This is an abstract. <em>This is emphasized</em>",
|
|
91
|
+
@language="en",
|
|
92
|
+
@locale="en-US",
|
|
93
|
+
@script="Latn">]
|
|
272
94
|
----
|
|
273
95
|
|
|
274
|
-
===
|
|
96
|
+
=== Document identifier
|
|
275
97
|
|
|
276
98
|
[source,ruby]
|
|
277
99
|
----
|
|
278
|
-
item.
|
|
279
|
-
=>
|
|
100
|
+
item.docidentifier
|
|
101
|
+
=> [#<Relaton::Bib::Docidentifier:0x00000001270a4b00
|
|
102
|
+
@content="ISO 123:1994",
|
|
103
|
+
@language="en",
|
|
104
|
+
@locale="en-US",
|
|
105
|
+
@primary=true,
|
|
106
|
+
@scope="global",
|
|
107
|
+
@script="Latn",
|
|
108
|
+
@type="ISO">,
|
|
109
|
+
#<Relaton::Bib::Docidentifier:0x00000001270a46a0
|
|
110
|
+
@content="10.1007/978-3-319-99155-2_1",
|
|
111
|
+
@language=nil,
|
|
112
|
+
@locale=nil,
|
|
113
|
+
@primary=nil,
|
|
114
|
+
@scope=nil,
|
|
115
|
+
@script=nil,
|
|
116
|
+
@type="DOI">]
|
|
280
117
|
----
|
|
281
118
|
|
|
282
119
|
=== XML serialization
|
|
@@ -284,114 +121,116 @@ item.shortref item.docidentifier.first
|
|
|
284
121
|
[source,ruby]
|
|
285
122
|
----
|
|
286
123
|
item.to_xml
|
|
287
|
-
=> "<bibitem id="
|
|
288
|
-
<fetched>
|
|
289
|
-
<
|
|
290
|
-
<title language="
|
|
124
|
+
=> "<bibitem id="ISO1231994" type="standard" schema-version="1.0.0">
|
|
125
|
+
<fetched>2022-05-02</fetched>
|
|
126
|
+
<formattedref>ISO 123:1994</formattedref>
|
|
127
|
+
<title language="en" locale="en-US" script="Latn">Geographic information -- Metadata</title>
|
|
128
|
+
<title language="fr" locale="fr-FR" script="Latn">Information géographique -- Métadonnées</title>
|
|
129
|
+
<uri type="src">https://www.iso.org/standard/22722.html</uri>
|
|
130
|
+
<uri type="doi">10.1007/978-3-319-99155-2_1</uri>
|
|
291
131
|
...
|
|
292
132
|
</bibitem>"
|
|
293
133
|
----
|
|
294
134
|
|
|
295
|
-
|
|
135
|
+
The default root element is `bibitem`. With argument `bibdata: true` the XML wrapped with `bibdata` element.
|
|
296
136
|
|
|
297
137
|
[source,ruby]
|
|
298
138
|
----
|
|
299
139
|
item.to_xml bibdata: true
|
|
300
|
-
=> "<bibdata type="standard">
|
|
301
|
-
<fetched>
|
|
302
|
-
<
|
|
140
|
+
=> "<bibdata type="standard" schema-version="1.0.0">
|
|
141
|
+
<fetched>2022-05-02</fetched>
|
|
142
|
+
<formattedref>ISO 123:1994</formattedref>
|
|
143
|
+
<title language="en" locale="en-US" script="Latn">Geographic information -- Metadata</title>
|
|
303
144
|
...
|
|
145
|
+
<ext schema-version="1.0.0">
|
|
146
|
+
<doctype abbreviation="std">Standard</doctype>
|
|
147
|
+
<subdoctype>Technical Report</subdoctype>
|
|
148
|
+
...
|
|
149
|
+
</ext>
|
|
304
150
|
</bibdata>"
|
|
305
151
|
----
|
|
306
152
|
|
|
307
|
-
====
|
|
308
|
-
|
|
309
|
-
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.
|
|
153
|
+
==== Adding notes
|
|
310
154
|
|
|
311
155
|
[source,ruby]
|
|
312
156
|
----
|
|
313
|
-
item.to_xml
|
|
314
|
-
=> "<bibitem id="
|
|
315
|
-
<fetched>2019-04-30</fetched>
|
|
316
|
-
<title type="main" language="en" script="Latn">Geographic information</title>
|
|
317
|
-
...
|
|
318
|
-
<date type="issued">
|
|
319
|
-
<on>2014-01</on>
|
|
320
|
-
</date>
|
|
321
|
-
<date type="published">
|
|
322
|
-
<on>2014-04</on>
|
|
323
|
-
</date>
|
|
324
|
-
<date type="accessed">
|
|
325
|
-
<on>2015-05</on>
|
|
326
|
-
</date>
|
|
327
|
-
...
|
|
328
|
-
</bibitem>"
|
|
329
|
-
|
|
330
|
-
item.to_xml date_format: :full
|
|
331
|
-
=> "<bibitem id="ISO/TC211" type="standard">
|
|
157
|
+
item.to_xml note: [{ content: "Note", type: "note" }]
|
|
158
|
+
=> "<bibitem id="ISO1231994" type="standard" schema-version="1.0.0">
|
|
332
159
|
...
|
|
333
|
-
<
|
|
334
|
-
<on>2014-01-01</on>
|
|
335
|
-
</date>
|
|
336
|
-
<date type="published">
|
|
337
|
-
<on>2014-04-01</on>
|
|
338
|
-
</date>
|
|
339
|
-
<date type="accessed">
|
|
340
|
-
<on>2015-05-20</on>
|
|
341
|
-
</date>
|
|
160
|
+
<note type="note">Note</note>
|
|
342
161
|
...
|
|
343
162
|
</bibitem>"
|
|
344
163
|
----
|
|
345
164
|
|
|
346
|
-
|
|
165
|
+
=== Create bibliographic item form YAML
|
|
347
166
|
|
|
348
167
|
[source,ruby]
|
|
349
168
|
----
|
|
350
|
-
|
|
351
|
-
=>"
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
</bibitem>"
|
|
169
|
+
yaml = File.read 'spec/fixtures/item.yaml'
|
|
170
|
+
=> "id: ISO1231994\ntype: standard\nschema_version: 1.0.0\nfetched: \"2022-05-02\"\nformattedref: ISO 123:1994\ntitle..."
|
|
171
|
+
|
|
172
|
+
Relaton::Bib::Item.from_yaml yaml
|
|
173
|
+
=> #<Relaton::Bib::ItemData:0x000000011dc9e118 ...
|
|
356
174
|
----
|
|
357
175
|
|
|
358
|
-
=== Create bibliographic item
|
|
176
|
+
=== Create bibliographic item from RFC XML
|
|
359
177
|
|
|
360
178
|
[source,ruby]
|
|
361
179
|
----
|
|
362
|
-
|
|
363
|
-
=>
|
|
364
|
-
...
|
|
180
|
+
xml = File.read 'spec/fixtures/rfc.xml'
|
|
181
|
+
=> "<reference anchor=\"RFC1\" target=\"10.17487/RFC0001\">\n <front>\n <title>Title RFC1</title>\n <seriesInf..."
|
|
365
182
|
|
|
366
|
-
|
|
367
|
-
=>
|
|
368
|
-
|
|
183
|
+
Relaton::Bib::Converter::BibXml.to_item xml
|
|
184
|
+
=> #<Relaton::Bib::ItemData:0x000000011dc9fc98 ...
|
|
185
|
+
----
|
|
369
186
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
...
|
|
187
|
+
=== Create bibliographic item from XML
|
|
188
|
+
[source,ruby]
|
|
373
189
|
----
|
|
190
|
+
xml = File.read 'spec/fixtures/bibitem.xml'
|
|
191
|
+
=> "<bibitem id=\"ISO1231994\" type=\"standard\" schema-version=\"1.0.0\">\n <fetched>2022-05-02</fetched>\n <forma..."
|
|
374
192
|
|
|
375
|
-
|
|
193
|
+
item = Relaton::Bib::Bibitem.from_xml xml
|
|
194
|
+
=> #<Relaton::Bib::ItemData:0x000000011d4b7580 ...
|
|
195
|
+
|
|
196
|
+
xml = File.read 'spec/fixtures/bibdata.xml'
|
|
197
|
+
item = Relaton::Bib::Bibdata.from_xml xml
|
|
198
|
+
=> #<Relaton::Bib::ItemData:0x000000011d4daa08 ...
|
|
199
|
+
----
|
|
200
|
+
|
|
201
|
+
=== Create bibliographic item from BibTeX (@TODO: add support for BibTeX)
|
|
376
202
|
|
|
377
203
|
[source,ruby]
|
|
378
204
|
----
|
|
379
|
-
|
|
380
|
-
=> {"
|
|
381
|
-
|
|
382
|
-
[{"type"=>"main", "content"=>"Geographic information", "language"=>"en", "script"=>"Latn", "format"=>"text/plain"},
|
|
383
|
-
{"content"=>"Information géographique", "language"=>"fr", "script"=>"Latn", "format"=>"text/plain"}],
|
|
205
|
+
Relaton::Bib::BibtexParser.from_bibtex File.read('spec/fixtures/techreport.bib')
|
|
206
|
+
=> {"ISOTC211"=>
|
|
207
|
+
#<Relaton::Bib::Item:0x007fedee0a2ab0
|
|
384
208
|
...
|
|
385
209
|
----
|
|
386
210
|
|
|
387
|
-
===
|
|
211
|
+
=== Export bibliographic item to YAML
|
|
388
212
|
|
|
389
213
|
[source,ruby]
|
|
390
214
|
----
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
215
|
+
item.to_yaml
|
|
216
|
+
---
|
|
217
|
+
type: standard
|
|
218
|
+
schema_version: 1.0.0
|
|
219
|
+
fetched: '2022-05-02'
|
|
220
|
+
formattedref: ISO 123:1994
|
|
221
|
+
...
|
|
222
|
+
----
|
|
223
|
+
|
|
224
|
+
=== Export bibliographic item to Hash
|
|
225
|
+
|
|
226
|
+
[source,ruby]
|
|
227
|
+
----
|
|
228
|
+
item.to_h
|
|
229
|
+
=> {"id"=>"ISO1231994",
|
|
230
|
+
"type"=>"standard",
|
|
231
|
+
"schema_version"=>"...",
|
|
232
|
+
"title"=>[...],
|
|
233
|
+
...}
|
|
395
234
|
----
|
|
396
235
|
|
|
397
236
|
=== Export bibliographic item to BibTeX
|
|
@@ -399,29 +238,106 @@ RelatonBib::BibtexParser.from_bibtex File.read('spec/examples/techreport.bib')
|
|
|
399
238
|
[source,ruby]
|
|
400
239
|
----
|
|
401
240
|
item.to_bibtex
|
|
402
|
-
@misc{
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
241
|
+
@misc{doe1994a,
|
|
242
|
+
title = {Geographic information -- Metadata},
|
|
243
|
+
author = {Doe, John},
|
|
244
|
+
edition = {First edition},
|
|
245
|
+
publisher = {International Organization for Standardization},
|
|
246
|
+
year = {1994},
|
|
247
|
+
month = {jan},
|
|
248
|
+
address = {Geneva, Switzerland, Geneva, Geneva},
|
|
249
|
+
pages = {1--10},
|
|
250
|
+
keywords = {information},
|
|
251
|
+
timestamp = {2022-05-02},
|
|
252
|
+
url = {https://www.iso.org/standard/22722.html},
|
|
253
|
+
doi = {10.1007/978-3-319-99155-2_1},
|
|
254
|
+
month_numeric = {1}
|
|
255
|
+
}
|
|
407
256
|
----
|
|
408
257
|
|
|
409
|
-
===
|
|
258
|
+
=== Export bibliographic item to Citeproc (@TODO: add support for Citeproc)
|
|
259
|
+
|
|
260
|
+
[source,ruby]
|
|
261
|
+
----
|
|
262
|
+
item.to_citeproc
|
|
263
|
+
=> [{"title"=>"Geographic information",
|
|
264
|
+
"edition"=>"Edition 1",
|
|
265
|
+
"author"=>[{"family"=>"Bierman", "given"=>"A."}, {"family"=>"Bierman", "given"=>"Arnold"}, {"family"=>"Bierman", "given"=>"Arnold B"}],
|
|
266
|
+
"publisher"=>"Institute of Electrical and Electronics Engineers",
|
|
267
|
+
"publisher-place"=>"bib place",
|
|
268
|
+
...
|
|
269
|
+
----
|
|
270
|
+
|
|
271
|
+
=== Exporting bibliographic item to AsciiBib (@TODO: add support for AsciiBib)
|
|
410
272
|
|
|
411
273
|
[source,ruby]
|
|
412
274
|
----
|
|
413
275
|
item.to_asciibib
|
|
414
|
-
[%bibitem]
|
|
415
|
-
== {blank}
|
|
416
|
-
id:: ISOTC211
|
|
417
|
-
fetched::
|
|
418
|
-
title::
|
|
419
|
-
title.type:: title-main
|
|
420
|
-
title.
|
|
421
|
-
title.format:: text/plain
|
|
422
|
-
...
|
|
276
|
+
=> [%bibitem]
|
|
277
|
+
== {blank}
|
|
278
|
+
id:: ISOTC211
|
|
279
|
+
fetched:: 2022-05-02
|
|
280
|
+
title::
|
|
281
|
+
title.type:: title-main
|
|
282
|
+
title.content:: Geographic information
|
|
283
|
+
title.format:: text/plain
|
|
284
|
+
...
|
|
423
285
|
----
|
|
424
286
|
|
|
287
|
+
=== Export bibliographic item to RFC XML
|
|
288
|
+
|
|
289
|
+
[source,ruby]
|
|
290
|
+
----
|
|
291
|
+
item.to_rfcxml
|
|
292
|
+
<reference anchor="ISO 123:1994" target="https://www.iso.org/standard/22722.html">
|
|
293
|
+
<front>
|
|
294
|
+
<title>Geographic information -- Metadata</title>
|
|
295
|
+
<seriesInfo name="DOI" value="10.1007/978-3-319-99155-2_1"/>
|
|
296
|
+
<seriesInfo name="ISO 123" value="1"/>
|
|
297
|
+
<author initials="J.D." surname="Doe" fullname="Prof. John Doe PhD">
|
|
298
|
+
<organization>International Organization for Standardization</organization>
|
|
299
|
+
<address>
|
|
300
|
+
<postal>
|
|
301
|
+
<street>1, rue de Varembé</street>
|
|
302
|
+
<city>Geneva</city>
|
|
303
|
+
<code>1211</code>
|
|
304
|
+
<country>Switzerland</country>
|
|
305
|
+
<postalLine>1, rue de Varembé,<br/>Geneva, Switzerland, 1211</postalLine>
|
|
306
|
+
</postal>
|
|
307
|
+
<phone>+41 22 749 01 11</phone>
|
|
308
|
+
<email>jdoe@email.org</email>
|
|
309
|
+
<uri>https://orcid.org/0000-0002-1825-0097</uri>
|
|
310
|
+
</address>
|
|
311
|
+
</author>
|
|
312
|
+
<author>
|
|
313
|
+
<organization abbrev="ISO">International Organization for Standardization</organization>
|
|
314
|
+
<address>
|
|
315
|
+
<postal>
|
|
316
|
+
<street>1, rue de Varembé</street>
|
|
317
|
+
<city>Geneva</city>
|
|
318
|
+
<code>1211</code>
|
|
319
|
+
<country>Switzerland</country>
|
|
320
|
+
<postalLine>1, rue de Varembé,<br/>Geneva, Switzerland, 1211</postalLine>
|
|
321
|
+
</postal>
|
|
322
|
+
<phone>+41 22 749 01 11</phone>
|
|
323
|
+
<email>office@iso.org</email>
|
|
324
|
+
<uri>https://www.iso.org</uri>
|
|
325
|
+
</address>
|
|
326
|
+
</author>
|
|
327
|
+
<date day="01" month="January" year="1994"></date>
|
|
328
|
+
<workgroup>Geographic information</workgroup>
|
|
329
|
+
<keyword>information</keyword>
|
|
330
|
+
<abstract>
|
|
331
|
+
<t>This is an abstract. <em>This is emphasized</em></t>
|
|
332
|
+
</abstract>
|
|
333
|
+
</front>
|
|
334
|
+
</reference>
|
|
335
|
+
----
|
|
336
|
+
|
|
337
|
+
=== Logging
|
|
338
|
+
|
|
339
|
+
RelatonBib uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
|
|
340
|
+
|
|
425
341
|
== Development
|
|
426
342
|
|
|
427
343
|
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.
|
|
@@ -435,4 +351,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/metano
|
|
|
435
351
|
== License
|
|
436
352
|
|
|
437
353
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
438
|
-
|
data/bin/console
CHANGED