relaton-etsi 1.17.0 → 1.19.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: e6e4ba041c037da56897365348dd11adedc34ea8f92cef0f762995bb7613d8fe
4
- data.tar.gz: ddf0f3bef8c7d2292ce6a9e34c6d0b70b04df1ad0c5c5d7f2497b81b686080e0
3
+ metadata.gz: 7e6de56729e08a6ed75056d304e5bf59b79882496c0e86edf99ba144ef56e3ac
4
+ data.tar.gz: fc98cc4219dba9e46e33a25217eab20d2ce97512229b619bdf7984e8f8d078ba
5
5
  SHA512:
6
- metadata.gz: 238a85539e7e015d69242fb759a6d36c22186c664a15b8dc6d1069ed3583bec2517a42860da7f74005f0c68981c985bb1e2c9e6aa4ee419bfdcf0d1e4bbf6271
7
- data.tar.gz: edfbe1047d23e749c92294ff2cf2b5365344a8873b38c05ed37d1b1af77b6e56e2b6bf1ec6b98e6e835bfde3c22f1bfb8170b23548570c308e1eced5235d6c25
6
+ metadata.gz: 45a0d19f40ad27cd253bbabdeeda09585df5354ffbcc5b24a92ece33a1afb3fa4c1ca77d58bae5d99fc71ef7c086f317a18236345d60cb0184bf79a33d91a861
7
+ data.tar.gz: c7c6c1ea3ba9544809ea59b0c90b891efea0d6212c342788e8723c970a2321d3f9912395bd2ea86ecedf9f0db9e868ced450491039f2f479dad013e056c1d04b
data/README.adoc CHANGED
@@ -23,24 +23,13 @@ Or install it yourself as:
23
23
 
24
24
  == Usage
25
25
 
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 `RelatonEtsi.configure` block.
26
+ === Search for a standard using keywords
29
27
 
30
28
  [source,ruby]
31
29
  ----
32
30
  require 'relaton_etsi'
33
31
  => true
34
32
 
35
- RelatonEtsi.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
- ----
44
33
  item = RelatonEtsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")
45
34
  [relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Fetching from Relaton repository ...
46
35
  [relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Found: `ETSI GS ZSM 012 V1.1.1 (2022-12)`
@@ -156,6 +145,10 @@ Done in: 204 sec.
156
145
  => nil
157
146
  ----
158
147
 
148
+ === Logging
149
+
150
+ RelatonEtsi uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
151
+
159
152
  == Development
160
153
 
161
154
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -95,8 +95,89 @@
95
95
  <ref name="pagebreak"/>
96
96
  <ref name="hr"/>
97
97
  <ref name="bookmark"/>
98
+ <ref name="amend"/>
98
99
  </choice>
99
100
  </define>
101
+ <define name="amend">
102
+ <element name="amend">
103
+ <ref name="AmendType"/>
104
+ </element>
105
+ </define>
106
+ <define name="AmendType">
107
+ <optional>
108
+ <attribute name="id">
109
+ <data type="ID"/>
110
+ </attribute>
111
+ </optional>
112
+ <attribute name="change">
113
+ <choice>
114
+ <value>add</value>
115
+ <value>modify</value>
116
+ <value>delete</value>
117
+ <value>replace</value>
118
+ </choice>
119
+ </attribute>
120
+ <optional>
121
+ <attribute name="path"/>
122
+ </optional>
123
+ <optional>
124
+ <attribute name="path_end"/>
125
+ </optional>
126
+ <optional>
127
+ <attribute name="title"/>
128
+ </optional>
129
+ <optional>
130
+ <element name="location">
131
+ <zeroOrMore>
132
+ <choice>
133
+ <ref name="locality"/>
134
+ <ref name="localityStack"/>
135
+ </choice>
136
+ </zeroOrMore>
137
+ </element>
138
+ </optional>
139
+ <optional>
140
+ <element name="description">
141
+ <zeroOrMore>
142
+ <ref name="BasicBlock"/>
143
+ </zeroOrMore>
144
+ </element>
145
+ </optional>
146
+ <optional>
147
+ <element name="newcontent">
148
+ <optional>
149
+ <attribute name="id">
150
+ <data type="ID"/>
151
+ </attribute>
152
+ </optional>
153
+ <zeroOrMore>
154
+ <ref name="BasicBlock"/>
155
+ </zeroOrMore>
156
+ </element>
157
+ </optional>
158
+ <zeroOrMore>
159
+ <ref name="classification"/>
160
+ </zeroOrMore>
161
+ <zeroOrMore>
162
+ <ref name="contributor"/>
163
+ </zeroOrMore>
164
+ </define>
165
+ <define name="classification">
166
+ <element name="classification">
167
+ <ref name="classification_tag"/>
168
+ <ref name="classification_value"/>
169
+ </element>
170
+ </define>
171
+ <define name="classification_tag">
172
+ <element name="tag">
173
+ <text/>
174
+ </element>
175
+ </define>
176
+ <define name="classification_value">
177
+ <element name="value">
178
+ <text/>
179
+ </element>
180
+ </define>
100
181
  <define name="paragraph">
101
182
  <element name="p">
102
183
  <ref name="ParagraphType"/>
@@ -163,6 +244,9 @@
163
244
  <data type="ID"/>
164
245
  </attribute>
165
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
166
250
  <optional>
167
251
  <attribute name="date">
168
252
  <data type="dateTime"/>
@@ -715,27 +799,36 @@
715
799
  </define>
716
800
  <define name="ruby">
717
801
  <element name="ruby">
718
- <zeroOrMore>
719
- <choice>
720
- <ref name="PureTextElement"/>
721
- <ref name="rp"/>
722
- <ref name="rt"/>
723
- </choice>
724
- </zeroOrMore>
802
+ <choice>
803
+ <ref name="ruby_pronunciation"/>
804
+ <ref name="ruby_annotation"/>
805
+ </choice>
806
+ <choice>
807
+ <text/>
808
+ <ref name="ruby"/>
809
+ </choice>
725
810
  </element>
726
811
  </define>
727
- <define name="rp">
728
- <element name="rp">
729
- <zeroOrMore>
730
- <ref name="PureTextElement"/>
731
- </zeroOrMore>
812
+ <define name="ruby_pronunciation">
813
+ <element name="pronunciation">
814
+ <attribute name="value"/>
815
+ <optional>
816
+ <attribute name="script"/>
817
+ </optional>
818
+ <optional>
819
+ <attribute name="lang"/>
820
+ </optional>
732
821
  </element>
733
822
  </define>
734
- <define name="rt">
735
- <element name="rt">
736
- <zeroOrMore>
737
- <ref name="PureTextElement"/>
738
- </zeroOrMore>
823
+ <define name="ruby_annotation">
824
+ <element name="annotation">
825
+ <attribute name="value"/>
826
+ <optional>
827
+ <attribute name="script"/>
828
+ </optional>
829
+ <optional>
830
+ <attribute name="lang"/>
831
+ </optional>
739
832
  </element>
740
833
  </define>
741
834
  <define name="br">
@@ -930,18 +1023,12 @@
930
1023
  </optional>
931
1024
  <optional>
932
1025
  <attribute name="width">
933
- <choice>
934
- <data type="int"/>
935
- <value>auto</value>
936
- </choice>
1026
+ <ref name="ImageSize"/>
937
1027
  </attribute>
938
1028
  </optional>
939
1029
  <optional>
940
1030
  <attribute name="height">
941
- <choice>
942
- <data type="int"/>
943
- <value>auto</value>
944
- </choice>
1031
+ <ref name="ImageSize"/>
945
1032
  </attribute>
946
1033
  </optional>
947
1034
  <optional>
@@ -956,6 +1043,14 @@
956
1043
  </attribute>
957
1044
  </optional>
958
1045
  </define>
1046
+ <define name="ImageSize">
1047
+ <choice>
1048
+ <data type="string">
1049
+ <param name="pattern">\d+([.]\d+)?(%?)</param>
1050
+ </data>
1051
+ <value>auto</value>
1052
+ </choice>
1053
+ </define>
959
1054
  <define name="video">
960
1055
  <element name="video">
961
1056
  <attribute name="id">
@@ -9,11 +9,42 @@
9
9
  -->
10
10
  <include href="biblio.rng">
11
11
  <define name="BibData">
12
- <ref name="BibliographicItem"/>
12
+ <ref name="StandardBibliographicItem"/>
13
13
  <optional>
14
14
  <ref name="ext"/>
15
15
  </optional>
16
16
  </define>
17
+ <define name="docrelation">
18
+ <element name="relation">
19
+ <attribute name="type">
20
+ <ref name="DocRelationType"/>
21
+ </attribute>
22
+ <optional>
23
+ <element name="description">
24
+ <ref name="FormattedString"/>
25
+ </element>
26
+ </optional>
27
+ <element name="bibitem">
28
+ <ref name="StandardReducedBibliographicItem"/>
29
+ </element>
30
+ <choice>
31
+ <zeroOrMore>
32
+ <ref name="locality"/>
33
+ </zeroOrMore>
34
+ <zeroOrMore>
35
+ <ref name="localityStack"/>
36
+ </zeroOrMore>
37
+ </choice>
38
+ <choice>
39
+ <zeroOrMore>
40
+ <ref name="sourceLocality"/>
41
+ </zeroOrMore>
42
+ <zeroOrMore>
43
+ <ref name="sourceLocalityStack"/>
44
+ </zeroOrMore>
45
+ </choice>
46
+ </element>
47
+ </define>
17
48
  </include>
18
49
  <define name="ext">
19
50
  <element name="ext">
@@ -161,4 +192,16 @@
161
192
  </optional>
162
193
  </element>
163
194
  </define>
195
+ <define name="StandardBibliographicItem">
196
+ <ref name="BibliographicItem"/>
197
+ <zeroOrMore>
198
+ <ref name="amend"/>
199
+ </zeroOrMore>
200
+ </define>
201
+ <define name="StandardReducedBibliographicItem">
202
+ <ref name="ReducedBibliographicItem"/>
203
+ <zeroOrMore>
204
+ <ref name="amend"/>
205
+ </zeroOrMore>
206
+ </define>
164
207
  </grammar>
data/grammars/biblio.rng CHANGED
@@ -241,6 +241,9 @@
241
241
  </element>
242
242
  </define>
243
243
  <define name="FullNameType">
244
+ <optional>
245
+ <ref name="name_abbreviation"/>
246
+ </optional>
244
247
  <choice>
245
248
  <group>
246
249
  <zeroOrMore>
@@ -266,6 +269,11 @@
266
269
  <ref name="variantname"/>
267
270
  </zeroOrMore>
268
271
  </define>
272
+ <define name="name_abbreviation">
273
+ <element name="abbreviation">
274
+ <ref name="LocalizedString"/>
275
+ </element>
276
+ </define>
269
277
  <define name="prefix">
270
278
  <element name="prefix">
271
279
  <ref name="LocalizedString"/>
@@ -870,6 +878,9 @@
870
878
  <optional>
871
879
  <ref name="validity"/>
872
880
  </optional>
881
+ <optional>
882
+ <ref name="depiction"/>
883
+ </optional>
873
884
  </define>
874
885
  <define name="btitle">
875
886
  <element name="title">
@@ -32,14 +32,14 @@ module RelatonEtsi
32
32
  # @param opts [Hash] options
33
33
  # @return [RelatonEtsi::BibliographicItem]
34
34
  def get(ref, _year = nil, _opts = {})
35
- Util.warn "(#{ref}) Fetching from Relaton repository ..."
35
+ Util.info "Fetching from Relaton repository ...", key: ref
36
36
  result = search(ref)
37
37
  unless result
38
- Util.warn "(#{ref}) Not found."
38
+ Util.info "Not found.", key: ref
39
39
  return
40
40
  end
41
41
 
42
- Util.warn "(#{ref}) Found: `#{result.docidentifier[0].id}`"
42
+ Util.info "Found: `#{result.docidentifier[0].id}`", key: ref
43
43
  result
44
44
  end
45
45
 
@@ -1,7 +1,7 @@
1
1
  module RelatonEtsi
2
2
  class DataParser
3
- ATTRS = %i[id title docnumber link date docid version status keyword editorialgroup
4
- doctype abstract language script].freeze
3
+ ATTRS = %i[id title docnumber link date docid version status contributor
4
+ keyword editorialgroup doctype abstract language script].freeze
5
5
 
6
6
  def initialize(row)
7
7
  @row = row
@@ -57,6 +57,15 @@ module RelatonEtsi
57
57
  RelatonBib::DocumentStatus.new(stage: status)
58
58
  end
59
59
 
60
+ def contributor
61
+ name = RelatonBib::LocalizedString.new(
62
+ "European Telecommunications Standards Institute", "en", "Latn"
63
+ )
64
+ abbrev = RelatonBib::LocalizedString.new("ETSI", "en", "Latn")
65
+ entity = RelatonBib::Organization.new name: [name], abbreviation: abbrev
66
+ [RelatonBib::ContributionInfo.new(entity: entity, role: [{ type: "publisher" }])]
67
+ end
68
+
60
69
  def keyword
61
70
  @row["Keywords"].split(",")
62
71
  end
@@ -34,13 +34,13 @@ module RelatonEtsi
34
34
  def check_type(type)
35
35
  return if DOCTYPES.value? type
36
36
 
37
- Util.warn "WARNING: invalid doctype: `#{type}`"
37
+ Util.warn "invalid doctype: `#{type}`"
38
38
  end
39
39
 
40
40
  def check_abbreviation(abbreviation)
41
41
  return if abbreviation.nil? || DOCTYPES.key?(abbreviation)
42
42
 
43
- Util.warn "WARNING: invalid doctype abbreviation: `#{abbreviation}`"
43
+ Util.warn "invalid doctype abbreviation: `#{abbreviation}`"
44
44
  end
45
45
  end
46
46
  end
@@ -10,5 +10,9 @@ module RelatonEtsi
10
10
  def bib_item(item_hash)
11
11
  BibliographicItem.new(**item_hash)
12
12
  end
13
+
14
+ def create_doctype(**args)
15
+ DocumentType.new(**args)
16
+ end
13
17
  end
14
18
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonEtsi
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonEtsi.configuration.logger
7
- end
4
+ PROGNAME = "relaton-etsi".freeze
8
5
  end
9
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonEtsi
4
- VERSION = "1.17.0"
4
+ VERSION = "1.19.0"
5
5
  end
@@ -23,6 +23,10 @@ module RelatonEtsi
23
23
  BibliographicItem.new(**item_hash)
24
24
  end
25
25
 
26
+ def create_doctype(type)
27
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
28
+ end
29
+
26
30
  # def fetch_status(item)
27
31
  # status = item.at "./status"
28
32
  # return unless status
data/lib/relaton_etsi.rb CHANGED
@@ -6,7 +6,6 @@ require "csv"
6
6
  require "relaton/index"
7
7
  require "relaton_bib"
8
8
  require_relative "relaton_etsi/version"
9
- require_relative "relaton_etsi/config"
10
9
  require_relative "relaton_etsi/util"
11
10
  require_relative "relaton_etsi/pubid"
12
11
  require_relative "relaton_etsi/document_type"
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-etsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.19.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-12-06 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: csv
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: relaton-bib
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 1.17.0
33
+ version: 1.19.0
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 1.17.0
40
+ version: 1.19.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: relaton-index
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +73,6 @@ files:
59
73
  - lib/relaton_etsi.rb
60
74
  - lib/relaton_etsi/bibliographic_item.rb
61
75
  - lib/relaton_etsi/bibliography.rb
62
- - lib/relaton_etsi/config.rb
63
76
  - lib/relaton_etsi/data_fetcher.rb
64
77
  - lib/relaton_etsi/data_parser.rb
65
78
  - lib/relaton_etsi/document_type.rb
@@ -90,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
103
  - !ruby/object:Gem::Version
91
104
  version: '0'
92
105
  requirements: []
93
- rubygems_version: 3.3.26
106
+ rubygems_version: 3.3.27
94
107
  signing_key:
95
108
  specification_version: 4
96
109
  summary: 'RelatonEtsi: retrieve ETSI Standards for bibliographic using the BibliographicItem
@@ -1,10 +0,0 @@
1
- module RelatonEtsi
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-etsi".freeze
9
- end
10
- end