From 36fcdb83e40ddda4db9add83390779038bf84c75 Mon Sep 17 00:00:00 2001 From: Andrei Kislichenko Date: Fri, 29 Jul 2022 11:32:14 +0200 Subject: [PATCH] fix issue ietf-tools/relaton-data-misc#3 --- lib/relaton_bib/bibxml_parser.rb | 5 ++++- lib/relaton_bib/version.rb | 2 +- spec/relaton_bib/bibxml_parser_spec.rb | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/relaton_bib/bibxml_parser.rb b/lib/relaton_bib/bibxml_parser.rb index 39e7948..fb061fe 100644 --- a/lib/relaton_bib/bibxml_parser.rb +++ b/lib/relaton_bib/bibxml_parser.rb @@ -251,7 +251,10 @@ def organization(contrib) # "front/author[not(@surname)][not(@fullname)]/organization", # ).map do |org| org = contrib.at("./organization") - name = ORGNAMES[org.text] || org.text + orgname = org.text.strip + return if orgname.empty? + + name = ORGNAMES[orgname] || orgname { entity: new_org(name, org[:abbrev]), role: [contributor_role(contrib)] } # end end diff --git a/lib/relaton_bib/version.rb b/lib/relaton_bib/version.rb index e0ec2df..606c8ff 100644 --- a/lib/relaton_bib/version.rb +++ b/lib/relaton_bib/version.rb @@ -1,3 +1,3 @@ module RelatonBib - VERSION = "1.12.3".freeze + VERSION = "1.12.4".freeze end diff --git a/spec/relaton_bib/bibxml_parser_spec.rb b/spec/relaton_bib/bibxml_parser_spec.rb index 49f1600..947d633 100644 --- a/spec/relaton_bib/bibxml_parser_spec.rb +++ b/spec/relaton_bib/bibxml_parser_spec.rb @@ -169,6 +169,23 @@ expect(RelatonBib::BibXMLParser.month("Sept")).to eq "09" end + it "skip empty organization" do + bibxml = <<~END_XML + + + Host Software + + + + + + + + END_XML + rfc = RelatonBib::BibXMLParser.parse bibxml + expect(rfc.contributor).to be_empty + end + # it "returns default affiliation" do # doc = Nokogiri::XML <<~END_XML #