relaton-ietf 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: 4d0245047f274549b9323c06fe9d63a5150a2fe44ea57d0525aaad767d3c38b8
4
- data.tar.gz: dfc5d69ee70eec62f5fe6b43791ab9578db892439dfe296574098c58ae6ca304
3
+ metadata.gz: 03b7d70436b1b0e29c81ad94edaa90ec760e0aa967221741968244814ef90843
4
+ data.tar.gz: 30e46687eb8e4db1166f2bfb7eee7dee973d4e07b98c83d70fc7d15289145a75
5
5
  SHA512:
6
- metadata.gz: f119f7ac88ecefa74a6baabd10dd410bcd3ad6cae78fe1fc5afebf562cc325d28097174608dacf9a47cb33e08eea1f034442ff38235dc2b44d6721b197c034ee
7
- data.tar.gz: 4b7767b7a07caf39cd7c37db98a03ea426149a5f848389d367ce8230c6afd2b92e2dd6e2272899a5726092a3a50f1c183e5e0e186e33e75f59a43fdf48a6ffab
6
+ metadata.gz: 69445fabf05f86f46b9b44aa606e9cf6095625bc37ce1b13063b0c78f557b772415bd062c756c84f05918eddc6b78dc6350d38baa934c95d7a39a370c0b29f64
7
+ data.tar.gz: 3c0c12e1eaa48c80d25e8eb2a540655c5ea22133951518780406b22c87d727776bf69098204c90d9cf0b1c466e8621db21c1f71d0ef8e9dc36c5b59144cb6844
@@ -10,4 +10,4 @@ on:
10
10
 
11
11
  jobs:
12
12
  rake:
13
- uses: relaton/support/.github/workflows/rake.yml@master
13
+ uses: relaton/support/.github/workflows/rake.yml@main
@@ -17,7 +17,7 @@ on:
17
17
 
18
18
  jobs:
19
19
  release:
20
- uses: relaton/support/.github/workflows/release.yml@master
20
+ uses: relaton/support/.github/workflows/release.yml@main
21
21
  with:
22
22
  next_version: ${{ github.event.inputs.next_version }}
23
23
  secrets:
data/README.adoc CHANGED
@@ -33,24 +33,13 @@ Or install it yourself as:
33
33
 
34
34
  == Usage
35
35
 
36
- === Configuration
37
-
38
- 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 `RelatonIetf.configure` block.
36
+ === Fetching documents
39
37
 
40
38
  [source,ruby]
41
39
  ----
42
40
  require 'relaton_ietf'
43
41
  => true
44
42
 
45
- RelatonIetf.configure do |config|
46
- config.logger.level = Logger::DEBUG
47
- end
48
- ----
49
-
50
- === Fetching documents
51
-
52
- [source,ruby]
53
- ----
54
43
  # Fetch RFC document
55
44
  item = RelatonIetf::IetfBibliography.get 'IETF RFC 8341'
56
45
  [relaton-ietf] (IETF RFC 8341) Fetching from Relaton repository ...
@@ -165,6 +154,10 @@ Done in: 360 sec.
165
154
  => nil
166
155
  ----
167
156
 
157
+ === Logging
158
+
159
+ RelatonIetf 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.
160
+
168
161
  == Contributing
169
162
 
170
163
  Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/relaton-ietf.
@@ -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">
@@ -914,44 +1007,49 @@
914
1007
  -->
915
1008
  <define name="image">
916
1009
  <element name="image">
917
- <attribute name="id">
918
- <data type="ID"/>
1010
+ <ref name="Image"/>
1011
+ </element>
1012
+ </define>
1013
+ <define name="Image">
1014
+ <attribute name="id">
1015
+ <data type="ID"/>
1016
+ </attribute>
1017
+ <attribute name="src">
1018
+ <data type="anyURI"/>
1019
+ </attribute>
1020
+ <attribute name="mimetype"/>
1021
+ <optional>
1022
+ <attribute name="filename"/>
1023
+ </optional>
1024
+ <optional>
1025
+ <attribute name="width">
1026
+ <ref name="ImageSize"/>
919
1027
  </attribute>
