relaton-ccsds 1.16.2 → 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: caadca5cd377ef986fe543832065034345b663edd712f6fcee97d532c5b85203
4
- data.tar.gz: 248abeac8b28b415dd153ea230ff22613ef29a784b0cbadd11921d76bc5901a7
3
+ metadata.gz: 3b632bd8f8858ae2fb6d2fbaffed10fff5f6fde030337ce6fff74e2b4f19e010
4
+ data.tar.gz: b73f9f3a7b63f80bac18024b2afa60a6bf19f63569a62f9ac7b82302b3dfc631
5
5
  SHA512:
6
- metadata.gz: bbbcb5e1724786a88d157c84da7a15ee96ce2b16a9bf89cfe9087537b702b441d4c48fac49c1d7c88ab484778af8ee4c9c7d92c2ebd94eb44e15e60c9ca6826e
7
- data.tar.gz: db36ad93abee600eaddf8701add8dc803b9ecfc480a61dc68dc2aeb275ebf605a5fe03a15e3953418a7a28412f608f4b77b450ff93569af6fbae99ee2fe7c4b0
6
+ metadata.gz: aef90a13ba49c82b849bab3192b64b3fd632c85670af4297d4fa3dfa40fc03321976402b610d5b96fa292520c0d72d9b481b498ebad876eefb617a9ef3d6d0a7
7
+ data.tar.gz: e23521780a2abe04b89167727751191963cb40ed2a805b884348342c459ee90903d6f960261be54459dcddade6bfad877fd40dcc70123b879c59a13e4724e2dd
data/README.adoc CHANGED
@@ -54,7 +54,7 @@ item = hits[0].doc
54
54
  [source,ruby]
55
55
  ----
56
56
  item.to_xml
57
- => "<bibitem id="CCSDS230.2-G-1" schema-version="v1.2.4">
57
+ => "<bibitem id="CCSDS230.2-G-1" schema-version="v1.2.5">
58
58
  <fetched>2023-08-25</fetched>
59
59
  <title format="text/plain" language="en" script="Latn">Next Generation Uplink</title>
60
60
  <uri type="pdf">https://public.ccsds.org/Pubs/230x2g1.pdf</uri>
@@ -66,7 +66,7 @@ With argument `bibdata: true` it outputs XML wrapped by `bibdata` element and ad
66
66
  [source,ruby]
67
67
  ----
68
68
  item.to_xml bibdata: true
69
- => "<bibdata schema-version="v1.2.4">
69
+ => "<bibdata schema-version="v1.2.5">
70
70
  <fetched>2023-08-25</fetched>
71
71
  <title format="text/plain" language="en" script="Latn">Next Generation Uplink</title>
72
72
  <uri type="pdf">https://public.ccsds.org/Pubs/230x2g1.pdf</uri>
@@ -95,8 +95,8 @@ item.link
95
95
  @type="pdf">]
96
96
 
97
97
  RelatonCcsds::Bibliography.get("CCSDS 720.6-Y-1").link
98
- [relaton-ccsd] (CCSDS 720.6-Y-1) fetching...
99
- [relaton-ccsd] (CCSDS 720.6-Y-1) found `CCSDS 720.6-Y-1`.
98
+ [relaton-ccsd] (CCSDS 720.6-Y-1) Fetching from Relaton repository ...
99
+ [relaton-ccsd] (CCSDS 720.6-Y-1) Found: `CCSDS 720.6-Y-1`.
100
100
  => [#<RelatonBib::TypedUri:0x0000000114183bb0
101
101
  @content=#<Addressable::URI:0xca8 URI:https://public.ccsds.org/Pubs/720x6y1.pdf>,
102
102
  @language=nil,
@@ -113,8 +113,8 @@ RelatonCcsds::Bibliography.get("CCSDS 720.6-Y-1").link
113
113
  [source,ruby]
114
114
  ----
115
115
  RelatonCcsds::Bibliography.get("CCSDS 230.2-G-1")
116
- [relaton-ccsd] (CCSDS 230.2-G-1) fetching...
117
- [relaton-ccsd] (CCSDS 230.2-G-1) found `CCSDS 230.2-G-1`.
116
+ [relaton-ccsd] (CCSDS 230.2-G-1) Fetching from Relaton repository ...
117
+ [relaton-ccsd] (CCSDS 230.2-G-1) Found: `CCSDS 230.2-G-1`.
118
118
  => #<RelatonCcsds::BibliographicItem:0x00000001135dade0
119
119
  ...
120
120
  ----
@@ -124,8 +124,8 @@ RelatonCcsds::Bibliography.get("CCSDS 230.2-G-1")
124
124
  [source,ruby]
125
125
  ----
126
126
  item = RelatonCcsds::Bibliography.get("CCSDS 720.4-Y-1 (DOC)")
127
- [relaton-ccsd] (CCSDS 720.4-Y-1 (DOC)) fetching...
128
- [relaton-ccsd] (CCSDS 720.4-Y-1 (DOC)) found `CCSDS 720.4-Y-1`.
127
+ [relaton-ccsd] (CCSDS 720.4-Y-1 (DOC)) Fetching from Relaton repository ...
128
+ [relaton-ccsd] (CCSDS 720.4-Y-1 (DOC)) Found: `CCSDS 720.4-Y-1`.
129
129
  => #<RelatonCcsds::BibliographicItem:0x000000011100dfe0
130
130
  ...
131
131
 
@@ -139,8 +139,8 @@ pry(main)> item.link[0].content.to_s
139
139
  => "https://public.ccsds.org/Pubs/720x4y1.doc"
140
140
 
141
141
  item = RelatonCcsds::Bibliography.get("CCSDS 720.4-Y-1 (PDF)")
142
- [relaton-ccsd] (CCSDS 720.4-Y-1 (PDF)) fetching...
143
- [relaton-ccsd] (CCSDS 720.4-Y-1 (PDF)) found `CCSDS 720.4-Y-1`.
142
+ [relaton-ccsd] (CCSDS 720.4-Y-1 (PDF)) Fetching from Relaton repository ...
143
+ [relaton-ccsd] (CCSDS 720.4-Y-1 (PDF)) Found: `CCSDS 720.4-Y-1`.
144
144
  => #<RelatonCcsds::BibliographicItem:0x0000000111004620
145
145
  ...
146
146
 
@@ -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,14 +1,9 @@
1
1
  module RelatonCcsds
2
2
  class BibliographicItem < RelatonBib::BibliographicItem
3
- DOCTYPES = %w[standard practice report specification record].freeze
4
-
5
3
  attr_reader :technology_area
6
4
 
7
5
  # @param technology_area [String, nil]
8
6
  def initialize(**args)
9
- if args[:doctype] && !DOCTYPES.include?(args[:doctype])
10
- Util.warn "WARNING: invalid doctype: `#{args[:doctype]}`"
11
- end
12
7
  @technology_area = args.delete(:technology_area)
13
8
  super
14
9
  end
@@ -27,7 +22,7 @@ module RelatonCcsds
27
22
  super do |builder|
28
23
  if opts[:bibdata] && (doctype || editorialgroup || technology_area)
29
24
  ext = builder.ext do |b|
30
- b.doctype doctype if doctype
25
+ doctype&.to_xml b
31
26
  editorialgroup&.to_xml b
32
27
  b.send(:"technology-area", technology_area) if technology_area
33
28
  end
@@ -27,14 +27,14 @@ module RelatonCcsds
27
27
  def get(reference, _year = nil, opts = {}) # rubocop:disable Metrics/MethodLength
28
28
  ref = reference.sub(/\s\((DOC|PDF)\)$/, "")
29
29
  opts[:format] ||= Regexp.last_match(1)
30
- Util.warn "(#{reference}) fetching..."
30
+ Util.warn "(#{reference}) Fetching from Relaton repository ..."
31
31
  hits = search ref
32
32
  doc = hits.first&.doc&.to_format(opts[:format])
33
33
  unless doc
34
- Util.warn "(#{reference}) not found."
34
+ Util.warn "(#{reference}) Not found."
35
35
  return nil
36
36
  end
37
- Util.warn "(#{reference}) found `#{hits.first.code}`."
37
+ Util.warn "(#{reference}) Found: `#{hits.first.code}`."
38
38
  doc
39
39
  end
40
40
  end
@@ -56,7 +56,7 @@ module RelatonCcsds
56
56
 
57
57
  def parse_doctype
58
58
  /^CCSDS\s[\d.]+-(?<type>\w+)/ =~ @doc["Document_x0020_Number"]
59
- DOCTYPES[type&.to_sym]
59
+ DocumentType.new type: DOCTYPES[type&.to_sym]
60
60
  end
61
61
 
62
62
  def parse_date
@@ -0,0 +1,16 @@
1
+ module RelatonCcsds
2
+ class DocumentType < RelatonBib::DocumentType
3
+ # DOCTYPES = %w[standard practice report specification record].freeze
4
+
5
+ def initialize(type:, abbreviation: nil)
6
+ # check_type type
7
+ super
8
+ end
9
+
10
+ # def check_type(type)
11
+ # return if DOCTYPES.include? type
12
+
13
+ # Util.warn "WARNING: invalid doctype: `#{type}`"
14
+ # end
15
+ end
16
+ end
@@ -1,21 +1,25 @@
1
1
  module RelatonCcsds
2
- class HashConverter < RelatonBib::HashConverter
3
- class << self
4
- # @param args [Hash]
5
- # @return [Hash]
6
- def hash_to_bib(args)
7
- ret = super
8
- return unless ret
2
+ module HashConverter
3
+ include RelatonBib::HashConverter
4
+ extend self
5
+ # @param args [Hash]
6
+ # @return [Hash]
7
+ def hash_to_bib(args)
8
+ ret = super
9
+ return unless ret
9
10
 
10
- ret[:technology_area] = ret[:ext][:technology_area] if ret[:ext]
11
- ret
12
- end
11
+ ret[:technology_area] = ret[:ext][:technology_area] if ret[:ext]
12
+ ret
13
+ end
14
+
15
+ # @param item_hash [Hash]
16
+ # @return [RelatonCie::BibliographicItem]
17
+ def bib_item(item_hash)
18
+ BibliographicItem.new(**item_hash)
19
+ end
13
20
 
14
- # @param item_hash [Hash]
15
- # @return [RelatonCie::BibliographicItem]
16
- def bib_item(item_hash)
17
- BibliographicItem.new(**item_hash)
18
- end
21
+ def create_doctype(**args)
22
+ DocumentType.new(**args)
19
23
  end
20
24
  end
21
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonCcsds
4
- VERSION = "1.16.2"
4
+ VERSION = "1.17.0"
5
5
  end
data/lib/relaton_ccsds.rb CHANGED
@@ -7,6 +7,7 @@ require_relative "relaton_ccsds/version"
7
7
  require_relative "relaton_ccsds/bibliographic_item"
8
8
  require_relative "relaton_ccsds/config"
9
9
  require_relative "relaton_ccsds/util"
10
+ require_relative "relaton_ccsds/document_type"
10
11
  require_relative "relaton_ccsds/bibliography"
11
12
  require_relative "relaton_ccsds/hit"
12
13
  require_relative "relaton_ccsds/hit_collection"
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  # Uncomment to register a new dependency of your gem
27
27
  spec.add_dependency "mechanize", "~> 2.7"
28
- spec.add_dependency "relaton-bib", "~> 1.16.0"
28
+ spec.add_dependency "relaton-bib", "~> 1.17.0"
29
29
  spec.add_dependency "relaton-index", "~> 0.2.0"
30
30
 
31
31
  # For more information and examples about making a new gem, check out our
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ccsds
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-09-29 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: mechanize
@@ -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
@@ -79,6 +79,7 @@ files:
79
79
  - lib/relaton_ccsds/config.rb
80
80
  - lib/relaton_ccsds/data_fetcher.rb
81
81
  - lib/relaton_ccsds/data_parser.rb
82
+ - lib/relaton_ccsds/document_type.rb
82
83
  - lib/relaton_ccsds/hash_converter.rb
83
84
  - lib/relaton_ccsds/hit.rb
84
85
  - lib/relaton_ccsds/hit_collection.rb