relaton-ieee 1.12.1 → 1.12.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: 7c9ad7ed0600b55a10bf86c90d4e9a0bd0b7b7b39f15b4162456227e3a79dd44
4
- data.tar.gz: 35070ebc17399869b94e03cfb6922b29b3c57ab3d9e08d81e495fa5e25cdf199
3
+ metadata.gz: e06d850cd175596e9f8a50c8a88000ecd646fb4e9059082e26248269fb045380
4
+ data.tar.gz: a34c8e7e8ab5f4bcb95903ef2cdbc4185e97ab391f55aefb403bffeb39071e3c
5
5
  SHA512:
6
- metadata.gz: 76541d16ef2c5b0e167f819306a4bcdf7ccc2d253eec34e8b442f70a27a3090b04722d3dd01e9d7b05d39408b2dc3b2cda7a9f4a81b77883ce289fb6929395ca
7
- data.tar.gz: 1dad051905cc2721348fb90bd5ae758093b16aca56c5f435661bdfdeda05456ee198eb66fa0d46c49993d95e0ec5b798c50aef49d9104b553ff192f28fede4c0
6
+ metadata.gz: 8edfef0c1e20620b4a79afb43657f96d7cc4d783b34b3f0d66aa18aff07cf7fa1b358c4079e899ac1dc57ef082c146d4f1abac87de3cab3a2ba5ef7b6d4b5572
7
+ data.tar.gz: 32c965caf76d0e5b99e2390cbd3cff57c5dddd14a78c49bae54ec37f4968d735e73b8a67dda45f91f1569d452282ad727f9fea9f8048ce4bf8499a4fb6c75019
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:
@@ -113,8 +113,11 @@ module RelatonIeee
113
113
  #
114
114
  # @return [Array<RelatonBib::DocumentIdentifier>]
115
115
  #
116
- def parse_docid
117
- ids = [{ id: pubid.to_s, type: "IEEE", primary: true }]
116
+ def parse_docid # rubocop:disable Metrics/MethodLength
117
+ ids = [
118
+ { id: pubid.to_s, type: "IEEE", primary: true },
119
+ { id: pubid.to_s(trademark: true), scope: "trademark", type: "IEEE", primary: true },
120
+ ]
118
121
  isbn = doc.at("./publicationinfo/isbn")
119
122
  ids << { id: isbn.text, type: "ISBN" } if isbn
120
123
  doi = doc.at("./volume/article/articleinfo/articledoi")
@@ -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
@@ -48,15 +48,20 @@ module RelatonIeee
48
48
  #
49
49
  # PubId string representation
50
50
  #
51
+ # @param [Boolean] trademark if true, add trademark symbol
52
+ #
51
53
  # @return [String]
52
54
  #
53
- def to_s # rubocop:disable Metrics/AbcSize
55
+ def to_s(trademark: false) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
54
56
  out = number
55
57
  out = "#{stage} #{out}" if stage
56
58
  out = "#{approval} #{out}" if approval
57
59
  out = "#{status} #{out}" if status
58
60
  out = "#{publisher} #{out}" if publisher
59
- out += "-#{part}" if part
61
+ out += ".#{part}" if part
62
+ if trademark
63
+ out += out.match?(/^IEEE\s(Std\s)?(802|2030)/) ? "\u00AE" : "\u2122"
64
+ end
60
65
  out += edition_to_s + draft_to_s + rev_to_s + corr_to_s + amd_to_s
61
66
  out + year_to_s + month_to_s + redline_to_s
62
67
  end
@@ -82,7 +87,7 @@ module RelatonIeee
82
87
  end
83
88
 
84
89
  def year_to_s
85
- year ? ".#{year}" : ""
90
+ year ? "-#{year}" : ""
86
91
  end
87
92
 
88
93
  def month_to_s
@@ -120,10 +125,12 @@ module RelatonIeee
120
125
  #
121
126
  # PubId string representation
122
127
  #
128
+ # @param [Boolean] trademark if true, add trademark symbol
129
+ #
123
130
  # @return [String]
124
131
  #
125
- def to_s
126
- pubid.map(&:to_s).join("/")
132
+ def to_s(trademark: false)
133
+ pubid.map { |id| id.to_s(trademark: trademark) }.join("/")
127
134
  end
128
135
 
129
136
  #
@@ -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
  #
@@ -471,9 +471,10 @@ module RelatonIeee
471
471
  def yn(year)
472
472
  return year if year.size == 4
473
473
 
474
+ y = Date.today.year.to_s[2..4].to_i + 1
474
475
  case year.to_i
475
- when 0..25 then "20#{year}"
476
- when 26..99 then "19#{year}"
476
+ when 0...y then "20#{year}"
477
+ when y..99 then "19#{year}"
477
478
  end
478
479
  end
479
480
 
@@ -496,7 +497,7 @@ module RelatonIeee
496
497
  #
497
498
  # @param [Strin] edition
498
499
  #
499
- # @return [String]
500
+ # @return [String, Integer]
500
501
  #
501
502
  def en(edition)
502
503
  case edition
@@ -39,7 +39,12 @@ 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
+ ids = [RelatonBib::DocumentIdentifier.new(**args)]
44
+ args[:scope] = "trademark"
45
+ tm = ref.match?(/^IEEE\s(Std\s)?(802|2030)/) ? "\u00AE" : "\u2122"
46
+ args[:id] = ref.sub(/^(IEEE\s(?:Std\s)?[.\w]+)/) { |s| "#{s}#{tm}" }
47
+ ids << RelatonBib::DocumentIdentifier.new(**args)
43
48
  end
44
49
 
45
50
  # @param url [String]
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.12.1".freeze
2
+ VERSION = "1.12.4".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.1
4
+ version: 1.12.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: 2022-07-05 00:00:00.000000000 Z
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml