relaton-ieee 1.12.0 → 1.12.3

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: 2dffd3e986054d23676fefc4e3d57e37186ea420407224f37f67c9d44824a87c
4
- data.tar.gz: eda62a34d92c61fbeeea89e3d1afe377f83c35f6a36c4b3eb3728440b3da0f9a
3
+ metadata.gz: ae6ce7435bdf251b1180ba075e3585f7075c289ab5ad58bbf7e26706d3fe10fe
4
+ data.tar.gz: b6475b2c93336560e490fea100879389d4323a7854180114d724443af0332e52
5
5
  SHA512:
6
- metadata.gz: 7d5d70f1b96276413acff519ef6f374c2469eb7bf9c0dcd086ad43d528ed3ae84ca606d7a8acf38c39c004541e2f03e473917d14a94b82560d66984811214389
7
- data.tar.gz: 2ba1263ea7569e1682590d3bbd4fcec4b27ffb2d539ec925d732ba8d33a3d3c3195bea0834257565a17576323d91deca372feed55dcdfcddb0174d83d1b9b947
6
+ metadata.gz: 7a630fdfff66077109cbbbad786783488c79a687de9d60b75b1ed42b03a46ab98c11542abbdbb7497dbe3220183d1512f7457339edfad3b459591fe2a3c06676
7
+ data.tar.gz: f2027e366b04f6cc59c0e219526082d9f171d22fdbbf91c42077b07e0c37a8508a715f8fb9eb7ae55c50eaf8974970fff15b7f6ade8389438061aaceace766fc
data/README.adoc CHANGED
@@ -170,7 +170,7 @@ hash = YAML.load_file 'spec/fixtures/ieee_528_2019.yaml'
170
170
 
171
171
  === Fetch data
172
172
 
173
- There is an IEEE dataset https://github.com/ietf-ribose/ieee-rawbib which can be converted into BibXML/BibYAML formats. The dataset needs to be placed into local directiory.
173
+ There is an IEEE dataset https://github.com/relaton/ieee-rawbib which can be converted into BibXML/BibYAML formats. The dataset needs to be placed into local directiory.
174
174
 
175
175
  The method `RelatonIeee::DataFetcher.fetch(output: "data", format: "yaml")` converts all the documents from the local `ieee-rawbib` directory and save them to the `./data` folder in YAML format.
176
176
  Arguments:
@@ -44,7 +44,7 @@ module RelatonIeee
44
44
  def self.fetch(output: "data", format: "yaml")
45
45
  t1 = Time.now
46
46
  puts "Started at: #{t1}"
47
- FileUtils.mkdir_p output unless Dir.exist? output
47
+ FileUtils.mkdir_p output # unless Dir.exist? output
48
48
  new(output, format).fetch
49
49
  t2 = Time.now
50
50
  puts "Stopped at: #{t2}"
@@ -113,7 +113,7 @@ module RelatonIeee
113
113
  amsid = doc.at("./publicationinfo/amsid").text
114
114
  if backrefs.value?(bib.docidentifier[0].id) && /updates\.\d+/ !~ filename
115
115
  oamsid = backrefs.key bib.docidentifier[0].id
116
- warn "Document exists ID: \"#{bib.docidentifier[0].id}\" AMSID: "\
116
+ warn "Document exists ID: \"#{bib.docidentifier[0].id}\" AMSID: " \
117
117
  "\"#{amsid}\" source: \"#{filename}\". Other AMSID: \"#{oamsid}\""
118
118
  if bib.docidentifier[0].id.include?(doc.at("./publicationinfo/stdnumber").text)
119
119
  save_doc bib # rewrite file if the PubID matches to the stdnumber
@@ -5,40 +5,36 @@ require "fileutils"
5
5
  module RelatonIeee
6
6
  class HitCollection < RelatonBib::HitCollection
7
7
  DOMAIN = "https://standards.ieee.org".freeze
8
- DATADIR = File.expand_path ".relaton/ogc/", Dir.home
9
- DATAFILE = File.expand_path "bibliography.json", DATADIR
10
- ETAGFILE = File.expand_path "etag.txt", DATADIR
11
-
12
- # rubocop:disable Metrics/AbcSize
8
+ # DATADIR = File.expand_path ".relaton/ogc/", Dir.home
9
+ # DATAFILE = File.expand_path "bibliography.json", DATADIR
10
+ # ETAGFILE = File.expand_path "etag.txt", DATADIR
13
11
 
14
12
  # @param reference [Strig]
15
13
  # @param opts [Hash]
16
- def initialize(reference) # rubocop:disable Metrics/MethodLength
14
+ def initialize(reference) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
17
15
  super
18
16
  code1 = reference.sub(/^IEEE\s(Std\s)?/, "")
19
17
  url = "#{DOMAIN}/wp-admin/admin-ajax.php"
20
18
  query = reference.gsub("/", " ")
21
19
  resp = Faraday.post url, { action: "ieee_cloudsearch", q: query }
22
20
  json = JSON.parse resp.body
23
- # html = Nokogiri::HTML json["html"]
24
- # @array = html.xpath("//h4/a").reduce([]) do |s, hit|
21
+ unless json["results"]
22
+ @array = []
23
+ return
24
+ end
25
+
25
26
  @array = json["results"]["hits"]["hit"].reduce([]) do |s, hit|
26
27
  flds = hit["fields"]
27
- # ref = hit.text.strip
28
- # /^(?:\w+\s)?(?<code2>[A-Z\d.]+)(?:-(?<year>\d{4}))?/ =~ ref
29
28
  /^(?:\w+\s)?(?<code2>[A-Z\d.]+)(?:-(?<year>\d{4}))?/ =~ flds["meta_designation_l"]
30
29
  next s unless code2 && code1 =~ %r{^#{code2}}
31
30
 
32
31
  hit_data = {
33
32
  ref: flds["meta_designation_l"],
34
- # title: flds["meta_title_t"],
35
- # abstract: flds["meta_description_l"],
36
33
  year: year.to_i,
37
34
  url: flds["doc_id_l"],
38
35
  }
39
36
  s << Hit.new(hit_data, self)
40
37
  end.sort_by { |h| h.hit[:year].to_s + h.hit[:url] }.reverse
41
38
  end
42
- # rubocop:enable Metrics/AbcSize
43
39
  end
44
40
  end
@@ -28,7 +28,7 @@ module RelatonIeee
28
28
  # @option args [String] :year
29
29
  # @option args [String] :month
30
30
  #
31
- def initialize(number:, **args) # rubocop:disable Metrics/MethodLength
31
+ def initialize(number:, **args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
32
32
  @publisher = args[:publisher]
33
33
  @stage = args[:stage]
34
34
  @number = number
@@ -56,7 +56,7 @@ module RelatonIeee
56
56
  out = "#{approval} #{out}" if approval
57
57
  out = "#{status} #{out}" if status
58
58
  out = "#{publisher} #{out}" if publisher
59
- out += "-#{part}" if part
59
+ out += ".#{part}" if part
60
60
  out += edition_to_s + draft_to_s + rev_to_s + corr_to_s + amd_to_s
61
61
  out + year_to_s + month_to_s + redline_to_s
62
62
  end
@@ -82,7 +82,7 @@ module RelatonIeee
82
82
  end
83
83
 
84
84
  def year_to_s
85
- year ? ".#{year}" : ""
85
+ year ? "-#{year}" : ""
86
86
  end
87
87
 
88
88
  def month_to_s
@@ -458,7 +458,7 @@ module RelatonIeee
458
458
  #
459
459
  # @return [String]
460
460
  def sp(parts)
461
- parts.gsub ".", "-"
461
+ parts # .gsub ".", "-"
462
462
  end
463
463
 
464
464
  #
@@ -39,7 +39,9 @@ module RelatonIeee
39
39
  # @param ref [String]
40
40
  # @return [Array<RelatonBib::DocumentIdentifier>]
41
41
  def fetch_docid(ref)
42
- [RelatonBib::DocumentIdentifier.new(id: ref, type: "IEEE", primary: true)]
42
+ args = { id: ref, type: "IEEE", primary: true }
43
+ args[:scope] = "trademark" if ref.match?(/^IEEE\s(?:Std\s)?(?:802|2030)/)
44
+ [RelatonBib::DocumentIdentifier.new(**args)]
43
45
  end
44
46
 
45
47
  # @param url [String]
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.12.0".freeze
2
+ VERSION = "1.12.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-25 00:00:00.000000000 Z
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml