relaton-ieee 1.12.3 → 1.12.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: ae6ce7435bdf251b1180ba075e3585f7075c289ab5ad58bbf7e26706d3fe10fe
4
- data.tar.gz: b6475b2c93336560e490fea100879389d4323a7854180114d724443af0332e52
3
+ metadata.gz: e06d850cd175596e9f8a50c8a88000ecd646fb4e9059082e26248269fb045380
4
+ data.tar.gz: a34c8e7e8ab5f4bcb95903ef2cdbc4185e97ab391f55aefb403bffeb39071e3c
5
5
  SHA512:
6
- metadata.gz: 7a630fdfff66077109cbbbad786783488c79a687de9d60b75b1ed42b03a46ab98c11542abbdbb7497dbe3220183d1512f7457339edfad3b459591fe2a3c06676
7
- data.tar.gz: f2027e366b04f6cc59c0e219526082d9f171d22fdbbf91c42077b07e0c37a8508a715f8fb9eb7ae55c50eaf8974970fff15b7f6ade8389438061aaceace766fc
6
+ metadata.gz: 8edfef0c1e20620b4a79afb43657f96d7cc4d783b34b3f0d66aa18aff07cf7fa1b358c4079e899ac1dc57ef082c146d4f1abac87de3cab3a2ba5ef7b6d4b5572
7
+ data.tar.gz: 32c965caf76d0e5b99e2390cbd3cff57c5dddd14a78c49bae54ec37f4968d735e73b8a67dda45f91f1569d452282ad727f9fea9f8048ce4bf8499a4fb6c75019
@@ -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")
@@ -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
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
@@ -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
  #
@@ -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
@@ -40,8 +40,11 @@ module RelatonIeee
40
40
  # @return [Array<RelatonBib::DocumentIdentifier>]
41
41
  def fetch_docid(ref)
42
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
+ 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)
45
48
  end
46
49
 
47
50
  # @param url [String]
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.12.3".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.3
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-06 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