relaton-bib 1.13.6 → 1.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bb1128da936b194ce7e29899a6092f2767e85b4f7e7963306cdb65789af8c65
4
- data.tar.gz: a3c52753f1459b6898d9780d10899b560708fbbccb5f5a8e168c8b9945bcb5c1
3
+ metadata.gz: 493716815449edfed921ea2239b0c066b614211c2722f261bf4f59d5aa094e54
4
+ data.tar.gz: 661ad28bf88fcb3e5b27888885696c14385fbb9bfc891f4b20ea91d7e6dba1f1
5
5
  SHA512:
6
- metadata.gz: edbdefdccca25da59d741f1013e5008a63ea53beff1350f5a248c52e8810f94ef3d08040a14976005ebdb0c79405b839534784550a893b368866ed6a561c6e33
7
- data.tar.gz: f0ba59355807104e7915ff731da8bbe55197299af8b10e1ae90c6ba2a23c36e643d356c629dd307bf3fbf5094257c91a4509e908bbaca510cab5f1d65764e896
6
+ metadata.gz: 2e5ef5a5bd17eafad776a09434fb8e7df82ec2ca3b4fc1e59a6e7d722a72e1c1f57ec75a80dfb1c651a7cea71160c04fb1083517169a68ba341bc3f607c8219c
7
+ data.tar.gz: 7b556666124417d87dc58709325b4be7970fb4af443686e332376b739edaa8ad0041e0a26145954577a2b1f8674b078a31405ac2447868caa8df06b3eb25158c
@@ -5,7 +5,6 @@ name: rake
5
5
  on:
6
6
  push:
7
7
  branches: [ master, main ]
8
- tags: [ v* ]
9
8
  pull_request:
10
9
 
11
10
  jobs:
@@ -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
- o = builder.organization orgname
1049
- o[:abbrev] = ab if ab
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
- if contrib[:fullname] || contrib[:surname] then person(contrib, reference)
219
- else organization(contrib)
220
- end
223
+ full_name_org(contrib) || person(contrib, reference) || organization(contrib)
221
224
  end.compact
222
- # persons(reference) + organizations(reference)
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
- # reference.xpath("./front/author[@surname]|./front/author[@fullname]")
230
- # .map do |author|
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
 
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.13.6".freeze
2
+ VERSION = "1.13.7".freeze
3
3
  end
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.6
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-18 00:00:00.000000000 Z
11
+ date: 2022-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug