relaton-ieee 1.13.1 → 1.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +26 -85
- data/grammars/basicdoc.rng +3 -27
- data/grammars/biblio-standoc.rng +164 -0
- data/grammars/biblio.rng +82 -19
- data/grammars/relaton-ieee-compile.rng +11 -0
- data/grammars/relaton-ieee.rng +151 -0
- data/lib/relaton_ieee/data_parser.rb +8 -7
- data/lib/relaton_ieee/ieee_bibliographic_item.rb +18 -2
- data/lib/relaton_ieee/ieee_bibliography.rb +4 -2
- data/lib/relaton_ieee/version.rb +1 -1
- data/lib/relaton_ieee.rb +0 -1
- data/relaton_ieee.gemspec +3 -1
- metadata +39 -12
- data/grammars/isodoc.rng +0 -2807
- data/grammars/reqt.rng +0 -223
- data/lib/relaton_ieee/hit.rb +0 -9
- data/lib/relaton_ieee/scrapper.rb +0 -154
@@ -0,0 +1,151 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
+
<include href="biblio-standoc.rng">
|
4
|
+
<define name="DocumentType">
|
5
|
+
<choice>
|
6
|
+
<value>guide</value>
|
7
|
+
<value>recommended-practice</value>
|
8
|
+
<value>standard</value>
|
9
|
+
<value>whitepaper</value>
|
10
|
+
<value>redline</value>
|
11
|
+
<value>other</value>
|
12
|
+
</choice>
|
13
|
+
</define>
|
14
|
+
<define name="stage">
|
15
|
+
<element name="stage">
|
16
|
+
<choice>
|
17
|
+
<value>draft</value>
|
18
|
+
<value>approved</value>
|
19
|
+
<value>superseded</value>
|
20
|
+
<value>withdrawn</value>
|
21
|
+
</choice>
|
22
|
+
</element>
|
23
|
+
</define>
|
24
|
+
<define name="editorialgroup">
|
25
|
+
<element name="editorialgroup">
|
26
|
+
<optional>
|
27
|
+
<ref name="society"/>
|
28
|
+
</optional>
|
29
|
+
<optional>
|
30
|
+
<ref name="balloting-group"/>
|
31
|
+
</optional>
|
32
|
+
<optional>
|
33
|
+
<ref name="working-group"/>
|
34
|
+
</optional>
|
35
|
+
<oneOrMore>
|
36
|
+
<ref name="committee"/>
|
37
|
+
</oneOrMore>
|
38
|
+
</element>
|
39
|
+
</define>
|
40
|
+
<define name="DocumentSubtype">
|
41
|
+
<choice>
|
42
|
+
<value>amendment</value>
|
43
|
+
<value>corrigendum</value>
|
44
|
+
<value>erratum</value>
|
45
|
+
</choice>
|
46
|
+
</define>
|
47
|
+
<define name="BibDataExtensionType">
|
48
|
+
<optional>
|
49
|
+
<attribute name="schema-version"/>
|
50
|
+
</optional>
|
51
|
+
<optional>
|
52
|
+
<ref name="doctype"/>
|
53
|
+
</optional>
|
54
|
+
<optional>
|
55
|
+
<ref name="docsubtype"/>
|
56
|
+
</optional>
|
57
|
+
<optional>
|
58
|
+
<ref name="trialuse"/>
|
59
|
+
</optional>
|
60
|
+
<optional>
|
61
|
+
<ref name="editorialgroup"/>
|
62
|
+
</optional>
|
63
|
+
<zeroOrMore>
|
64
|
+
<ref name="ics"/>
|
65
|
+
</zeroOrMore>
|
66
|
+
<optional>
|
67
|
+
<ref name="standard_status"/>
|
68
|
+
</optional>
|
69
|
+
<optional>
|
70
|
+
<ref name="standard_modified"/>
|
71
|
+
</optional>
|
72
|
+
<optional>
|
73
|
+
<ref name="pubstatus"/>
|
74
|
+
</optional>
|
75
|
+
<optional>
|
76
|
+
<ref name="holdstatus"/>
|
77
|
+
</optional>
|
78
|
+
</define>
|
79
|
+
</include>
|
80
|
+
<define name="standard_status">
|
81
|
+
<element name="standard_status">
|
82
|
+
<choice>
|
83
|
+
<value>Inactive</value>
|
84
|
+
<value>Active</value>
|
85
|
+
<value>Superseded</value>
|
86
|
+
</choice>
|
87
|
+
</element>
|
88
|
+
</define>
|
89
|
+
<define name="standard_modified">
|
90
|
+
<element name="standard_modified">
|
91
|
+
<choice>
|
92
|
+
<value>Draft</value>
|
93
|
+
<value>Withdrawn</value>
|
94
|
+
<value>Superseded</value>
|
95
|
+
<value>Approved</value>
|
96
|
+
<value>Reserved</value>
|
97
|
+
<value>Redline</value>
|
98
|
+
</choice>
|
99
|
+
</element>
|
100
|
+
</define>
|
101
|
+
<define name="pubstatus">
|
102
|
+
<element name="pubstatus">
|
103
|
+
<choice>
|
104
|
+
<value>Active</value>
|
105
|
+
<value>Inactive</value>
|
106
|
+
</choice>
|
107
|
+
</element>
|
108
|
+
</define>
|
109
|
+
<define name="holdstatus">
|
110
|
+
<element name="holdstatus">
|
111
|
+
<choice>
|
112
|
+
<value>Hold</value>
|
113
|
+
<value>Publish</value>
|
114
|
+
</choice>
|
115
|
+
</element>
|
116
|
+
</define>
|
117
|
+
<define name="BibliographicDateType" combine="choice">
|
118
|
+
<value>feedback-ended</value>
|
119
|
+
</define>
|
120
|
+
<define name="trialuse">
|
121
|
+
<element name="trial-use">
|
122
|
+
<data type="boolean"/>
|
123
|
+
</element>
|
124
|
+
</define>
|
125
|
+
<define name="balloting-group">
|
126
|
+
<element name="balloting-group">
|
127
|
+
<attribute name="type">
|
128
|
+
<choice>
|
129
|
+
<value>individual</value>
|
130
|
+
<value>entity</value>
|
131
|
+
</choice>
|
132
|
+
</attribute>
|
133
|
+
<text/>
|
134
|
+
</element>
|
135
|
+
</define>
|
136
|
+
<define name="working-group">
|
137
|
+
<element name="working-group">
|
138
|
+
<text/>
|
139
|
+
</element>
|
140
|
+
</define>
|
141
|
+
<define name="committee">
|
142
|
+
<element name="committee">
|
143
|
+
<text/>
|
144
|
+
</element>
|
145
|
+
</define>
|
146
|
+
<define name="society">
|
147
|
+
<element name="society">
|
148
|
+
<text/>
|
149
|
+
</element>
|
150
|
+
</define>
|
151
|
+
</grammar>
|
@@ -157,12 +157,12 @@ module RelatonIeee
|
|
157
157
|
def parse_contributor # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
158
158
|
doc.xpath("./publicationinfo/publisher").map do |contrib|
|
159
159
|
n = contrib.at("./publishername").text
|
160
|
-
addr = contrib.xpath("./address").
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
160
|
+
addr = contrib.xpath("./address").each_with_object([]) do |adr, ob|
|
161
|
+
city = adr.at("./city")
|
162
|
+
next unless city
|
163
|
+
|
164
|
+
ob << RelatonBib::Address.new(street: [], city: city.text,
|
165
|
+
country: adr.at("./country").text)
|
166
166
|
end
|
167
167
|
e = create_org n, addr
|
168
168
|
RelatonBib::ContributionInfo.new entity: e, role: [type: "publisher"]
|
@@ -228,7 +228,8 @@ module RelatonIeee
|
|
228
228
|
# @return [RelatonBib::DocumentStatus]
|
229
229
|
#
|
230
230
|
def parse_status
|
231
|
-
stage = doc.at("./publicationinfo/standard_status").text
|
231
|
+
stage = doc.at("./publicationinfo/standard_status").text.downcase
|
232
|
+
stage.sub!("active", "approved").sub! "inactive", "withdrawn"
|
232
233
|
DocumentStatus.new stage: stage
|
233
234
|
end
|
234
235
|
|
@@ -30,6 +30,15 @@ module RelatonIeee
|
|
30
30
|
@editorialgroup = eg
|
31
31
|
end
|
32
32
|
|
33
|
+
#
|
34
|
+
# Fetch flavor schema version
|
35
|
+
#
|
36
|
+
# @return [String] flavor schema version
|
37
|
+
#
|
38
|
+
def ext_schema
|
39
|
+
@ext_schema ||= schema_versions["relaton-model-ieee"]
|
40
|
+
end
|
41
|
+
|
33
42
|
# @param hash [Hash]
|
34
43
|
# @return [RelatonIeee::IeeeBibliographicItem]
|
35
44
|
def self.from_hash(hash)
|
@@ -45,19 +54,26 @@ module RelatonIeee
|
|
45
54
|
def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
46
55
|
super(**opts) do |bldr|
|
47
56
|
if opts[:bibdata] && (doctype || subdoctype || !trialuse.nil? || editorialgroup || ics.any?)
|
48
|
-
bldr.ext do |b|
|
57
|
+
ext = bldr.ext do |b|
|
49
58
|
b.doctype doctype if doctype
|
50
59
|
b.subdoctype subdoctype if subdoctype
|
51
60
|
b.send :"trial-use", trialuse unless trialuse.nil?
|
52
61
|
editorialgroup&.to_xml(b)
|
53
62
|
ics.each { |ic| ic.to_xml(b) }
|
54
63
|
end
|
64
|
+
ext["schema-version"] = ext_schema unless opts[:embedded]
|
55
65
|
end
|
56
66
|
end
|
57
67
|
end
|
58
68
|
|
69
|
+
#
|
70
|
+
# Rnder as Hash
|
71
|
+
#
|
72
|
+
# @param embedded [Boolean] emmbedded in other document
|
73
|
+
#
|
59
74
|
# @return [Hash]
|
60
|
-
|
75
|
+
#
|
76
|
+
def to_hash(embedded: false)
|
61
77
|
hash = super
|
62
78
|
hash["trialuse"] = trialuse unless trialuse.nil?
|
63
79
|
hash
|
@@ -8,7 +8,7 @@ module RelatonIeee
|
|
8
8
|
#
|
9
9
|
# @param code [String]
|
10
10
|
#
|
11
|
-
# @return [RelatonIeee::
|
11
|
+
# @return [RelatonIeee::IeeeBibliographicItem]
|
12
12
|
#
|
13
13
|
def search(code)
|
14
14
|
ref = code.sub(/Std\s/i, "").gsub(/[\s,:\/]/, "_").squeeze("_").upcase
|
@@ -16,7 +16,9 @@ module RelatonIeee
|
|
16
16
|
resp = Faraday.get url
|
17
17
|
return unless resp.status == 200
|
18
18
|
|
19
|
-
|
19
|
+
hash = YAML.safe_load resp.body
|
20
|
+
hash["fetched"] = Date.today.to_s
|
21
|
+
IeeeBibliographicItem.from_hash hash
|
20
22
|
rescue Faraday::ConnectionFailed
|
21
23
|
raise RelatonBib::RequestError, "Could not access #{GH_URL}"
|
22
24
|
end
|
data/lib/relaton_ieee/version.rb
CHANGED
data/lib/relaton_ieee.rb
CHANGED
@@ -5,7 +5,6 @@ require "relaton_bib"
|
|
5
5
|
require "relaton_ieee/version"
|
6
6
|
require "relaton_ieee/document_status"
|
7
7
|
require "relaton_ieee/ieee_bibliography"
|
8
|
-
# require "relaton_ieee/scrapper"
|
9
8
|
require "relaton_ieee/ieee_bibliographic_item"
|
10
9
|
require "relaton_ieee/editorial_group"
|
11
10
|
require "relaton_ieee/balloting_group"
|
data/relaton_ieee.gemspec
CHANGED
@@ -33,12 +33,14 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
35
35
|
spec.add_development_dependency "pry-byebug"
|
36
|
+
spec.add_development_dependency "ruby-jing"
|
36
37
|
spec.add_development_dependency "simplecov"
|
37
38
|
spec.add_development_dependency "vcr"
|
38
39
|
spec.add_development_dependency "webmock"
|
40
|
+
spec.add_development_dependency "webrick"
|
39
41
|
|
40
42
|
spec.add_dependency "faraday", "~> 1.0"
|
41
43
|
spec.add_dependency "mini_portile2"
|
42
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
44
|
+
spec.add_dependency "relaton-bib", "~> 1.14.0"
|
43
45
|
spec.add_dependency "rubyzip", "~> 2.3.0"
|
44
46
|
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.
|
4
|
+
version: 1.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby-jing
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: simplecov
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,20 @@ dependencies:
|
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webrick
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: faraday
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +142,14 @@ dependencies:
|
|
114
142
|
requirements:
|
115
143
|
- - "~>"
|
116
144
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
145
|
+
version: 1.14.0
|
118
146
|
type: :runtime
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
150
|
- - "~>"
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
152
|
+
version: 1.14.0
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: rubyzip
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,9 +185,10 @@ files:
|
|
157
185
|
- bin/rspec
|
158
186
|
- bin/setup
|
159
187
|
- grammars/basicdoc.rng
|
188
|
+
- grammars/biblio-standoc.rng
|
160
189
|
- grammars/biblio.rng
|
161
|
-
- grammars/
|
162
|
-
- grammars/
|
190
|
+
- grammars/relaton-ieee-compile.rng
|
191
|
+
- grammars/relaton-ieee.rng
|
163
192
|
- lib/relaton_ieee.rb
|
164
193
|
- lib/relaton_ieee/balloting_group.rb
|
165
194
|
- lib/relaton_ieee/bibxml_parser.rb
|
@@ -168,13 +197,11 @@ files:
|
|
168
197
|
- lib/relaton_ieee/document_status.rb
|
169
198
|
- lib/relaton_ieee/editorial_group.rb
|
170
199
|
- lib/relaton_ieee/hash_converter.rb
|
171
|
-
- lib/relaton_ieee/hit.rb
|
172
200
|
- lib/relaton_ieee/ieee_bibliographic_item.rb
|
173
201
|
- lib/relaton_ieee/ieee_bibliography.rb
|
174
202
|
- lib/relaton_ieee/processor.rb
|
175
203
|
- lib/relaton_ieee/pub_id.rb
|
176
204
|
- lib/relaton_ieee/rawbib_id_parser.rb
|
177
|
-
- lib/relaton_ieee/scrapper.rb
|
178
205
|
- lib/relaton_ieee/version.rb
|
179
206
|
- lib/relaton_ieee/xml_parser.rb
|
180
207
|
- relaton_ieee.gemspec
|
@@ -184,7 +211,7 @@ licenses:
|
|
184
211
|
metadata:
|
185
212
|
homepage_uri: https://github.com/relaton/relaton-ieee
|
186
213
|
source_code_uri: https://github.com/relaton/relaton-ieee
|
187
|
-
post_install_message:
|
214
|
+
post_install_message:
|
188
215
|
rdoc_options: []
|
189
216
|
require_paths:
|
190
217
|
- lib
|
@@ -199,8 +226,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
226
|
- !ruby/object:Gem::Version
|
200
227
|
version: '0'
|
201
228
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
203
|
-
signing_key:
|
229
|
+
rubygems_version: 3.1.6
|
230
|
+
signing_key:
|
204
231
|
specification_version: 4
|
205
232
|
summary: 'RelatonIeee: retrieve IEEE Standards for bibliographic use using the IeeeBibliographicItem
|
206
233
|
model'
|