relaton-iho 1.12.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,8 +17,8 @@ module RelatonIho
17
17
 
18
18
  # @param item_hash [Hash]
19
19
  # @return [RelatonBib::BibliographicItem]
20
- def bib_item(item_hash)
21
- IhoBibliographicItem.new item_hash
20
+ def bib_item(**item_hash)
21
+ IhoBibliographicItem.new(**item_hash)
22
22
  end
23
23
 
24
24
  # @param ret [Hash]
@@ -45,9 +45,8 @@ module RelatonIho
45
45
  return unless key && value.is_a?(Hash)
46
46
 
47
47
  klass = Object.const_get "RelatonIho::#{key.capitalize}"
48
- subwg = value.select do |k, _|
49
- %i[committee workgroup commission].include? k
50
- end
48
+ wgs = %i[committee workgroup commission]
49
+ subwg = value.select { |k, _| wgs.include? k }
51
50
  klass.new value[:abbreviation], value[:name], iho_workgroup(subwg)
52
51
  end
53
52
  end
@@ -13,11 +13,20 @@ module RelatonIho
13
13
  super
14
14
  end
15
15
 
16
+ #
17
+ # Fetch flavor schema version
18
+ #
19
+ # @return [String] flavor schema version
20
+ #
21
+ def ext_schema
22
+ @ext_schema ||= schema_versions["relaton-model-iho"]
23
+ end
24
+
16
25
  # @param hash [Hash]
17
26
  # @return [RelatonIho::IhoBibliographicItem]
18
27
  def self.from_hash(hash)
19
28
  item_hash = ::RelatonIho::HashConverter.hash_to_bib(hash)
20
- new **item_hash
29
+ new(**item_hash)
21
30
  end
22
31
 
23
32
  # @param opts [Hash]
@@ -29,12 +38,13 @@ module RelatonIho
29
38
  super ext: !commentperiod.nil?, **opts do |b|
30
39
  if opts[:bibdata] && (doctype || editorialgroup&.presence? ||
31
40
  ics.any? || commentperiod)
32
- b.ext do
41
+ ext = b.ext do
33
42
  b.doctype doctype if doctype
34
43
  editorialgroup&.to_xml b
35
44
  ics.each { |i| i.to_xml b }
36
45
  commentperiod&.to_xml b
37
46
  end
47
+ ext["schema-version"] = ext_schema unless opts[:embedded]
38
48
  end
39
49
  end
40
50
  end
@@ -15,12 +15,9 @@ module RelatonIho
15
15
  resp = Net::HTTP.get_response uri
16
16
  return unless resp.code == "200"
17
17
 
18
- yaml = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0.pre1")
19
- YAML.safe_load(resp.body, permitted_classes: [Date])
20
- else
21
- YAML.safe_load(resp.body, [Date])
22
- end
18
+ yaml = RelatonBib.parse_yaml resp.body, [Date]
23
19
  hash = HashConverter.hash_to_bib yaml
20
+ hash[:fetched] = Date.today.to_s
24
21
  item = IhoBibliographicItem.new(**hash)
25
22
  warn "[relaton-iho] (\"#{text}\") found #{item.docidentifier.first.id}"
26
23
  item
@@ -1,3 +1,3 @@
1
1
  module RelatonIho
2
- VERSION = "1.12.1".freeze
2
+ VERSION = "1.14.0".freeze
3
3
  end
data/relaton_iho.gemspec CHANGED
@@ -30,5 +30,5 @@ Gem::Specification.new do |s|
30
30
  s.add_development_dependency "vcr"
31
31
  s.add_development_dependency "webmock"
32
32
 
33
- s.add_dependency "relaton-bib", "~> 1.12.0"
33
+ s.add_dependency "relaton-bib", "~> 1.14.0"
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.1
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-29 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.12.0
131
+ version: 1.14.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.12.0
138
+ version: 1.14.0
139
139
  description: 'RelatonIho: retrieve IHO Standards for bibliographic using the BibliographicItem
140
140
  model'
141
141
  email:
@@ -145,6 +145,7 @@ extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
147
  - ".github/workflows/rake.yml"
148
+ - ".github/workflows/release.yml"
148
149
  - ".gitignore"
149
150
  - ".rspec"
150
151
  - ".rubocop.yml"
@@ -153,10 +154,10 @@ files:
153
154
  - Rakefile
154
155
  - bin/rspec
155
156
  - grammars/basicdoc.rng
157
+ - grammars/biblio-standoc.rng
156
158
  - grammars/biblio.rng
157
- - grammars/iho.rng
158
- - grammars/isodoc.rng
159
- - grammars/reqt.rng
159
+ - grammars/relaton-iho-compile.rng
160
+ - grammars/relaton-iho.rng
160
161
  - lib/relaton_iho.rb
161
162
  - lib/relaton_iho/comment_periond.rb
162
163
  - lib/relaton_iho/editorial_group.rb
@@ -173,7 +174,7 @@ homepage: https://github.com/relaton/relaton-iho
173
174
  licenses:
174
175
  - BSD-2-Clause
175
176
  metadata: {}
176
- post_install_message:
177
+ post_install_message:
177
178
  rdoc_options: []
178
179
  require_paths:
179
180
  - lib
@@ -188,8 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  - !ruby/object:Gem::Version
189
190
  version: '0'
190
191
  requirements: []
