relaton-ecma 1.7.pre1 → 1.7.pre2

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: 405b83137623bcd22126400448b0c1d5fea2a5a60b9df5391aa787d0febf9067
4
- data.tar.gz: 4552e7c5e6a7036ad3cee0070b991982cae62417af1aee6570189df7224dc726
3
+ metadata.gz: 5826805692de35028ccf0275c7ca855e1f044f731488612f2f8c192536e8f180
4
+ data.tar.gz: 119d00f6ecf72910d45206e571f523c23f06344f3a1b045cdf77459e43908f5b
5
5
  SHA512:
6
- metadata.gz: 62f837e2779709b8f1b7700fc9f7cb7e283a3cc7e5b9e393dbb0291205bcb77fa899cd1e3ae52ccc4ac3207956eccf08cc42189457ebb92d29c431b80bd0adbc
7
- data.tar.gz: 460f1c6af54a7dbdb70f96ccca71116b58618fbc2c88c1bd35b5fd35b89a9eafb2e4d76dfba515b43a61910b2eca299716f32c6a03ff0fadb2ebf250d1d65e61
6
+ metadata.gz: eb9ec25d82615885254ecc1193e24f39073274842c9a20a51bf7bbd8a3d4f43ef0cdbffb808b2b50b07cfee58fb56da3647eed31e85fb2677d71d857dad32219
7
+ data.tar.gz: b00dfc46e476ff792cdcc58df641a5e617b0feb19b0a2a73faababb0348bba565b82e24a6503f03212ef5345588e8b585dbe57bf6baa1967444b82720bbd228b
@@ -42,7 +42,7 @@ module RelatonEcma
42
42
  # @return [Array<RelatonBib::TypedUri>]
43
43
  def fetch_link(doc, url)
44
44
  link = [RelatonBib::TypedUri.new(type: "src", content: url)]
45
- ref = doc.at('//tr[@class="STbody"]/td/a')
45
+ ref = doc.at('//div[@class="ecma-item-content-wrapper"]/span/a')
46
46
  link << RelatonBib::TypedUri.new(type: "doi", content: ref[:href]) if ref
47
47
  link
48
48
  end
@@ -50,7 +50,7 @@ module RelatonEcma
50
50
  # @param doc [Nokogiri::HTML::Document]
51
51
  # @return [Array<Hash>]
52
52
  def fetch_title(doc)
53
- doc.xpath('//span[@class="STsubtitle"]').map do |t|
53
+ doc.xpath('//p[@class="ecma-item-short-description"]').map do |t|
54
54
  { content: t.text.strip, language: "en", script: "Latn" }
55
55
  end
56
56
  end
@@ -58,7 +58,7 @@ module RelatonEcma
58
58
  # @param doc [Nokogiri::HTML::Document]
59
59
  # @return [Array<RelatonBib::FormattedString>]
60
60
  def fetch_abstract(doc)
61
- a = doc.xpath('//p[@class="STdescription"]').map do |a|
61
+ a = doc.xpath('//div[@class="ecma-item-content"]/p').map do |a|
62
62
  a.text.strip.squeeze(" ").gsub /\r\n/, ""
63
63
  end.join "\n"
64
64
  return [] if a.empty?
@@ -69,8 +69,8 @@ module RelatonEcma
69
69
  # @param doc [Nokogiri::HTML::Document]
70
70
  # @return [Array<RelatonBib::BibliographicDate>]
71
71
  def fetch_date(doc)
72
- doc.xpath('//span[@class="STedition"]').map do |d|
73
- date = d.text.match(/(?<=\()\w+\s\d{4}(?=\))/).to_s
72
+ doc.xpath('//p[@class="ecma-item-edition"]').map do |d|
73
+ date = d.text.split(", ").last
74
74
  RelatonBib::BibliographicDate.new type: "published", on: date
75
75
  end
76
76
  end
@@ -78,19 +78,19 @@ module RelatonEcma
78
78
  # @param doc [Nokogiri::HTML::Document]
79
79
  # @return [String]
80
80
  def fetch_edition(doc)
81
- doc.at('//span[@class="STedition"]')&.text&.strip&.match(/^\d+(?=th)/)&.to_s
81
+ doc.at('//p[@class="ecma-item-edition"]')&.text&.match(/^\d+(?=th)/)&.to_s
82
82
  end
83
83
 
84
84
  # @param doc [Nokogiri::HTML::Document]
85
85
  # @return [Array<Hash>]
86
- def fetch_relation(doc)
87
- history = doc.at "//p[contains(., 'historical')]/a"
88
- return [] unless history
89
-
90
- rel_doc = Nokogiri::HTML OpenURI.open_uri(ENDPOINT + history[:href])
91
- rel_doc.xpath("//tr[@class='STbody']/td[1]/*").map do |rel|
92
- fref = RelatonBib::FormattedRef.new content: rel.text, language: "en", script: "Latn"
93
- bibitem = RelatonBib::BibliographicItem.new formattedref: fref
86
+ def fetch_relation(doc) # rubocop:disable Metrics/AbcSize
87
+ doc.xpath("//ul[@class='ecma-item-archives']/li").map do |rel|
88
+ ref, ed, on = rel.at("span").text.split ", "
89
+ fref = RelatonBib::FormattedRef.new content: ref, language: "en", script: "Latn"
90
+ date = []
91
+ date << RelatonBib::BibliographicDate.new(type: "published", on: on) if on
92
+ link = rel.xpath("span/a").map { |l| RelatonBib::TypedUri.new type: "doi", content: l[:href] }
93
+ bibitem = RelatonBib::BibliographicItem.new formattedref: fref, edition: ed.match(/^\d+/).to_s, link: link
94
94
  { type: "updates", bibitem: bibitem }
95
95
  end
96
96
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonEcma
2
- VERSION = "1.7.pre1".freeze
2
+ VERSION = "1.7.pre2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ecma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.pre1
4
+ version: 1.7.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-22 00:00:00.000000000 Z
11
+ date: 2021-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase