relaton-bipm 1.14.3 → 1.14.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 690219138f8ba35766ffabcbc32ebc6ee026d24eb3567c29a188bb152476c94b
|
4
|
+
data.tar.gz: fd6a46875f31cb3a2ca5206768198ed93fbdadeb83d510657ea7429f720a9bb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 [
|
9
|
+
# @param [String] path path to XML file
|
10
10
|
#
|
11
11
|
# @return [RelatonBipm::BipmBibliographicItem] document
|
12
12
|
#
|
13
|
-
def self.parse(
|
14
|
-
|
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::
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
[
|
68
|
+
[@journal, @volume, @article].compact.join(" ")
|
61
69
|
end
|
62
70
|
|
63
|
-
def article
|
64
|
-
|
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
|
-
|
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
|
data/lib/relaton_bipm/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|