relaton-ieee 1.16.3 → 1.17.0

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: f7048767fa74b6c8decd55108cf55dcd3e8547d37fb929b673f7b7721ed67f57
4
- data.tar.gz: c04a8ba724bbd38e0de394b80a319d629f9f42045ac6133861ee1d4ae6247103
3
+ metadata.gz: 41489a776527ad2557741bb5ba6b8a0d8514932bb4e277ed3d03614e9f6f510b
4
+ data.tar.gz: 7e050cf0a1bc84f8deafab900409193b3da2b71287db6c357eeddb4352dc416a
5
5
  SHA512:
6
- metadata.gz: 2384b71e26cbc6c95ad6fccff1852971d442c3c445578f26a2d380fbc54913665ed1e7c7240978da31dd567a5f327b8736485b03c6636ff25d7ffb67716963dc
7
- data.tar.gz: 63d840ef41faaf02d8680f7dbb81a341e0e51dc681b284d8d07628fe5cdbce9529189f08561c79144d143632566e7473bab04ac34a6acc8ef87427e617f87a45
6
+ metadata.gz: b13f7c2d72ea184c77e030c14f59506c105852fb4834589fe97e5d2aa5165c6766cbfa1ea0682ba380f13f796e28ee3c12be8ed4f153ed3a0af6fe1c92ed6792
7
+ data.tar.gz: 1e4ba5189ee5ae4d5fde0f3cb05cf71bef9f505d5bb9ea6719c146ced9faa16808e3c4bbf4cc80dbe324decc55d668397faba131b62fda7f6c0760010c53c9e3
data/3185.zip ADDED
Binary file
@@ -346,6 +346,8 @@
346
346
  <ref name="keyword"/>
347
347
  <ref name="xref"/>
348
348
  <ref name="hyperlink"/>
349
+ <ref name="index"/>
350
+ <ref name="index-xref"/>
349
351
  </choice>
350
352
  </oneOrMore>
351
353
  </element>
@@ -623,6 +625,8 @@
623
625
  <ref name="eref"/>
624
626
  <ref name="xref"/>
625
627
  <ref name="hyperlink"/>
628
+ <ref name="index"/>
629
+ <ref name="index-xref"/>
626
630
  </choice>
627
631
  </zeroOrMore>
628
632
  </element>
@@ -636,6 +640,8 @@
636
640
  <ref name="eref"/>
637
641
  <ref name="xref"/>
638
642
  <ref name="hyperlink"/>
643
+ <ref name="index"/>
644
+ <ref name="index-xref"/>
639
645
  </choice>
640
646
  </zeroOrMore>
641
647
  </element>
@@ -648,6 +654,8 @@
648
654
  <ref name="eref"/>
649
655
  <ref name="xref"/>
650
656
  <ref name="hyperlink"/>
657
+ <ref name="index"/>
658
+ <ref name="index-xref"/>
651
659
  </choice>
652
660
  </zeroOrMore>
653
661
  </element>
@@ -655,7 +663,11 @@
655
663
  <define name="keyword">
656
664
  <element name="keyword">
657
665
  <zeroOrMore>
658
- <ref name="PureTextElement"/>
666
+ <choice>
667
+ <ref name="PureTextElement"/>
668
+ <ref name="index"/>
669
+ <ref name="index-xref"/>
670
+ </choice>
659
671
  </zeroOrMore>
660
672
  </element>
661
673
  </define>
@@ -676,7 +688,11 @@
676
688
  <define name="strike">
677
689
  <element name="strike">
678
690
  <zeroOrMore>
679
- <ref name="PureTextElement"/>
691
+ <choice>
692
+ <ref name="PureTextElement"/>
693
+ <ref name="index"/>
694
+ <ref name="index-xref"/>
695
+ </choice>
680
696
  </zeroOrMore>
681
697
  </element>
682
698
  </define>
data/grammars/biblio.rng CHANGED
@@ -942,6 +942,7 @@
942
942
  <value>obsoleted</value>
943
943
  <value>confirmed</value>
944
944
  <value>updated</value>
945
+ <value>corrected</value>
945
946
  <value>issued</value>
946
947
  <value>transmitted</value>
947
948
  <value>copied</value>
@@ -153,17 +153,25 @@ module RelatonIeee
153
153
  doc.xpath("./publicationinfo/publisher").map do |contrib|