920
- <attribute name="src">
1028
+ </optional>
1029
+ <optional>
1030
+ <attribute name="height">
1031
+ <ref name="ImageSize"/>
1032
+ </attribute>
1033
+ </optional>
1034
+ <optional>
1035
+ <attribute name="alt"/>
1036
+ </optional>
1037
+ <optional>
1038
+ <attribute name="title"/>
1039
+ </optional>
1040
+ <optional>
1041
+ <attribute name="longdesc">
921
1042
  <data type="anyURI"/>
922
1043
  </attribute>
923
- <attribute name="mimetype"/>
924
- <optional>
925
- <attribute name="filename"/>
926
- </optional>
927
- <optional>
928
- <attribute name="width">
929
- <choice>
930
- <data type="int"/>
931
- <value>auto</value>
932
- </choice>
933
- </attribute>
934
- </optional>
935
- <optional>
936
- <attribute name="height">
937
- <choice>
938
- <data type="int"/>
939
- <value>auto</value>
940
- </choice>
941
- </attribute>
942
- </optional>
943
- <optional>
944
- <attribute name="alt"/>
945
- </optional>
946
- <optional>
947
- <attribute name="title"/>
948
- </optional>
949
- <optional>
950
- <attribute name="longdesc">
951
- <data type="anyURI"/>
952
- </attribute>
953
- </optional>
954
- </element>
1044
+ </optional>
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>
955
1053
  </define>
956
1054
  <define name="video">
957
1055
  <element name="video">
@@ -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"/>
@@ -348,6 +356,9 @@
348
356
  <zeroOrMore>
349
357
  <ref name="contact"/>
350
358
  </zeroOrMore>
359
+ <optional>
360
+ <ref name="logo"/>
361
+ </optional>
351
362
  </element>
352
363
  </define>
353
364
  <define name="orgname">
@@ -366,6 +377,21 @@
366
377
  </choice>
367
378
  </element>
368
379
  </define>
380
+ <define name="logo">
381
+ <element name="logo">
382
+ <ref name="image"/>
383
+ </element>
384
+ </define>
385
+ <define name="depiction">
386
+ <element name="depiction">
387
+ <optional>
388
+ <attribute name="scope"/>
389
+ </optional>
390
+ <zeroOrMore>
391
+ <ref name="image"/>
392
+ </zeroOrMore>
393
+ </element>
394
+ </define>
369
395
  <define name="NameWithVariants">
370
396
  <element name="primary">
371
397
  <ref name="LocalizedString"/>
@@ -752,6 +778,9 @@
752
778
  <optional>
753
779
  <ref name="validity"/>
754
780
  </optional>
781
+ <optional>
782
+ <ref name="depiction"/>
783
+ </optional>
755
784
  </define>
756
785
  <define name="ReducedBibliographicItem">
757
786
  <optional>
@@ -849,6 +878,9 @@
849
878
  <optional>
850
879
  <ref name="validity"/>
851
880
  </optional>
881
+ <optional>
882
+ <ref name="depiction"/>
883
+ </optional>
852
884
  </define>
853
885
  <define name="btitle">
854
886
  <element name="title">
@@ -168,8 +168,8 @@ module RelatonIetf
168
168
  rfc_index.xpath("xmlns:rfc-entry").each do |doc|
169
169
  save_doc RfcEntry.parse(doc)
170
170
  rescue StandardError => e
171
- warn "Error parsing #{doc.at('./xmlns:doc-id').text}: #{e.message}"
172
- warn e.backtrace[0..5].join("\n")
171
+ Util.error "Error parsing #{doc.at('./xmlns:doc-id').text}: #{e.message}\n" \
172
+ "#{e.backtrace[0..5].join("\n")}"
173
173
  end
174
174
  end
175
175
 
@@ -199,7 +199,7 @@ module RelatonIetf
199
199
  end
200
200
  file = file_name entry
201
201
  if check_duplicate && @files.include?(file)
202
- warn "File #{file} already exists. Document: #{entry.docnumber}"
202
+ Util.warn "File #{file} already exists. Document: #{entry.docnumber}"
203
203
  elsif check_duplicate
204
204
  @files << file
205
205
  end
@@ -9,7 +9,7 @@ module RelatonIetf
9
9
 
10
10
  def check_type(type)
11
11
  unless DOCTYPES.include? type
12
- Util.warn "WARNING: Invalid doctype: `#{type}`"
12
+ Util.warn "Invalid doctype: `#{type}`"
13
13
  end
