relaton-bipm 1.14.3 → 1.14.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34d720b316dbd942e2c5d630d2ae0f07b74331e4ef07f68715e84304bad0fb13
4
- data.tar.gz: 38d36e34b998db6e4fa9e9f1a6e5306fadacea45b9a878cd14629eaaca2ef50d
3
+ metadata.gz: 690219138f8ba35766ffabcbc32ebc6ee026d24eb3567c29a188bb152476c94b
4
+ data.tar.gz: fd6a46875f31cb3a2ca5206768198ed93fbdadeb83d510657ea7429f720a9bb5
5
5
  SHA512:
6
- metadata.gz: a22261617d5c3de8aad7ed410091331698630f958332c5feb0b215b9fafe9167015530e9e6ecb71046307a6775aa7a2a0a71dd4c12e4f982cb0bd259e021a267
7
- data.tar.gz: 376bb090dd4d273b8039357d78280c9bc4f1555918920a55b22ec72cb8be87c4ce0a8469254ffc000256fa95069a271b65b978dc767d735acd4b3e141c5dea24
6
+ metadata.gz: 18b47852d00d29de957bef59e9673a453547ce0df79a656aacf158b4ac5591909030f9d06e874b952507773154bae59e79e860f94510a1e641cab50498722df8
7
+ data.tar.gz: 9475dfacb459044df90e16d7c24a3bcec90d21b7dea0f0b34275cfa56e60abf029157087aadf1ff0ef034b79209d158eedb8e04b0009b0dd1d31ba0dac9f6e3c
@@ -44,7 +44,7 @@ module RelatonBipm
44
44
  # @return [RelatonBipm::BipmBibliographicItem]
45
45
  def get_bipm(reference, agent) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
46
46
  ref_id = Id.new reference
47
- index = Relaton::Index.find_or_create :BIPM, url: "#{GH_ENDPOINT}index2.zip"
47
+ index = Relaton::Index.find_or_create :BIPM, url: "#{GH_ENDPOINT}index2.zip", file: "index2.yaml"
48
48
  rows = index.search { |r| ref_id == r[:id] }
49
49
  return unless rows.any?
50
50
 
@@ -6,22 +6,30 @@ module RelatonBipm
6
6
  #
7
7
  # Create new parser and parse document
8
8
  #
9
- # @param [Nokogiri::XML::Element] doc document XML element
9
+ # @param [String] path path to XML file
10
10
  #
11
11
  # @return [RelatonBipm::BipmBibliographicItem] document
12
12
  #
13
- def self.parse(doc)
14
- new(doc).parse
13
+ def self.parse(path)
14
+ doc = Nokogiri::XML(File.read(path, encoding: "UTF-8"))
15
+ journal, volume, article = path.split("/")[-2].split("_")[1..]
16
+ new(doc, journal, volume, article).parse
15
17
  end
16
18
 
17
19
  #
18
20
  # Initialize parser
19
21
  #
20
- # @param [Nokogiri::XML::Element] doc XML document
21
- #
22
- def initialize(doc)
23
- @doc = doc
24
- @meta = @doc.at("./front/article-meta")
22
+ # @param [Nokogiri::XML::Document] doc XML document
23
+ # @param [String] journal journal
24
+ # @param [String] volume volume
25
+ # @param [String] article article
26
+ #
27
+ def initialize(doc, journal, volume, article)
28
+ @doc = doc.at "/article"
29
+ @journal = journal
30
+ @volume = volume
31
+ @article = article
32
+ @meta = doc.at("/article/front/article-meta")
25
33
  end
26
34
 
27
35
  #
@@ -54,15 +62,15 @@ module RelatonBipm
54
62
  # @return [Array<String>] array of volume, issue and page
55
63
  #
56
64
  def volume_issue_article
57
- volume = @meta.at("./volume").text
58
- issue = @meta.at("./issue").text
65
+ # volume = @meta.at("./volume").text
66
+ # issue = @meta.at("./issue").text
59
67
  # page = @doc.at("./front/article-meta/fpage")&.text || manuscript
60
- [volume, issue, article].join(" ")
68
+ [@journal, @volume, @article].compact.join(" ")
61
69
  end
62
70
 
63
- def article
64
- @meta.at("./article-id[@pub-id-type='manuscript']").text.match(/[^_]+$/).to_s
65
- end
71
+ # def article
72
+ # @meta.at("./article-id[@pub-id-type='manuscript']").text.match(/[^_]+$/).to_s
73
+ # end
66
74
 
67
75
  #
68
76
  # Parse journal title
@@ -30,8 +30,7 @@ module RelatonBipm
30
30
  #
31
31
  def fetch_articles # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
32
32
  Dir["#{DIR}/**/*.xml"].each do |path|
33
- doc = Nokogiri::XML File.read(path, encoding: "UTF-8")
34
- item = ArticleParser.parse doc.at("/article")
33
+ item = ArticleParser.parse path
35
34
  file = "#{item.docidentifier.first.id.downcase.gsub(' ', '-')}.#{@data_fetcher.ext}"
36
35
  out_path = File.join(@data_fetcher.output, file)
37
36
  @data_fetcher.index[[item.docidentifier.first.id]] = out_path
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.14.3".freeze
2
+ VERSION = "1.14.4".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.3
4
+ version: 1.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-26 00:00:00.000000000 Z
11
+ date: 2023-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml