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 +4 -4
- data/README.adoc +1 -1
- data/lib/relaton_ieee/data_parser.rb +5 -2
- data/lib/relaton_ieee/pub_id.rb +13 -6
- data/lib/relaton_ieee/rawbib_id_parser.rb +5 -4
- data/lib/relaton_ieee/scrapper.rb +6 -1
- data/lib/relaton_ieee/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e06d850cd175596e9f8a50c8a88000ecd646fb4e9059082e26248269fb045380
|
4
|
+
data.tar.gz: a34c8e7e8ab5f4bcb95903ef2cdbc4185e97ab391f55aefb403bffeb39071e3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
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 = [
|
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")
|
data/lib/relaton_ieee/pub_id.rb
CHANGED
@@ -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 += "
|
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 ? "
|
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(
|
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
|
476
|
-
when
|
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
|
-
|
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]
|
data/lib/relaton_ieee/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|