relaton-calconnect 1.5.pre → 1.7.2

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: 3dca0aeb725696f4ef2d17c143b6b6255d9a47d8c05a082916f783be1bf88f4e
4
- data.tar.gz: 27d64a1311420b5d770f753eccd8c58fc5feaf20b89b1d3a561a58e43fcc964f
3
+ metadata.gz: 857927d12dd48d1a82d159cc30be480c9b1339861e8301105239fc1e21ed3958
4
+ data.tar.gz: edff3c271819dcb5f5edbddfdeaac31e52ee5ccf35fe3939583e80d0183f805c
5
5
  SHA512:
6
- metadata.gz: 71c362c5d1645a5debb3bc59a64c495fc55bd9fddab3be87914aef4db96e472cb5ccc45d0721297f8b16ded6ced2daf2084bb67c45d84dfd36322e8d1b47a8d1
7
- data.tar.gz: f57d905480e90042445a6d5da7a91f5fa58d9de204586cb4b07b180e21b2468d83afeed0fe52fc7df93703e6a1bb84fc6635c4e99f2f738b8f0ff8b09024193c
6
+ metadata.gz: 896cbcaaa97d35e0e476c64ac3767eb4a6eeed486293ac0e150d153d16d454b9064f6aa04650f0b4e7e12b0bad6d2db74d0848b653db82f6a8f2a5ba939278fc
7
+ data.tar.gz: b6cdf91c3c963deea83ef1a3c8833b4beffac7bd726d6350e7d0881b613a2f9b0619da89cc140b90d2b85860a5b07e0fa32e0d9aedcf731915ec0a56c8716744
@@ -0,0 +1,46 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ continue-on-error: ${{ matrix.experimental }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ include:
23
+ - ruby: '3.0'
24
+ os: 'ubuntu-latest'
25
+ experimental: true
26
+ - ruby: '3.0'
27
+ os: 'windows-latest'
28
+ experimental: true
29
+ - ruby: '3.0'
30
+ os: 'macos-latest'
31
+ experimental: true
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
36
+
37
+ # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
38
+ - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
39
+ run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
40
+
41
+ - uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: ${{ matrix.ruby }}
44
+ bundler-cache: true
45
+
46
+ - run: bundle exec rake
data/README.adoc CHANGED
@@ -101,11 +101,7 @@ hash = YAML.load_file 'spec/fixtures/cc_dir_10005_2019.yml'
101
101
  => {"id"=>"CC/DIR10005-2019",
102
102
  ...
103
103
 
104
- bib_hash = RelatonCalconnect::HashConverter.hash_to_bib hash
105
- => {:id=>"CC/DIR10005-2019",
106
- ...
107
-
108
- RelatonCalconnect::CcBibliographicItem.new bib_hash
104
+ RelatonCalconnect::CcBibliographicItem.from_hash hash
109
105
  => #<RelatonCalconnect::CcBibliographicItem:0x007fc5a0109f88
110
106
  ...
111
107
  ----
data/grammars/csd.rng CHANGED
@@ -86,7 +86,7 @@
86
86
  </element>
87
87
  </define>
88
88
  <define name="technical-committee">
89
- <element name="technical-committee">
89
+ <element name="committee">
90
90
  <optional>
91
91
  <attribute name="type"/>
92
92
  </optional>
@@ -96,6 +96,13 @@
96
96
  </include>
97
97
  <define name="csd-standard">
98
98
  <element name="csd-standard">
99
+ <attribute name="version"/>
100
+ <attribute name="type">
101
+ <choice>
102
+ <value>semantic</value>
103
+ <value>presentation</value>
104
+ </choice>
105
+ </attribute>
99
106
  <ref name="bibdata"/>
100
107
  <zeroOrMore>
101
108
  <ref name="termdocsource"/>
data/grammars/isodoc.rng CHANGED
@@ -24,6 +24,14 @@
24
24
  <start>
25
25
  <ref name="standard-document"/>
26
26
  </start>
27
+ <define name="doctype">
28
+ <element name="doctype">
29
+ <optional>
30
+ <attribute name="abbreviation"/>
31
+ </optional>
32
+ <ref name="DocumentType"/>
33
+ </element>
34
+ </define>
27
35
  <define name="hyperlink">
28
36
  <element name="link">
29
37
  <attribute name="target">
@@ -42,7 +50,6 @@
42
50
  </define>
43
51
  <define name="xref">
44
52
  <element name="xref">
45
- <!-- attribute target { xsd:IDREF }, -->
46
53
  <attribute name="target">
47
54
  <data type="string">
48
55
  <param name="pattern">\i\c*|\c+#\c+</param>
@@ -142,6 +149,11 @@
142
149
  <data type="boolean"/>
143
150
  </attribute>
144
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
145
157
  <oneOrMore>
146
158
  <ref name="dt"/>
147
159
  <ref name="dd"/>
@@ -864,6 +876,13 @@
864
876
  </define>
865
877
  <define name="standard-document">
866
878
  <element name="standard-document">
879
+ <attribute name="version"/>
880
+ <attribute name="type">
881
+ <choice>
882
+ <value>semantic</value>
883
+ <value>presentation</value>
884
+ </choice>
885
+ </attribute>
867
886
  <ref name="bibdata"/>
868
887
  <optional>
869
888
  <ref name="boilerplate"/>
@@ -1158,49 +1177,7 @@
1158
1177
  </define>
1159
1178
  <define name="annex">
1160
1179
  <element name="annex">
1161
- <optional>
1162
- <attribute name="id">
1163
- <data type="ID"/>
1164
- </attribute>
1165
- </optional>
1166
- <optional>
1167
- <attribute name="language"/>
1168
- </optional>
1169
- <optional>
1170
- <attribute name="script"/>
1171
- </optional>
1172
- <optional>
1173
- <attribute name="inline-header">
1174
- <data type="boolean"/>
1175
- </attribute>
1176
- </optional>
1177
- <attribute name="obligation">
1178
- <choice>
1179
- <value>normative</value>
1180
- <value>informative</value>
1181
- </choice>
1182
- </attribute>
1183
- <optional>
1184
- <ref name="section-title"/>
1185
- </optional>
1186
- <group>
1187
- <group>
1188
- <zeroOrMore>
1189
- <ref name="BasicBlock"/>
1190
- </zeroOrMore>
1191
- <zeroOrMore>
1192
- <ref name="note"/>
1193
- </zeroOrMore>
1194
- </group>
1195
- <zeroOrMore>
1196
- <choice>
1197
- <ref name="annex-subsection"/>
1198
- <ref name="terms"/>
1199
- <ref name="definitions"/>
1200
- <ref name="references"/>
1201
- </choice>
1202
- </zeroOrMore>
1203
- </group>
1180
+ <ref name="Annex-Section"/>
1204
1181
  </element>
1205
1182
  </define>
1206
1183
  <define name="terms">
@@ -4,6 +4,7 @@ require "relaton_calconnect/cc_bibliography"
4
4
  require "relaton_calconnect/hit_collection"
5
5
  require "relaton_calconnect/hit"
6
6
  require "relaton_calconnect/scrapper"
7
+ require "relaton_calconnect/technical_committee"
7
8
  require "relaton_calconnect/cc_bibliographic_item"
8
9
  require "relaton_calconnect/xml_parser"
9
10
  require "relaton_calconnect/hash_converter"
@@ -4,5 +4,12 @@ module RelatonCalconnect
4
4
  directive guide specification standard report administrative amendment
5
5
  technical\ corrigendum advisory
6
6
  ].freeze
7
+
8
+ # @param hash [Hash]
9
+ # @return [RelatonIsoBib::CcBibliographicItem]
10
+ def self.from_hash(hash)
11
+ item_hash = ::RelatonCalconnect::HashConverter.hash_to_bib(hash)
12
+ new **item_hash
13
+ end
7
14
  end
8
15
  end
@@ -64,9 +64,9 @@ module RelatonCalconnect
64
64
  return { ret: item } if !year
65
65
 
66
66
  item.date.select { |d| d.type == "published" }.each do |d|
67
- return { ret: item } if year.to_i == d.on.year
67
+ return { ret: item } if year.to_i == d.on(:year)
68
68
 
69
- missed_years << d.on.year
69
+ missed_years << d.on(:year)
70
70
  end
71
71
  end
72
72
  { years: missed_years }
@@ -1,4 +1,15 @@
1
1
  module RelatonCalconnect
2
2
  class HashConverter < RelatonBib::HashConverter
3
+ class << self
4
+ # @param ret [Hash]
5
+ def editorialgroup_hash_to_bib(ret)
6
+ return unless ret[:editorialgroup]
7
+
8
+ technical_committee = array(ret[:editorialgroup]).map do |wg|
9
+ TechnicalCommittee.new RelatonBib::WorkGroup.new(**wg)
10
+ end
11
+ ret[:editorialgroup] = RelatonBib::EditorialGroup.new technical_committee
12
+ end
13
+ end
3
14
  end
4
15
  end
@@ -28,8 +28,7 @@ module RelatonCalconnect
28
28
  # @param hash [Hash]
29
29
  # @return [RelatonIsoBib::CcBibliographicItem]
30
30
  def hash_to_bib(hash)
31
- item_hash = ::RelatonCalconnect::HashConverter.hash_to_bib(hash)
32
- ::RelatonCalconnect::CcBibliographicItem.new item_hash
31
+ ::RelatonCalconnect::CcBibliographicItem.from_hash hash
33
32
  end
34
33
 
35
34
  # Returns hash of XML grammar
@@ -0,0 +1,8 @@
1
+ module RelatonCalconnect
2
+ class TechnicalCommittee < RelatonBib::TechnicalCommittee
3
+ # @param builder [Nokogiri::XML::Builder]
4
+ def to_xml(builder)
5
+ builder.committee { |b| workgroup.to_xml b }
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonCalconnect
2
- VERSION = "1.5.pre".freeze
2
+ VERSION = "1.7.2".freeze
3
3
  end
@@ -5,7 +5,20 @@ module RelatonCalconnect
5
5
  # @param item_hash [Hash]
6
6
  # @return [RelatonIsoBib::IsoBibliographicItem]
7
7
  def bib_item(item_hash)
8
- CcBibliographicItem.new item_hash
8
+ CcBibliographicItem.new **item_hash
9
+ end
10
+
11
+ # @param ext [Nokogiri::XML::Element]
12
+ # @return [RelatonBib::EditorialGroup, nil]
13
+ def fetch_editorialgroup(ext)
14
+ return unless ext && (eg = ext.at "editorialgroup")
15
+
16
+ eg = eg.xpath("committee", "technical-committee").map do |tc|
17
+ wg = RelatonBib::WorkGroup.new(content: tc.text, number: tc[:number]&.to_i,
18
+ type: tc[:type])
19
+ TechnicalCommittee.new wg
20
+ end
21
+ RelatonBib::EditorialGroup.new eg if eg.any?
9
22
  end
10
23
  end
11
24
  end
@@ -26,16 +26,16 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
28
28
 
29
- spec.add_development_dependency "debase"
29
+ # spec.add_development_dependency "debase"
30
30
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
  spec.add_development_dependency "rspec", "~> 3.0"
33
- spec.add_development_dependency "ruby-debug-ide"
33
+ # spec.add_development_dependency "ruby-debug-ide"
34
34
  spec.add_development_dependency "ruby-jing"
35
35
  spec.add_development_dependency "simplecov"
36
36
  spec.add_development_dependency "vcr"
37
37
  spec.add_development_dependency "webmock"
38
38
 
39
39
  spec.add_dependency "faraday"
40
- spec.add_dependency "relaton-bib", "~> 1.5.pre"
40
+ spec.add_dependency "relaton-bib", "~> 1.7.0"
41
41
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-calconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.pre
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-07 00:00:00.000000000 Z
11
+ date: 2021-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: debase
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: equivalent-xml
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +52,6 @@ dependencies:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
54
  version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- name: ruby-debug-ide
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: ruby-jing
85
57
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +128,14 @@ dependencies:
156
128
  requirements:
157
129
  - - "~>"
158
130
  - !ruby/object:Gem::Version
159
- version: 1.5.pre
131
+ version: 1.7.0
160
132
  type: :runtime
161
133
  prerelease: false
162
134
  version_requirements: !ruby/object:Gem::Requirement
163
135
  requirements:
164
136
  - - "~>"
165
137
  - !ruby/object:Gem::Version
166
- version: 1.5.pre
138
+ version: 1.7.0
167
139
  description: 'RelatonIso: retrieve CC Standards for bibliographic use using the IsoBibliographicItem
168
140
  model'
169
141
  email:
@@ -172,9 +144,7 @@ executables: []
172
144
  extensions: []
173
145
  extra_rdoc_files: []
174
146
  files:
175
- - ".github/workflows/macos.yml"
176
- - ".github/workflows/ubuntu.yml"
177
- - ".github/workflows/windows.yml"
147
+ - ".github/workflows/rake.yml"
178
148
  - ".gitignore"
179
149
  - ".rspec"
180
150
  - ".rubocop.yml"
@@ -198,6 +168,7 @@ files:
198
168
  - lib/relaton_calconnect/hit_collection.rb
199
169
  - lib/relaton_calconnect/processor.rb
200
170
  - lib/relaton_calconnect/scrapper.rb
171
+ - lib/relaton_calconnect/technical_committee.rb
201
172
  - lib/relaton_calconnect/version.rb
202
173
  - lib/relaton_calconnect/xml_parser.rb
203
174
  - relaton_calconnect.gemspec
@@ -216,9 +187,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
187
  version: 2.4.0
217
188
  required_rubygems_version: !ruby/object:Gem::Requirement
218
189
  requirements:
219
- - - ">"
190
+ - - ">="
220
191
  - !ruby/object:Gem::Version
221
- version: 1.3.1
192
+ version: '0'
222
193
  requirements: []
223
194
  rubygems_version: 3.0.6
224
195
  signing_key:
@@ -1,32 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- branches: [ '**' ]
10
-
11
- jobs:
12
- test-macos:
13
- name: Test on Ruby ${{ matrix.ruby }} macOS
14
- runs-on: macos-latest
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- ruby: [ '2.6', '2.5', '2.4' ]
19
- steps:
20
- - uses: actions/checkout@master
21
- - name: Use Ruby
22
- uses: actions/setup-ruby@v1
23
- with:
24
- ruby-version: ${{ matrix.ruby }}
25
- architecture: 'x64'
26
- - name: Update gems
27
- run: |
28
- sudo gem install bundler --force
29
- bundle install --jobs 4 --retry 3
30
- - name: Run specs
31
- run: |
32
- bundle exec rake
@@ -1,33 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- branches: [ '**' ]
10
-
11
- jobs:
12
- test-linux:
13
- name: Test on Ruby ${{ matrix.ruby }} Ubuntu
14
- runs-on: ubuntu-latest
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- ruby: [ '2.6', '2.5', '2.4' ]
19
- steps:
20
- - uses: actions/checkout@master
21
- - name: Use Ruby
22
- uses: actions/setup-ruby@v1
23
- with:
24
- ruby-version: ${{ matrix.ruby }}
25
- architecture: 'x64'
26
- - name: Update gems
27
- run: |
28
- gem install bundler
29
- bundle install --jobs 4 --retry 3
30
- - name: Run specs
31
- run: |
32
- unset JAVA_TOOL_OPTIONS
33
- bundle exec rake
@@ -1,35 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: windows
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- branches: [ '**' ]
10
-
11
- jobs:
12
- test-windows:
13
- name: Test on Ruby ${{ matrix.ruby }} Windows
14
- runs-on: windows-latest
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- ruby: [ '2.6', '2.5', '2.4' ]
19
- steps:
20
- - uses: actions/checkout@master
21
- - name: Use Ruby
22
- uses: actions/setup-ruby@v1
23
- with:
24
- ruby-version: ${{ matrix.ruby }}
25
- architecture: 'x64'
26
- - name: Update gems
27
- shell: pwsh
28
- run: |
29
- gem install bundler
30
- bundle config --local path vendor/bundle
31
- bundle update
32
- bundle install --jobs 4 --retry 3
33
- - name: Run specs
34
- run: |
35
- bundle exec rake