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 +4 -4
- data/README.adoc +14 -3
- data/grammars/basicdoc.rng +18 -2
- data/grammars/biblio.rng +1 -0
- data/lib/relaton_calconnect/cc_bibliographic_item.rb +0 -5
- data/lib/relaton_calconnect/cc_bibliography.rb +8 -7
- data/lib/relaton_calconnect/document_type.rb +19 -0
- data/lib/relaton_calconnect/hash_converter.rb +14 -9
- data/lib/relaton_calconnect/version.rb +1 -1
- data/lib/relaton_calconnect.rb +1 -0
- data/relaton_calconnect.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19125bb0584cd670fca9b33e70b08c02f03a24bd7a4c100f92ee068df874d78f
|
4
|
+
data.tar.gz: bcddbe3739ac22b47fecf70097569c180e2ed3ac83a92d2f801507bb362717a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
===
|
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] (
|
95
|
-
[relaton-calconnect] (
|
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
|
----
|
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
@@ -29,13 +29,14 @@ module RelatonCalconnect
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
Util.warn "(#{ref})
|
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})
|
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:
|
78
|
-
|
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 "
|
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
|
-
|
3
|
-
|
4
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
data/lib/relaton_calconnect.rb
CHANGED
@@ -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"
|
data/relaton_calconnect.gemspec
CHANGED
@@ -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.
|
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.
|
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
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
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.
|
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
|