relaton-bib 1.18.0 → 1.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +1 -1
- data/docs/hash.adoc +123 -91
- data/lib/relaton_bib/hash_converter.rb +10 -3
- data/lib/relaton_bib/renderer/bibxml.rb +12 -6
- data/lib/relaton_bib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 553a5db6c205eb58d6eb143ccb607b740a6e2a64520b8f1d46fb403294bbbadd
|
4
|
+
data.tar.gz: ce2a0d00f513a565c39f760c60cdf452bc3521b033f233a7c16b7e0beda9debe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f550ee510f6f7b7e854c3c1045397de858fe20451d6d1adee25fc8f0d63734303516ee8c6be2f34c994d400e192752e4f44d4abc28e820982b483157c48f6968
|
7
|
+
data.tar.gz: f0b2f2ee6dff9714c4310fe5318c0a5d42077b51112a8dc00a5c1dd6a654f13290341981e1a6abeb9e08cffe0cedffa90f6da3fe0901396c07faa3b87a3528fb
|
data/README.adoc
CHANGED
@@ -6,7 +6,7 @@ image:https://codeclimate.com/github/relaton/relaton-bib/badges/gpa.svg["Code Cl
|
|
6
6
|
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bib.svg["Pull Requests", link="https://github.com/relaton/relaton-bib/pulls"]
|
7
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"]
|
8
8
|
|
9
|
-
|
9
|
+
RelatonBib is a Ruby gem that implements the https://github.com/metanorma/relaton-models#bibliography-uml-models[BibliographicItem model].
|
10
10
|
|
11
11
|
== Installation
|
12
12
|
|
data/docs/hash.adoc
CHANGED
@@ -88,9 +88,12 @@ biblionote:
|
|
88
88
|
home run record in 1998.
|
89
89
|
# document status has stage, and optional substage and iteration
|
90
90
|
docstatus:
|
91
|
-
stage:
|
92
|
-
|
93
|
-
|
91
|
+
stage:
|
92
|
+
value: '30'
|
93
|
+
abbreviation: CD
|
94
|
+
substage:
|
95
|
+
value: '00'
|
96
|
+
iteration: final
|
94
97
|
# date is an array, with mandatory type, and either an "on" value or a "from" and optional "to" value
|
95
98
|
date:
|
96
99
|
- type: issued
|
@@ -112,27 +115,35 @@ abstract:
|
|
112
115
|
# contributors are an array of entity/role pairs, where entity is either person or organization.
|
113
116
|
# The role is an array of type and description; it can be a an array of just string, which are treated
|
114
117
|
# as the type.
|
115
|
-
# Organisations have attributes name, url, abbreviation, subdivision, contacts, identifiers
|
118
|
+
# Organisations have attributes name, url, abbreviation, subdivision, contacts, identifiers, logo.
|
116
119
|
# Persons have attributes name, affiliation, contacts
|
117
|
-
# Person names have attributes
|
118
|
-
# Given has formatted_initials or forename.
|
120
|
+
# Person names have attributes abbreviation, surname, completename, initials, forename, additions, prefixes.
|
119
121
|
# Initials, forename, additions, prefixes are arrays.
|
120
122
|
# Name field values are either strings, or hashes, with content and language and script attributes.
|
121
123
|
# The language and script attribute can also be given on the name.
|
122
124
|
# Contacts are an array, containing either addresses, or other fields.
|
123
125
|
# Addresses are identified as hashes containing a city attribute; they can also contain a street
|
124
126
|
# (which is an array), a postcode, a state, and a country. The other contact fields
|
125
|
-
# are phones, emails, uris; they contain a type
|
127
|
+
# are phones, emails, uris; they can contain a type.
|
126
128
|
# Affiliations are an array, and they contains an organization, and an optional description.
|
127
129
|
# The affiliation description can be a single string, or a hash of content, language, script, and format.
|
128
130
|
contributor:
|
129
131
|
- organization:
|
130
|
-
name:
|
131
|
-
content: International Organization for Standardization
|
132
|
+
name: International Organization for Standardization
|
132
133
|
url: www.iso.org
|
133
|
-
abbreviation:
|
134
|
-
content: ISO
|
134
|
+
abbreviation: ISO
|
135
135
|
subdivision: division
|
136
|
+
logo:
|
137
|
+
image:
|
138
|
+
id: logo1
|
139
|
+
src: logo1.png
|
140
|
+
mimetype: image/png
|
141
|
+
filename: logo1.png
|
142
|
+
height: "100%"
|
143
|
+
width: "200"
|
144
|
+
alt: Logo 1
|
145
|
+
title: "Logo #1"
|
146
|
+
longdesc: Logo number 1
|
136
147
|
role:
|
137
148
|
type: publisher
|
138
149
|
description: Publisher role
|
@@ -143,10 +154,8 @@ contributor:
|
|
143
154
|
language: en
|
144
155
|
affiliation:
|
145
156
|
- organization:
|
146
|
-
name:
|
147
|
-
|
148
|
-
abbreviation:
|
149
|
-
content: IETF
|
157
|
+
name: IETF
|
158
|
+
abbreviation: IETF
|
150
159
|
identifier:
|
151
160
|
- type: uri
|
152
161
|
id: www.ietf.org
|
@@ -160,12 +169,11 @@ contributor:
|
|
160
169
|
country: Country
|
161
170
|
state: State
|
162
171
|
- phone: '223322'
|
172
|
+
type: mobile
|
163
173
|
role: author
|
164
174
|
- organization:
|
165
|
-
name:
|
166
|
-
|
167
|
-
abbreviation:
|
168
|
-
content: IETF
|
175
|
+
name: IETF
|
176
|
+
abbreviation: IETF
|
169
177
|
identifier:
|
170
178
|
- type: uri
|
171
179
|
id: www.ietf.org
|
@@ -173,24 +181,19 @@ contributor:
|
|
173
181
|
publisher
|
174
182
|
- person:
|
175
183
|
name:
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
content: A.
|
182
|
-
surname:
|
183
|
-
content: Bierman
|
184
|
+
abbreviation: AB
|
185
|
+
language: en
|
186
|
+
initial:
|
187
|
+
- A.
|
188
|
+
surname: Bierman
|
184
189
|
affiliation:
|
185
|
-
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
language: en
|
193
|
-
script: Latn
|
190
|
+
- organization:
|
191
|
+
name: IETF
|
192
|
+
abbreviation: IETF
|
193
|
+
description:
|
194
|
+
content: Affiliation description
|
195
|
+
language: en
|
196
|
+
script: Latn
|
194
197
|
identifier:
|
195
198
|
- type: uri
|
196
199
|
id: www.person.com
|
@@ -200,10 +203,8 @@ contributor:
|
|
200
203
|
# a "from" date, and an optional "to" date
|
201
204
|
copyright:
|
202
205
|
owner:
|
203
|
-
name:
|
204
|
-
|
205
|
-
abbreviation:
|
206
|
-
content: ISO
|
206
|
+
name: International Organization for Standardization
|
207
|
+
abbreviation: ISO
|
207
208
|
url: www.iso.org
|
208
209
|
from: '2014'
|
209
210
|
to: '2020'
|
@@ -215,26 +216,45 @@ link:
|
|
215
216
|
content: https://www.iso.org/obp/ui/#!iso:std:53798:en
|
216
217
|
- type: rss
|
217
218
|
content: https://www.iso.org/contents/data/standard/05/37/53798.detail.rss
|
218
|
-
# relations are an array of type, bibitem, and
|
219
|
+
# relations are an array of type, bibitem, locality, source_locality, and description.
|
219
220
|
# bibitem contains any of the attributes of a bibliographic item.
|
220
|
-
#
|
221
|
+
# locality is an array of locality_stack which is an array of hash of type,
|
222
|
+
# reference_from, and optionally reference_to
|
223
|
+
# source_locality is an array of source_locality_stack which is similar to locality_stack
|
224
|
+
# description is optional and contains content and optional format, language, ans script.
|
221
225
|
relation:
|
222
226
|
- type: updates
|
223
227
|
bibitem:
|
224
|
-
formattedref:
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
228
|
+
formattedref: ISO 19115:2003
|
229
|
+
locality:
|
230
|
+
locality_stack:
|
231
|
+
type: page
|
232
|
+
reference_from: '7'
|
233
|
+
reference_to: '10'
|
234
|
+
source_locality:
|
235
|
+
source_locality_stack:
|
236
|
+
- type: volume
|
237
|
+
reference_from: '1'
|
238
|
+
- type: chapter
|
239
|
+
reference_from: '2'
|
230
240
|
- type: updates
|
231
241
|
bibitem:
|
232
242
|
type: standard
|
233
243
|
formattedref:
|
234
244
|
content: ISO 19115:2003/Cor 1:2006
|
235
|
-
|
236
|
-
|
237
|
-
|
245
|
+
format: text/plain
|
246
|
+
description:
|
247
|
+
content: supersedes
|
248
|
+
format: text/plain
|
249
|
+
- type: partOf
|
250
|
+
bibitem:
|
251
|
+
title:
|
252
|
+
type: main
|
253
|
+
content: Book title
|
254
|
+
format: text/plain
|
255
|
+
# series are an array, containing a title, a type, a formattedref, a place,
|
256
|
+
# an organization (string), an abbreviation, a from, a to, a number, and a partnumber.
|
257
|
+
# The title is mandatory, and all other fields are optional.
|
238
258
|
# The series title, like the titles of bibliographic items, contains a type,
|
239
259
|
# content, and optional language, script, and format attributes.
|
240
260
|
# The abbreviation and formattedref are either a string,
|
@@ -257,22 +277,37 @@ series:
|
|
257
277
|
to: '2010-12-20'
|
258
278
|
number: serie1234
|
259
279
|
partnumber: part5678
|
260
|
-
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
280
|
+
- title:
|
281
|
+
- content: Series
|
282
|
+
language: en
|
283
|
+
script: Latn
|
284
|
+
- content: Séries
|
285
|
+
language: fr
|
286
|
+
script: Latn
|
287
|
+
format: text/plain
|
265
288
|
# medium contains a form, a size, and a scale
|
266
289
|
medium:
|
267
290
|
form: medium form
|
268
291
|
size: medium size
|
269
292
|
scale: medium scale
|
270
|
-
# place is an array of strings
|
271
|
-
|
272
|
-
#
|
293
|
+
# place is an array of strings or hashes. Can have name or city, region and country.
|
294
|
+
# Name or city is mandatory, region and country are optional.
|
295
|
+
# String and hash with name are equivalent.
|
296
|
+
place:
|
297
|
+
- bib place
|
298
|
+
- city: Geneva
|
299
|
+
region:
|
300
|
+
- name: Region
|
301
|
+
country:
|
302
|
+
- iso: CH
|
303
|
+
name: Switzelznd
|
304
|
+
recommended: true
|
305
|
+
# extent is an array, localities are an array of locality_stack
|
273
306
|
extent:
|
274
|
-
|
275
|
-
|
307
|
+
locality:
|
308
|
+
type: section
|
309
|
+
reference_from: '7'
|
310
|
+
reference_to: '10'
|
276
311
|
# accesslocation is an array of strings
|
277
312
|
accesslocation:
|
278
313
|
- accesslocation1
|
@@ -286,6 +321,12 @@ validity:
|
|
286
321
|
begins: '2010-10-10 12:21'
|
287
322
|
ends: '2011-02-03 18:30'
|
288
323
|
revision: '2011-03-04 09:00'
|
324
|
+
# keyword is an array of strings or hashes of content, language, script, and format
|
325
|
+
keyword:
|
326
|
+
- Keyword
|
327
|
+
- Key Word
|
328
|
+
# license is a string
|
329
|
+
license: License
|
289
330
|
----
|
290
331
|
|
291
332
|
== Metanorma structure (AsciiBib): nested definition list
|
@@ -545,8 +586,9 @@ medium::
|
|
545
586
|
scale::: medium scale
|
546
587
|
place:: bib place
|
547
588
|
extent::
|
548
|
-
|
549
|
-
|
589
|
+
locality:::
|
590
|
+
type::: section
|
591
|
+
reference_from::: 7
|
550
592
|
accesslocation::
|
551
593
|
. accesslocation1
|
552
594
|
. accesslocation2
|
@@ -588,7 +630,7 @@ type::: uri
|
|
588
630
|
id::: www.ietf.org
|
589
631
|
--
|
590
632
|
description:::: Affiliation description
|
591
|
-
|
633
|
+
address:::
|
592
634
|
street::::
|
593
635
|
. 8 Street St
|
594
636
|
city:::: City
|
@@ -596,8 +638,8 @@ id::: www.ietf.org
|
|
596
638
|
country:::: Country
|
597
639
|
state:::: State
|
598
640
|
contact:::
|
599
|
-
|
600
|
-
|
641
|
+
mobile:::: 223322
|
642
|
+
phone:::: mobile
|
601
643
|
role:: author
|
602
644
|
|
603
645
|
==== Contributor
|
@@ -716,7 +758,6 @@ docid::
|
|
716
758
|
docid::
|
717
759
|
type::: ABC
|
718
760
|
id::: 32784
|
719
|
-
type:: standard
|
720
761
|
----
|
721
762
|
|
722
763
|
can instead be represented as:
|
@@ -743,15 +784,11 @@ Embedded elements can also repeat:
|
|
743
784
|
==== Contributor
|
744
785
|
person::
|
745
786
|
contact:::
|
746
|
-
|
747
|
-
|
748
|
-
city:::: City
|
749
|
-
postcode:::: 123456
|
750
|
-
country:::: Country
|
751
|
-
state:::: State
|
787
|
+
phone:::: 223322
|
788
|
+
type:::: mobile
|
752
789
|
contact:::
|
753
|
-
|
754
|
-
|
790
|
+
phone:::: 332233
|
791
|
+
type:::: work
|
755
792
|
----
|
756
793
|
|
757
794
|
can instead be represented as:
|
@@ -761,14 +798,11 @@ can instead be represented as:
|
|
761
798
|
[%bibitem]
|
762
799
|
...
|
763
800
|
contributor.person.contact::
|
764
|
-
contributor.person.contact.
|
765
|
-
contributor.person.contact.
|
766
|
-
contributor.person.contact.postcode:: 123456
|
767
|
-
contributor.person.contact.country:: Country
|
768
|
-
contributor.person.contact.state:: State
|
801
|
+
contributor.person.contact.phone:: 223322
|
802
|
+
contributor.person.contact.type:: mobile
|
769
803
|
contributor.person.contact::
|
770
|
-
contributor.person.contact.
|
771
|
-
contributor.person.contact.
|
804
|
+
contributor.person.contact.phone:: 332233
|
805
|
+
contributor.person.contact.type:: work
|
772
806
|
----
|
773
807
|
|
774
808
|
The following is Metanorma AsciiDoc markup corresponding to the YAML
|
@@ -873,15 +907,13 @@ contributor.person.affiliation.organization.abbreviation:: IETF
|
|
873
907
|
contributor.person.affiliation.organization.identifier.type:: uri
|
874
908
|
contributor.person.affiliation.organization.identifier.id:: www.ietf.org
|
875
909
|
contributor.person.affiliation.description:: Affiliation description
|
876
|
-
contributor.person.
|
877
|
-
contributor.person.
|
878
|
-
contributor.person.
|
879
|
-
contributor.person.
|
880
|
-
contributor.person.
|
881
|
-
contributor.person.contact.
|
882
|
-
contributor.person.contact::
|
883
|
-
contributor.person.contact.type:: phone
|
884
|
-
contributor.person.contact.value:: 223322
|
910
|
+
contributor.person.address.street:: 8 Street St
|
911
|
+
contributor.person.address.city:: City
|
912
|
+
contributor.person.address.postcode:: 123456
|
913
|
+
contributor.person.address.country:: Country
|
914
|
+
contributor.person.address.state:: State
|
915
|
+
contributor.person.contact.phone:: 223322
|
916
|
+
contributor.person.contact.type:: mobile
|
885
917
|
contributor.role:: author
|
886
918
|
contributor::
|
887
919
|
contributor.organization.name:: IETF
|
@@ -308,9 +308,7 @@ module RelatonBib
|
|
308
308
|
when :street, :city, :state, :country, :postcode # it's for old version compatibility, should be removed in the future
|
309
309
|
a[:street] = RelatonBib.array(a[:street])
|
310
310
|
Address.new(**a)
|
311
|
-
when :address
|
312
|
-
a[:address][:street] = RelatonBib.array(a[:address][:street])
|
313
|
-
Address.new(**a[:address])
|
311
|
+
when :address then create_address(a[:address])
|
314
312
|
when :phone, :email, :uri
|
315
313
|
Contact.new(type: type.to_s, value: value, subtype: a[:type])
|
316
314
|
else # it's for old version compatibility, should be removed in the future
|
@@ -319,6 +317,15 @@ module RelatonBib
|
|
319
317
|
end
|
320
318
|
end
|
321
319
|
|
320
|
+
def create_address(adr)
|
321
|
+
if adr.is_a?(Hash)
|
322
|
+
adr[:street] = RelatonBib.array(adr[:street])
|
323
|
+
Address.new(**adr)
|
324
|
+
else
|
325
|
+
Address.new(formatted_address: adr)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
322
329
|
# @param ret [Hash]
|
323
330
|
def copyright_hash_to_bib(ret)
|
324
331
|
return unless ret[:copyright]
|
@@ -124,12 +124,10 @@ module RelatonBib
|
|
124
124
|
# @param [RelatonBib::ContributionInfo] contrib contributor
|
125
125
|
#
|
126
126
|
def render_address(builder, contrib) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
127
|
-
|
128
|
-
|
129
|
-
# end
|
130
|
-
if contrib.entity.contact.any?
|
127
|
+
address, contact = address_contact contrib.entity.contact
|
128
|
+
if address || contact.any?
|
131
129
|
builder.address do |xml|
|
132
|
-
address = contrib.entity.contact.detect { |cn| cn.is_a? Address }
|
130
|
+
# address = contrib.entity.contact.detect { |cn| cn.is_a? Address }
|
133
131
|
if address
|
134
132
|
xml.postal do
|
135
133
|
xml.city address.city if address.city
|
@@ -139,11 +137,19 @@ module RelatonBib
|
|
139
137
|
xml.street address.street[0] if address.street.any?
|
140
138
|
end
|
141
139
|
end
|
142
|
-
render_contact xml,
|
140
|
+
render_contact xml, contact
|
143
141
|
end
|
144
142
|
end
|
145
143
|
end
|
146
144
|
|
145
|
+
def address_contact(contact) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
146
|
+
addr = contact.detect do |c|
|
147
|
+
c.is_a?(Address) && (c.city || c.postcode || c.country || c.state || c.street.any?)
|
148
|
+
end
|
149
|
+
cont = contact.select { |c| c.is_a?(Contact) }
|
150
|
+
[addr, cont]
|
151
|
+
end
|
152
|
+
|
147
153
|
#
|
148
154
|
# Render contact
|
149
155
|
#
|
data/lib/relaton_bib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|