relaton-bib 1.13.6 → 1.13.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +0 -1
- data/lib/relaton_bib/bibliographic_item.rb +8 -4
- data/lib/relaton_bib/bibxml_parser.rb +18 -18
- 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: 493716815449edfed921ea2239b0c066b614211c2722f261bf4f59d5aa094e54
|
4
|
+
data.tar.gz: 661ad28bf88fcb3e5b27888885696c14385fbb9bfc891f4b20ea91d7e6dba1f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e5ef5a5bd17eafad776a09434fb8e7df82ec2ca3b4fc1e59a6e7d722a72e1c1f57ec75a80dfb1c651a7cea71160c04fb1083517169a68ba341bc3f607c8219c
|
7
|
+
data.tar.gz: 7b556666124417d87dc58709325b4be7970fb4af443686e332376b739edaa8ad0041e0a26145954577a2b1f8674b078a31405ac2447868caa8df06b3eb25158c
|
data/.github/workflows/rake.yml
CHANGED
@@ -956,7 +956,7 @@ module RelatonBib
|
|
956
956
|
builder.author do |xml|
|
957
957
|
xml.parent[:role] = "editor" if c.role.detect { |r| r.type == "editor" }
|
958
958
|
if c.entity.is_a?(Person) then render_person xml, c.entity
|
959
|
-
else render_organization xml, c.entity
|
959
|
+
else render_organization xml, c.entity, c.role
|
960
960
|
end
|
961
961
|
render_address xml, c
|
962
962
|
end
|
@@ -1039,14 +1039,18 @@ module RelatonBib
|
|
1039
1039
|
# @param [Nokogiri::XML::Builder] builder xml builder
|
1040
1040
|
# @param [RelatonBib::Organization] org organization
|
1041
1041
|
#
|
1042
|
-
def render_organization(builder, org) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
1042
|
+
def render_organization(builder, org, role = []) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize
|
1043
1043
|
ab = org&.abbreviation&.content
|
1044
1044
|
on = org&.name&.first&.content
|
1045
1045
|
orgname = if BibXMLParser::ORGNAMES.key?(ab) then ab
|
1046
1046
|
else BibXMLParser::ORGNAMES.key(on) || on || ab
|
1047
1047
|
end
|
1048
|
-
|
1049
|
-
|
1048
|
+
if role.detect { |r| r.description.detect { |d| d.content == "BibXML author" } }
|
1049
|
+
builder.parent[:fullname] = orgname
|
1050
|
+
else
|
1051
|
+
o = builder.organization orgname
|
1052
|
+
o[:abbrev] = ab if ab
|
1053
|
+
end
|
1050
1054
|
end
|
1051
1055
|
end
|
1052
1056
|
end
|
@@ -12,6 +12,11 @@ module RelatonBib
|
|
12
12
|
"3GPP" => "3rd Generation Partnership Project",
|
13
13
|
}.freeze
|
14
14
|
|
15
|
+
FULLNAMEORG = [
|
16
|
+
"IAB", "Internet Architecture Board", "IAB and IESG", "IESG",
|
17
|
+
"IAB Advisory Committee", "Internet Engineering Steering Group"
|
18
|
+
].freeze
|
19
|
+
|
15
20
|
#
|
16
21
|
# Parse BibXML content
|
17
22
|
#
|
@@ -215,19 +220,24 @@ module RelatonBib
|
|
215
220
|
# @return [Array<Hash>]
|
216
221
|
def contributors(reference)
|
217
222
|
reference.xpath("./front/author").map do |contrib|
|
218
|
-
|
219
|
-
else organization(contrib)
|
220
|
-
end
|
223
|
+
full_name_org(contrib) || person(contrib, reference) || organization(contrib)
|
221
224
|
end.compact
|
222
|
-
|
225
|
+
end
|
226
|
+
|
227
|
+
def full_name_org(contrib)
|
228
|
+
return unless FULLNAMEORG.include? contrib[:fullname]
|
229
|
+
|
230
|
+
role = contributor_role(contrib)
|
231
|
+
role[:description] = ["BibXML author"]
|
232
|
+
{ entity: new_org(contrib[:fullname]), role: [role] }
|
223
233
|
end
|
224
234
|
|
225
235
|
# @param author [Nokogiri::XML::Element]
|
226
236
|
# @param reference [Nokogiri::XML::Element]
|
227
237
|
# @return [Array<Hash{Symbol=>RelatonBib::Person,Symbol=>Array<String>}>]
|
228
238
|
def person(author, reference)
|
229
|
-
|
230
|
-
|
239
|
+
return unless author[:fullname] || author[:surname]
|
240
|
+
|
231
241
|
entity = Person.new(
|
232
242
|
name: full_name(author, reference),
|
233
243
|
affiliation: affiliation(author),
|
@@ -241,15 +251,6 @@ module RelatonBib
|
|
241
251
|
# @return [Array<Hash{Symbol=>RelatonBib::Organization,
|
242
252
|
# Symbol=>Array<String>}>]
|
243
253
|
def organization(contrib)
|
244
|
-
# publisher = { entity: new_org, role: [type: "publisher"] }
|
245
|
-
# orgs = reference.xpath("./seriesinfo").reduce([]) do |mem, si|
|
246
|
-
# next mem unless si[:stream]
|
247
|
-
|
248
|
-
# mem << { entity: new_org(si[:stream], nil), role: [type: "author"] }
|
249
|
-
# end
|
250
|
-
# orgs + reference.xpath(
|
251
|
-
# "front/author[not(@surname)][not(@fullname)]/organization",
|
252
|
-
# ).map do |org|
|
253
254
|
org = contrib.at("./organization")
|
254
255
|
orgname = org.text.strip
|
255
256
|
return if orgname.empty?
|
@@ -299,10 +300,9 @@ module RelatonBib
|
|
299
300
|
end
|
300
301
|
|
301
302
|
# @param name [String]
|
302
|
-
# @param abbr [String]
|
303
|
+
# @param abbr [String, nil]
|
303
304
|
# @return [RelatonBib::Organization]
|
304
|
-
def new_org(name, abbr)
|
305
|
-
# (name = "Internet Engineering Task Force", abbr = "IETF")
|
305
|
+
def new_org(name, abbr = nil)
|
306
306
|
Organization.new name: name, abbreviation: abbr
|
307
307
|
end
|
308
308
|
|
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.13.
|
4
|
+
version: 1.13.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|