191
- rubygems_version: 3.2.3
192
- signing_key:
192
+ rubygems_version: 3.1.6
193
+ signing_key:
193
194
  specification_version: 4
194
195
  summary: 'RelatonIho: retrieve IHO Standards for bibliographic using the BibliographicItem
195
196
  model'
data/grammars/iho.rng DELETED
@@ -1,179 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!--
4
- Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
- we cannot have a new default namespace: we will end up with a grammar with two different
6
- namespaces, one for isostandard and one for csand additions. And we do not want that.
7
- -->
8
- <include href="isodoc.rng">
9
- <start>
10
- <ref name="iho-standard"/>
11
- </start>
12
- <define name="DocumentType">
13
- <choice>
14
- <value>policy-and-procedures</value>
15
- <value>best-practices</value>
16
- <value>supporting-document</value>
17
- <value>report</value>
18
- <value>legal</value>
19
- <value>directives</value>
20
- <value>proposal</value>
21
- <value>standard</value>
22
- </choice>
23
- </define>
24
- <define name="editorialgroup">
25
- <element name="editorialgroup">
26
- <oneOrMore>
27
- <choice>
28
- <ref name="committee"/>
29
- <ref name="workgroup"/>
30
- <ref name="commission"/>
31
- </choice>
32
- </oneOrMore>
33
- </element>
34
- </define>
35
- <define name="BibDataExtensionType">
36
- <optional>
37
- <ref name="doctype"/>
38
- </optional>
39
- <optional>
40
- <ref name="docsubtype"/>
41
- </optional>
42
- <zeroOrMore>
43
- <ref name="editorialgroup"/>
44
- </zeroOrMore>
45
- <zeroOrMore>
46
- <ref name="ics"/>
47
- </zeroOrMore>
48
- <optional>
49
- <ref name="commentperiod"/>
50
- </optional>
51
- </define>
52
- <define name="annex">
53
- <element name="annex">
54
- <optional>
55
- <attribute name="id">
56
- <data type="ID"/>
57
- </attribute>
58
- </optional>
59
- <optional>
60
- <attribute name="language"/>
61
- </optional>
62
- <optional>
63
- <attribute name="script"/>
64
- </optional>
65
- <optional>
66
- <attribute name="inline-header">
67
- <data type="boolean"/>
68
- </attribute>
69
- </optional>
70
- <attribute name="obligation">
71
- <choice>
72
- <value>normative</value>
73
- <value>informative</value>
74
- </choice>
75
- </attribute>
76
- <optional>
77
- <ref name="section-title"/>
78
- </optional>
79
- <group>
80
- <zeroOrMore>
81
- <ref name="BasicBlock"/>
82
- </zeroOrMore>
83
- <zeroOrMore>
84
- <choice>
85
- <ref name="annex-subsection"/>
86
- <ref name="terms"/>
87
- <ref name="definitions"/>
88
- <ref name="references"/>
89
- </choice>
90
- </zeroOrMore>
91
- </group>
92
- <zeroOrMore>
93
- <ref name="annex-appendix"/>
94
- </zeroOrMore>
95
- </element>
96
- </define>
97
- </include>
98
- <define name="committee">
99
- <element name="committee">
100
- <ref name="IHO_Group"/>
101
- </element>
102
- </define>
103
- <define name="workgroup">
104
- <element name="workgroup">
105
- <ref name="IHO_Group"/>
106
- </element>
107
- </define>
108
- <define name="commission">
109
- <element name="commission">
110
- <ref name="IHO_Group"/>
111
- </element>
112
- </define>
113
- <define name="IHO_Group">
114
- <optional>
115
- <element name="name">
116
- <text/>
117
- </element>
118
- </optional>
119
- <element name="abbreviation">
120
- <text/>
121
- </element>
122
- <optional>
123
- <choice>
124
- <ref name="committee"/>
125
- <ref name="workgroup"/>
126
- <ref name="commission"/>
127
- </choice>
128
- </optional>
129
- </define>
130
- <define name="annex-appendix">
131
- <element name="appendix">
132
- <ref name="Clause-Section"/>
133
- </element>
134
- </define>
135
- <define name="commentperiod">
136
- <element name="commentperiod">
137
- <element name="from">
138
- <ref name="ISO8601Date"/>
139
- </element>
140
- <optional>
141
- <element name="to">
142
- <ref name="ISO8601Date"/>
143
- </element>
144
- </optional>
145
- </element>
146
- </define>
147
- <define name="iho-standard">
148
- <element name="iho-standard">
149
- <attribute name="version"/>
150
- <attribute name="type">
151
- <choice>
152
- <value>semantic</value>
153
- <value>presentation</value>
154
- </choice>
155
- </attribute>
156
- <ref name="bibdata"/>
157
- <zeroOrMore>
158
- <ref name="termdocsource"/>
159
- </zeroOrMore>
160
- <optional>
161
- <ref name="misccontainer"/>
162
- </optional>
163
- <optional>
164
- <ref name="boilerplate"/>
165
- </optional>
166
- <ref name="preface"/>
167
- <oneOrMore>
168
- <ref name="sections"/>
169
- </oneOrMore>
170
- <zeroOrMore>
171
- <ref name="annex"/>
172
- </zeroOrMore>
173
- <ref name="bibliography"/>
174
- <zeroOrMore>
175
- <ref name="indexsect"/>
176
- </zeroOrMore>
177
- </element>
178
- </define>
179
- </grammar>