relaton-calconnect 1.16.1 → 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: 61a4cc200fc734369371f45f1333152f0680a618d00789df5e2eb59d67ffedff
4
- data.tar.gz: 79b164ad5afcffd22d57d6ca80edf4cb17ceb7302151be4d9267633c835f4600
3
+ metadata.gz: 19125bb0584cd670fca9b33e70b08c02f03a24bd7a4c100f92ee068df874d78f
4
+ data.tar.gz: bcddbe3739ac22b47fecf70097569c180e2ed3ac83a92d2f801507bb362717a9
5
5
  SHA512:
6
- metadata.gz: 50e66f424c080ee02333e8af0c49b130c27303c0ec737191a0d201b2f111331748011f6835c0ab2f87fa56db3260fb795272b33576d1ef0b34fc9fb4914fe5af
7
- data.tar.gz: db45ccdedfa3f1885445592fe7ff5a0fed0305ffcfda55a0cee8bd083e55c64842817ebdde40a4191e9750bdf91aeea0e3be28ae1d051be67971ae8f9bce3791
6
+ metadata.gz: b55fc339e7072e6c179fd7759df271bbf8b5ca17e952cde6ae76d95ade6ddab4a48d3ee719d0e039b248635937d2dab094bcf938a35355c0ce799a641b9e5545
7
+ data.tar.gz: 60206cdfaa01221628834e8261713589411ff43d416b11f2c7270e9b4f27b7526647dc59ad459f5e81e3530497424eef192c6263335636322c7376313b090f79
data/README.adoc CHANGED
@@ -23,13 +23,24 @@ Or install it yourself as:
23
23
 
24
24
  == Usage
25
25
 
26
- === Search for a standard using keywords
26
+ === Configuration
27
+
28
+ Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonCalconnect.configure` block.
27
29
 
28
30
  [source,ruby]
29
31
  ----
30
32
  require 'relaton_calconnect'
31
33
  => true
32
34
 
35
+ RelatonCalconnect.configure do |config|
36
+ config.logger.level = Logger::DEBUG
37
+ end
38
+ ----
39
+
40
+ === Search for a standard using keywords
41
+
42
+ [source,ruby]
43
+ ----
33
44
  hits = RelatonCalconnect::CcBibliography.search("CC/DIR 10005:2019")
34
45
  => <RelatonCalconnect::HitCollection:0x007f98e34a8bb0 @ref=CC/DIR 10005:2019 @fetched=false>
35
46
 
@@ -91,8 +102,8 @@ item.link
91
102
  [source,ruby]
92
103
  ----
93
104
  RelatonCalconnect::CcBibliography.get "CC/DIR 10005", "2019", {}
94
- [relaton-calconnect] ("CC/DIR 10005") fetching...
95
- [relaton-calconnect] ("CC/DIR 10005") found CC/DIR 10005:2019
105
+ [relaton-calconnect] (CC/DIR 10005) Fetching from Relaton repository ...
106
+ [relaton-calconnect] (CC/DIR 10005) Found: `CC/DIR 10005:2019`
96
107
  => #<RelatonCalconnect::CcBibliographicItem:0x007f9a73dfa290
97
108
  ...
98
109
  ----
@@ -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,10 +1,5 @@
1
1
  module RelatonCalconnect
2
2
  class CcBibliographicItem < RelatonBib::BibliographicItem
3
- TYPES = %w[
4
- directive guide specification standard report administrative amendment
5
- technical\ corrigendum advisory
6
- ].freeze
7
-
8
3
  #
9
4
  # Fetch flavor schema version
10
5
  #
@@ -29,13 +29,14 @@ module RelatonCalconnect
29
29
  end
30
30
  end
31
31
 
32
- Util.warn "(#{ref}) fetching..."
32
+ Util.warn "(#{ref}) Fetching from Relaton repository ..."
33
33
  result = search(code, year, opts) || (return nil)
34
34
  ret = bib_results_filter(result, year)
35
35
  if ret[:ret]
36
- Util.warn "(#{ref}) found `#{ret[:ret].docidentifier.first.id}`"
36
+ Util.warn "(#{ref}) Found: `#{ret[:ret].docidentifier.first.id}`"
37
37
  ret[:ret]
38
38
  else
39
+ Util.warn "(#{ref}) No found."
39
40
  fetch_ref_err(code, year, ret[:years])
40
41
  end
41
42
  end
@@ -73,12 +74,12 @@ module RelatonCalconnect
73
74
  # @param year [String]
74
75
  # @param missed_years [Array<Strig>]
75
76
  def fetch_ref_err(code, year, missed_years)
76
- id = year ? "`#{code}` year `#{year}`" : code
77
- Util.warn "WARNING: no match found online for #{id}. " \
78
- "The code must be exactly like it is on the standards website."
77
+ # id = year ? "`#{code}` year `#{year}`" : code
78
+ # Util.warn "WARNING: No match found online for #{id}. " \
79
+ # "The code must be exactly like it is on the standards website."
79
80
  unless missed_years.empty?
80
- Util.warn "(There was no match for `#{year}`, though there " \
81
- "were matches found for `#{missed_years.join('`, `')}`.)"
81
+ Util.warn "There was no match for `#{year}`, though there " \
82
+ "were matches found for `#{missed_years.join('`, `')}`."
82
83
  end
83
84
  nil
84
85
  end
@@ -0,0 +1,19 @@
1
+ module RelatonCalconnect
2
+ class DocumentType < RelatonBib::DocumentType
3
+ DOCTYPES = %w[
4
+ directive guide specification standard report administrative amendment
5
+ technical\ corrigendum advisory
6
+ ].freeze
7
+
8
+ def initialize(type:, abbreviation: nil)
9
+ check_type type
10
+ super
11
+ end
12
+
13
+ def check_type(type)
14
+ unless DOCTYPES.include? type
15
+ Util.warn "WARNING: invalid doctype: `#{type}`"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,15 +1,20 @@
1
1
  module RelatonCalconnect
2
- class HashConverter < RelatonBib::HashConverter
3
- class << self
4
- # @param ret [Hash]
5
- def editorialgroup_hash_to_bib(ret)
6
- return unless ret[:editorialgroup]
2
+ module HashConverter
3
+ include RelatonBib::HashConverter
4
+ extend self
7
5
 
8
- technical_committee = RelatonBib.array(ret[:editorialgroup]).map do |wg|
9
- TechnicalCommittee.new RelatonBib::WorkGroup.new(**wg)
10
- end
11
- ret[:editorialgroup] = RelatonBib::EditorialGroup.new technical_committee
6
+ # @param ret [Hash]
7
+ def editorialgroup_hash_to_bib(ret)
8
+ return unless ret[:editorialgroup]
9
+
10
+ technical_committee = RelatonBib.array(ret[:editorialgroup]).map do |wg|
11
+ TechnicalCommittee.new RelatonBib::WorkGroup.new(**wg)
12
12
  end
13
+ ret[:editorialgroup] = RelatonBib::EditorialGroup.new technical_committee
14
+ end
15
+
16
+ def create_doctype(**args)
17
+ DocumentType.new(**args)
13
18
  end
14
19
  end
15
20
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonCalconnect
2
- VERSION = "1.16.1".freeze
2
+ VERSION = "1.17.0".freeze
3
3
  end
@@ -3,6 +3,7 @@ require "relaton_bib"
3
3
  require "relaton_calconnect/version"
4
4
  require "relaton_calconnect/config"
5
5
  require "relaton_calconnect/util"
6
+ require "relaton_calconnect/document_type"
6
7
  require "relaton_calconnect/cc_bibliography"
7
8
  require "relaton_calconnect/hit_collection"
8
9
  require "relaton_calconnect/hit"
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
28
28
 
29
29
  spec.add_dependency "faraday", "~> 2.7.0"
30
- spec.add_dependency "relaton-bib", "~> 1.16.0"
30
+ spec.add_dependency "relaton-bib", "~> 1.17.0"
31
31
  spec.add_dependency "relaton-index", "~> 0.2.0"
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-calconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.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-09-20 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
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.16.0
33
+ version: 1.17.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.16.0
40
+ version: 1.17.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: relaton-index
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -82,6 +82,7 @@ files:
82
82
  - lib/relaton_calconnect/cc_bibliography.rb
83
83
  - lib/relaton_calconnect/config.rb
84
84
  - lib/relaton_calconnect/data_fetcher.rb
85
+ - lib/relaton_calconnect/document_type.rb
85
86
  - lib/relaton_calconnect/hash_converter.rb
86
87
  - lib/relaton_calconnect/hit.rb
87
88
  - lib/relaton_calconnect/hit_collection.rb