14
14
  end
15
15
  end
@@ -18,13 +18,13 @@ module RelatonIetf
18
18
  # reference is required
19
19
  # @return [RelatonIetf::IetfBibliographicItem] Relaton of reference
20
20
  def get(code, _year = nil, _opts = {})
21
- Util.warn "(#{code}) Fetching from Relaton repository ..."
21
+ Util.info "Fetching from Relaton repository ...", key: code
22
22
  result = search code
23
23
  if result
24
24
  docid = result.docidentifier.detect(&:primary) || result.docidentifier.first
25
- Util.warn "(#{code}) Found: `#{docid.id}`"
25
+ Util.info "Found: `#{docid.id}`", key: code
26
26
  else
27
- Util.warn "(#{code}) Not found."
27
+ Util.info "Not found.", key: code
28
28
  end
29
29
  result
30
30
  end
@@ -123,10 +123,12 @@ module RelatonIetf
123
123
  #
124
124
  def parse_relation
125
125
  @is_also.map do |ref|
126
- fref = RelatonBib::FormattedRef.new content: ref
127
- id = ref.sub(/^([A-Z]+)0*(\d+)$/, '\1 \2')
128
- docid = RelatonBib::DocumentIdentifier.new(type: "IETF", id: id, primary: true)
129
- bib = IetfBibliographicItem.new formattedref: fref, docid: [docid]
126
+ entry = @doc.at("/xmlns:rfc-index/xmlns:rfc-entry[xmlns:doc-id = '#{ref}']")
127
+ bib = RfcEntry.parse entry
128
+ # fref = RelatonBib::FormattedRef.new content: ref
129
+ # id = ref.sub(/^([A-Z]+)0*(\d+)$/, '\1 \2')
130
+ # docid = RelatonBib::DocumentIdentifier.new(type: "IETF", id: id, primary: true)
131
+ # bib = IetfBibliographicItem.new formattedref: fref, docid: [docid]
130
132
  { type: "includes", bibitem: bib }
131
133
  end
132
134
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonIetf
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonIetf.configuration.logger
7
- end
4
+ PROGNAME = "relaton-ietf".freeze
8
5
  end
9
6
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.17.0".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
@@ -32,6 +32,10 @@ module RelatonIetf
32
32
  end
33
33
  RelatonBib::EditorialGroup.new eg if eg.any?
34
34
  end
35
+
36
+ def create_doctype(type)
37
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
38
+ end
35
39
  end
36
40
  end
37
41
  end
data/lib/relaton_ietf.rb CHANGED
@@ -4,7 +4,6 @@ require "net/http"
4
4
  require "relaton/index"
5
5
  require "relaton_bib"
6
6
  require "relaton_ietf/version"
7
- require "relaton_ietf/config"
8
7
  require "relaton_ietf/util"
9
8
  require "relaton_ietf/document_type"
10
9
  require "relaton_ietf/bibxml_parser"
data/relaton_ietf.gemspec CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
31
31
 
32
- spec.add_dependency "relaton-bib", "~> 1.17.0"
32
+ spec.add_dependency "base64"
33
+ spec.add_dependency "relaton-bib", "~> 1.19.0"
33
34
  spec.add_dependency "relaton-index", "~> 0.2.3"
34
35
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ietf
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-11-27 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: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '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
@@ -71,7 +85,6 @@ files:
71
85
  - lib/relaton_ietf.rb
72
86
  - lib/relaton_ietf/bibxml_parser.rb
73
87
  - lib/relaton_ietf/committee.rb
74
- - lib/relaton_ietf/config.rb
75
88
  - lib/relaton_ietf/data_fetcher.rb
76
89
  - lib/relaton_ietf/document_type.rb
77
90
  - lib/relaton_ietf/hash_converter.rb
@@ -105,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
118
  - !ruby/object:Gem::Version
106
119
  version: '0'
107
120
  requirements: []
108
- rubygems_version: 3.3.26
121
+ rubygems_version: 3.3.27
109
122
  signing_key:
110
123
  specification_version: 4
111
124
  summary: 'RelatonIetf: retrieve IETF Standards for bibliographic use using the BibliographicItem
@@ -1,10 +0,0 @@
1
- module RelatonIetf
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-ietf".freeze
9
- end
10
- end