lib/relaton_nist/data_fetcher.rb in relaton-nist-1.12.0 vs lib/relaton_nist/data_fetcher.rb in relaton-nist-1.12.1
- old
+ new
@@ -212,14 +212,15 @@
# @return [Array<RelatonBib::Series>] series
#
def fetch_series(doc)
series_path = File.expand_path("series.yaml", __dir__)
series = YAML.load_file series_path
- prf, srs, = pub_id(doc).split
+ prf, srs, num = pub_id(doc).split
sname = series[srs] || srs
title = RelatonBib::TypedTitleString.new(content: "#{prf} #{sname}")
- [RelatonBib::Series.new(title: title, number: "#{prf} #{srs}")]
+ abbr = RelatonBib::LocalizedString.new("#{prf} #{srs}")
+ [RelatonBib::Series.new(title: title, abbreviation: abbr, number: num)]
end
#
# Save document
#
@@ -272,10 +273,10 @@
def fetch # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
t1 = Time.now
puts "Started at: #{t1}"
docs = Nokogiri::XML OpenURI.open_uri URL
- FileUtils.mkdir @output unless Dir.exist? @output
+ FileUtils.mkdir_p @output
FileUtils.rm Dir[File.join(@output, "*.#{@ext}")]
docs.xpath("/body/query/doi_record/report-paper/report-paper_metadata")
.each { |doc| parse_doc doc }
t2 = Time.now