154
154
  n = contrib.at("./publishername").text
155
155
  addr = contrib.xpath("./address").each_with_object([]) do |adr, ob|
156
- city = adr.at("./city")
157
- next unless city
156
+ city, country, state = parse_country_city adr
157
+ next unless city && country
158
158
 
159
- ob << RelatonBib::Address.new(street: [], city: city.text,
160
- country: adr.at("./country").text)
159
+ ob << RelatonBib::Address.new(street: [], city: city, state: state, country: country)
161
160
  end
162
161
  e = create_org n, addr
163
162
  RelatonBib::ContributionInfo.new entity: e, role: [type: "publisher"]
164
163
  end
165
164
  end
166
165
 
166
+ def parse_country_city(address)
167
+ city = address.at("./city")
168
+ return unless city
169
+
170
+ city, state = city.text.split(", ")
171
+ country = address.at("./country")&.text || "USA"
172
+ [city, country, state]
173
+ end
174
+
167
175
  #
168
176
  # Create organization
169
177
  #
@@ -335,7 +343,8 @@ module RelatonIeee
335
343
  # @return [String] doctype
336
344
  #
337
345
  def parse_doctype
338
- parse_standard_modified == "Redline" ? "redline" : "standard"
346
+ type = parse_standard_modified == "Redline" ? "redline" : "standard"
347
+ DocumentType.new type: type
339
348
  end
340
349
  end
341
350
  end
@@ -0,0 +1,17 @@
1
+ module RelatonIeee
2
+ class DocumentType < RelatonBib::DocumentType
3
+ DOCTYPES = %w[guide recommended-practice standard witepaper redline other].freeze
4
+
5
+ def initialize(type:, abbreviation: nil)
6
+ check_type type
7
+ super
8
+ end
9
+
10
+ def check_type(type)
11
+ unless DOCTYPES.include? type
12
+ Util.warn "Invalid doctype: `#{type}`. " \
13
+ "It should be one of: `#{DOCTYPES.join('`, `')}`."
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,40 +1,44 @@
1
1
  module RelatonIeee
2
- class HashConverter < RelatonBib::HashConverter
3
- class << self
4
- # @param args [Hash]
5
- # @param neated [TrueClas, FalseClass] default true
6
- # @return [Hash]
7
- def hash_to_bib(args)
8
- hash = super
9
- return unless hash.is_a?(Hash)
2
+ module HashConverter
3
+ include RelatonBib::HashConverter
4
+ extend self
5
+ # @param args [Hash]
6
+ # @param neated [TrueClas, FalseClass] default true
7
+ # @return [Hash]
8
+ def hash_to_bib(args)
9
+ hash = super
10
+ return unless hash.is_a?(Hash)
10
11
 
11
- # editorialgroup_hash_to_bib hash
12
- ext_hash_to_bib hash
13
- hash
14
- end
12
+ # editorialgroup_hash_to_bib hash
13
+ ext_hash_to_bib hash
14
+ hash
15
+ end
15
16
 
16
- # @param item_hash [Hash]
17
- # @return [RelatonIeee::IeeeBibliographicItem]
18
- def bib_item(item_hash)
19
- IeeeBibliographicItem.new(**item_hash)
20
- end
17
+ # @param item_hash [Hash]
18
+ # @return [RelatonIeee::IeeeBibliographicItem]
19
+ def bib_item(item_hash)
20
+ IeeeBibliographicItem.new(**item_hash)
21
+ end
21
22
 
22
- # @param hash [Hash]
23
- def editorialgroup_hash_to_bib(hash)
24
- return unless hash[:editorialgroup]
23
+ # @param hash [Hash]
24
+ def editorialgroup_hash_to_bib(hash)
25
+ return unless hash[:editorialgroup]
25
26
 
26
- hash[:editorialgroup] = EditorialGroup.new(**hash[:editorialgroup])
27
- end
27
+ hash[:editorialgroup] = EditorialGroup.new(**hash[:editorialgroup])
28
+ end
28
29
 
29
- def ext_hash_to_bib(hash)
30
- ext = hash.delete(:ext)
31
- return unless ext
30
+ def ext_hash_to_bib(hash)
31
+ ext = hash.delete(:ext)
32
+ return unless ext
32
33
 
