relaton-bsi 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beee0d1d60affb54c0d473077b8b792271bd773a89462aa9668794a47c8c37b4
4
- data.tar.gz: 3f4a940e53481c52b6ff1d155a0ae1e9cccdc20a768753d59efb042beed7a80b
3
+ metadata.gz: 572e54dcc3a988ddc73f8a558b4e9c61fe7cbedb72de7cf766b75e3f8d17ed5b
4
+ data.tar.gz: b823fdaa3769c709e4dfe753a95c20e0de246d81f74f305f143e87db6c2d95bb
5
5
  SHA512:
6
- metadata.gz: d890a38ea4d5ba876d4e6e8497347e45bb3067aca5796f8c574a8d7de9e337836655158d9f3ce1ed1d1687c923750ee570b80994ea238be9e32df156bc6fd808
7
- data.tar.gz: c12c4a02bd22a07cd63378de4a2a701df11e119e12717e8e28d74b7c6ce453712c123b8b55a10675f3b78e7bce23aebbc0187bb79ef5366e43aab0de46e7e3a5
6
+ metadata.gz: 29b72f522e23bc75c3bd6fd5fbf3ad68ea2b56eff41748cfe6343387934a6f9c9d836cf9ecd8ae716e02e8aa24f265ab4263b13208e21a36c29a0d1d0e10ba51
7
+ data.tar.gz: 70a33418abcf63835650873bb1166c2f7a930cdb4514bbc66fefadd957044f5b4f5b6086596d2b3e319ad0ed039e80584bf74fdae1f6f25b48be9b3135e977ab
@@ -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>
@@ -1,12 +1,5 @@
1
1
  module RelatonBsi
2
2
  class BsiBibliographicItem < RelatonIsoBib::IsoBibliographicItem
3
- DOCTYPES = %w[
4
- british-standard draft-for-development published-document privately-subscribed-standard
5
- publicly-available-specification flex-standard international-standard technical-specification
6
- technical-report guide international-workshop-agreement industry-technical-agreement
7
- standard european-workshop-agreement fast-track-standard
8
- ].freeze
9
-
10
3
  SUBDOCTYPES = %w[specification method-of-test method-of-specifying vocabulary code-of-practice].freeze
11
4
 
12
5
  def initialize(**args) # rubocop:disable Metrics/AbcSize
@@ -53,10 +53,10 @@ module RelatonBsi
53
53
  private
54
54
 
55
55
  def fetch_ref_err(code, year, missed_years) # rubocop:disable Metrics/MethodLength
56
- y = code_parts(code)[:year]
57
- id = year && !y ? "#{code}:#{year}" : code
58
- Util.warn "WARNING: no match found online for `#{id}`. " \
59
- "The code must be exactly like it is on the standards website."
56
+ # y = code_parts(code)[:year]
57
+ # id = year && !y ? "#{code}:#{year}" : code
58
+ # Util.warn "WARNING: no match found online for `#{id}`. " \
59
+ # "The code must be exactly like it is on the standards website."
60
60
  unless missed_years.empty?
61
61
  Util.warn "There was no match for `#{year}`, though there " \
62
62
  "were matches found for `#{missed_years.join('`, `')}`."
@@ -0,0 +1,21 @@
1
+ module RelatonBsi
2
+ class DocumentType < RelatonBib::DocumentType
3
+ DOCTYPES = %w[
4
+ british-standard draft-for-development published-document privately-subscribed-standard
5
+ publicly-available-specification flex-standard international-standard technical-specification
6
+ technical-report guide international-workshop-agreement industry-technical-agreement
7
+ standard european-workshop-agreement fast-track-standard expert-commentary
8
+ ].freeze
9
+
10
+ def initialize(type:, abbreviation: nil)
11
+ check_type type
12
+ super
13
+ end
14
+
15
+ def check_type(type)
16
+ unless DOCTYPES.include? type
17
+ Util.warn "WARNING: invalid doctype: `#{type}`"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,16 +1,21 @@
1
1
  module RelatonBsi
2
- class HashConverter < RelatonIsoBib::HashConverter
3
- class << self
4
- private
2
+ module HashConverter
3
+ include RelatonIsoBib::HashConverter
4
+ extend self
5
5
 
6
- #
7
- # Ovverides superclass's method
8
- #
9
- # @param item [Hash]
10
- # @retirn [RelatonBsi::BsiBibliographicItem]
11
- def bib_item(item)
12
- BsiBibliographicItem.new(**item)
13
- end
6
+ private
7
+
8
+ #
9
+ # Ovverides superclass's method
10
+ #
11
+ # @param item [Hash]
12
+ # @retirn [RelatonBsi::BsiBibliographicItem]
13
+ def bib_item(item)
14
+ BsiBibliographicItem.new(**item)
15
+ end
16
+
17
+ def create_doctype(**args)
18
+ DocumentType.new(**args)
14
19
  end
15
20
  end
16
21
  end
@@ -10,7 +10,7 @@ module RelatonBsi
10
10
  end
11
11
 
12
12
  # @param code [String]
13
- # @param date [String, NilClass] year
13
+ # @param date [String, nil] year
14
14
  # @param opts [Hash]
15
15
  # @return [RelatonBsi::BsiBibliographicItem]
16
16
  def get(code, date, opts)
@@ -183,6 +183,10 @@ module RelatonBsi
183
183
  # @return [String] doctype
184
184
  #
185
185
  def fetch_doctype(hit)
186
+ DocumentType.new(type: doctype(hit))
187
+ end
188
+
189
+ def doctype(hit)
186
190
  case hit.hit[:code]
187
191
  when /(^|\s)Flex\s/ then "flex-standard"
188
192
  when /(^|\s)PAS\s/ then "publicly-available-specification"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonBsi
4
- VERSION = "1.16.2"
4
+ VERSION = "1.17.0"
5
5
  end
data/lib/relaton_bsi.rb CHANGED
@@ -4,6 +4,7 @@ require "relaton_iso_bib"
4
4
  require_relative "relaton_bsi/version"
5
5
  require "relaton_bsi/config"
6
6
  require "relaton_bsi/util"
7
+ require "relaton_bsi/document_type"
7
8
  require "relaton_bsi/bsi_bibliography"
8
9
  require "relaton_bsi/bsi_bibliographic_item"
9
10
  require "relaton_bsi/scrapper"
data/relaton_bsi.gemspec CHANGED
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "algolia", "~> 2.3.0"
33
33
  spec.add_dependency "graphql", "1.13.6"
34
34
  spec.add_dependency "graphql-client", "~> 0.16.0"
35
- spec.add_dependency "relaton-iso-bib", "~> 1.16.0"
35
+ spec.add_dependency "relaton-iso-bib", "~> 1.17.0"
36
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.2
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-10-07 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: algolia
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.16.0
61
+ version: 1.17.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.16.0
68
+ version: 1.17.0
69
69
  description: 'RelatonBsi: retrieve BSI Standards for bibliographic use using the BibliographicItem
70
70
  model'
71
71
  email:
@@ -95,6 +95,7 @@ files:
95
95
  - lib/relaton_bsi/bsi_bibliographic_item.rb
96
96
  - lib/relaton_bsi/bsi_bibliography.rb
97
97
  - lib/relaton_bsi/config.rb
98
+ - lib/relaton_bsi/document_type.rb
98
99
  - lib/relaton_bsi/hash_converter.rb
99
100
  - lib/relaton_bsi/hit.rb
100
101
  - lib/relaton_bsi/hit_collection.rb