Skip to content

Commit 36fcdb8

Browse files
committed
1 parent dffbfb0 commit 36fcdb8

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

lib/relaton_bib/bibxml_parser.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ def organization(contrib)
251251
# "front/author[not(@surname)][not(@fullname)]/organization",
252252
# ).map do |org|
253253
org = contrib.at("./organization")
254-
name = ORGNAMES[org.text] || org.text
254+
orgname = org.text.strip
255+
return if orgname.empty?
256+
257+
name = ORGNAMES[orgname] || orgname
255258
{ entity: new_org(name, org[:abbrev]), role: [contributor_role(contrib)] }
256259
# end
257260
end

lib/relaton_bib/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module RelatonBib
2-
VERSION = "1.12.3".freeze
2+
VERSION = "1.12.4".freeze
33
end

spec/relaton_bib/bibxml_parser_spec.rb

+17
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,23 @@
169169
expect(RelatonBib::BibXMLParser.month("Sept")).to eq "09"
170170
end
171171

172+
it "skip empty organization" do
173+
bibxml = <<~END_XML
174+
<reference anchor="RFC0001" target="https://www.rfc-editor.org/info/rfc1">
175+
<front>
176+
<title>Host Software</title>
177+
<author>
178+
<organization>
179+
</organization>
180+
</author>
181+
<seriesInfo name="RFC" value="1"/>
182+
</front>
183+
</reference>
184+
END_XML
185+
rfc = RelatonBib::BibXMLParser.parse bibxml
186+
expect(rfc.contributor).to be_empty
187+
end
188+
172189
# it "returns default affiliation" do
173190
# doc = Nokogiri::XML <<~END_XML
174191
# <reference>

0 commit comments

Comments
 (0)