relaton-ieee 1.16.2 → 1.17.0
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/3185.zip +0 -0
- data/grammars/basicdoc.rng +18 -2
- data/grammars/biblio.rng +1 -0
- data/lib/relaton_ieee/data_parser.rb +14 -5
- data/lib/relaton_ieee/document_type.rb +17 -0
- data/lib/relaton_ieee/hash_converter.rb +33 -29
- data/lib/relaton_ieee/ieee_bibliographic_item.rb +1 -6
- data/lib/relaton_ieee/processor.rb +1 -1
- data/lib/relaton_ieee/version.rb +1 -1
- data/lib/relaton_ieee.rb +1 -0
- data/relaton_ieee.gemspec +1 -1
- metadata +6 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 41489a776527ad2557741bb5ba6b8a0d8514932bb4e277ed3d03614e9f6f510b
         | 
| 4 | 
            +
              data.tar.gz: 7e050cf0a1bc84f8deafab900409193b3da2b71287db6c357eeddb4352dc416a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b13f7c2d72ea184c77e030c14f59506c105852fb4834589fe97e5d2aa5165c6766cbfa1ea0682ba380f13f796e28ee3c12be8ed4f153ed3a0af6fe1c92ed6792
         | 
| 7 | 
            +
              data.tar.gz: 1e4ba5189ee5ae4d5fde0f3cb05cf71bef9f505d5bb9ea6719c146ced9faa16808e3c4bbf4cc80dbe324decc55d668397faba131b62fda7f6c0760010c53c9e3
         | 
    
        data/3185.zip
    ADDED
    
    | Binary file | 
    
        data/grammars/basicdoc.rng
    CHANGED
    
    | @@ -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 | 
            -
                    < | 
| 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 | 
            -
                    < | 
| 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
    
    
| @@ -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 | 
| 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 | 
| 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 | 
            -
               | 
| 3 | 
            -
                 | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 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 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 12 | 
            +
                  # editorialgroup_hash_to_bib hash
         | 
| 13 | 
            +
                  ext_hash_to_bib hash
         | 
| 14 | 
            +
                  hash
         | 
| 15 | 
            +
                end
         | 
| 15 16 |  | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 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 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 23 | 
            +
                # @param hash [Hash]
         | 
| 24 | 
            +
                def editorialgroup_hash_to_bib(hash)
         | 
| 25 | 
            +
                  return unless hash[:editorialgroup]
         | 
| 25 26 |  | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 27 | 
            +
                  hash[:editorialgroup] = EditorialGroup.new(**hash[:editorialgroup])
         | 
| 28 | 
            +
                end
         | 
| 28 29 |  | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 30 | 
            +
                def ext_hash_to_bib(hash)
         | 
| 31 | 
            +
                  ext = hash.delete(:ext)
         | 
| 32 | 
            +
                  return unless ext
         | 
| 32 33 |  | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 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 | 
            -
                         | 
| 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)
         | 
| @@ -7,7 +7,7 @@ module RelatonIeee | |
| 7 7 | 
             
                def initialize # rubocop:disable Lint/MissingSuper
         | 
| 8 8 | 
             
                  @short = :relaton_ieee
         | 
| 9 9 | 
             
                  @prefix = "IEEE"
         | 
| 10 | 
            -
                  @defaultprefix = %r{^(?:ANSI/)?IEEE\s}
         | 
| 10 | 
            +
                  @defaultprefix = %r{^(?:(?:(?:ANSI|NACE)/)?IEEE|ANSI|AIEE|ASA|NACE|IRE)\s}
         | 
| 11 11 | 
             
                  @idtype = "IEEE"
         | 
| 12 12 | 
             
                  @datasets = %w[ieee-rawbib]
         | 
| 13 13 | 
             
                end
         | 
    
        data/lib/relaton_ieee/version.rb
    CHANGED
    
    
    
        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. | 
| 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. | 
| 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 | 
            +
            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. | 
| 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. | 
| 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
         |