33
- attrs = %i[standard_status standard_modified pubstatus holdstatus]
34
- ext.select { |k, _| attrs.include? k }.each do |k, v|
35
- hash[k] = v
36
- end
34
+ attrs = %i[standard_status standard_modified pubstatus holdstatus]
35
+ ext.select { |k, _| attrs.include? k }.each do |k, v|
36
+ hash[k] = v
37
37
  end
38
38
  end
39
+
40
+ def create_doctype(**args)
41
+ DocumentType.new(**args)
42
+ end
39
43
  end
40
44
  end
@@ -1,6 +1,5 @@
1
1
  module RelatonIeee
2
2
  class IeeeBibliographicItem < RelatonBib::BibliographicItem
3
- DOCTYPES = %w[guide recommended-practice standard witepaper redline other].freeze
4
3
  SUBTYPES = %w[amendment corrigendum erratum].freeze
5
4
 
6
5
  # @return [RelatonIeee::EditorialGroup, nil]
@@ -24,10 +23,6 @@ module RelatonIeee
24
23
  # @option args [String, nil] :holdstatus Held, Publish
25
24
  #
26
25
  def initialize(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
27
- if args[:doctype] && !DOCTYPES.include?(args[:doctype])
28
- Util.warn "Invalid doctype: `#{args[:doctype]}`. " \
29
- "It should be one of: `#{DOCTYPES.join('`, `')}`."
30
- end
31
26
  if args[:docsubtype] && !SUBTYPES.include?(args[:docsubtype])
32
27
  Util.warn "Invalid docsubtype: `#{args[:docsubtype]}`. " \
33
28
  "It should be one of: `#{SUBTYPES.join('`, `')}`."
@@ -68,7 +63,7 @@ module RelatonIeee
68
63
  if opts[:bibdata] && (doctype || subdoctype || !trialuse.nil? || editorialgroup ||
69
64
  ics.any? || standard_status || standard_modified || pubstatus || holdstatus)
70
65
  ext = bldr.ext do |b|
71
- b.doctype doctype if doctype
66
+ doctype&.to_xml b
72
67
  b.subdoctype subdoctype if subdoctype
73
68
  b.send :"trial-use", trialuse unless trialuse.nil?
74
69
  editorialgroup&.to_xml(b)
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.16.3".freeze
2
+ VERSION = "1.17.0".freeze
3
3
  end
data/lib/relaton_ieee.rb CHANGED
@@ -6,6 +6,7 @@ require "relaton_bib"
6
6
  require "relaton_ieee/version"
7
7
  require "relaton_ieee/config"
8
8
  require "relaton_ieee/util"
9
+ require "relaton_ieee/document_type"
9
10
  require "relaton_ieee/document_status"
10
11
  require "relaton_ieee/ieee_bibliography"
11
12
  require "relaton_ieee/ieee_bibliographic_item"
data/relaton_ieee.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_dependency "faraday", "~> 2.7.0"
35
35
  spec.add_dependency "mini_portile2", "~> 2.8.0"
36
- spec.add_dependency "relaton-bib", "~> 1.16.0"
36
+ spec.add_dependency "relaton-bib", "~> 1.17.0"
37
37
  spec.add_dependency "relaton-index", "~> 0.2.0"
38
38
  spec.add_dependency "rubyzip", "~> 2.3.0"
39
39
  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.16.3
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
11
+ date: 2023-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.16.0
47
+ version: 1.17.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.16.0
54
+ version: 1.17.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: relaton-index
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +93,7 @@ files:
93
93
  - ".gitignore"
94
94
  - ".rspec"
95
95
  - ".rubocop.yml"
96
+ - 3185.zip
96
97
  - Gemfile
97
98
  - LICENSE.txt
98
99
  - README.adoc
@@ -112,6 +113,7 @@ files:
112
113
  - lib/relaton_ieee/data_fetcher.rb
113
114
  - lib/relaton_ieee/data_parser.rb
114
115
  - lib/relaton_ieee/document_status.rb
116
+ - lib/relaton_ieee/document_type.rb
115
117
  - lib/relaton_ieee/editorial_group.rb
116
118
  - lib/relaton_ieee/hash_converter.rb
117
119
  - lib/relaton_ieee/ieee_bibliographic_item.rb