relaton-ogc 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rspec +29 -0
- data/lib/relaton_ogc/hash_converter.rb +1 -1
- data/lib/relaton_ogc/ogc_bibliographic_item.rb +17 -21
- data/lib/relaton_ogc/scrapper.rb +1 -1
- data/lib/relaton_ogc/version.rb +1 -1
- data/lib/relaton_ogc/xml_parser.rb +7 -7
- data/relaton_ogc.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fa7cf7cb4a2e7b21cb49a4fbb482f08119776626d18b6ab186080905783d516
|
4
|
+
data.tar.gz: d4bb20a2c3f35b1c25ac99882c5a3f7a405a420cc5d3dbcb2f6359b0f2f6166f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5679900661ae943e2e929500314cfbb98fe416ebe8c809fccd0daa6f5d2c6232d9c85844d406372ab41af3c413de914944fd7b0433e24c7582a80942fe7d710
|
7
|
+
data.tar.gz: c187307b81cc069bc652f38e494ed01de8dfe96de9c00b7fc4c719f73dcff62335cc3d4167a4d32b1b402d31ac9df7e76fe5a77e6e2295cf4c6f1937c6b1f4a5
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
@@ -14,17 +14,13 @@ module RelatonOgc
|
|
14
14
|
profile profile-with-extension general
|
15
15
|
].freeze
|
16
16
|
|
17
|
-
# @return [String]
|
18
|
-
attr_reader :docsubtype
|
19
|
-
|
20
|
-
# @param docsubtype [String]
|
21
17
|
def initialize(**args)
|
22
|
-
if args[:
|
18
|
+
if args[:subdoctype] && !SUBTYPES.include?(args[:subdoctype])
|
23
19
|
warn "[relaton-ogc] WARNING: invalid document "\
|
24
|
-
|
20
|
+
"subtype: #{args[:subdoctype]}"
|
25
21
|
end
|
26
22
|
|
27
|
-
@docsubtype = args.delete :docsubtype
|
23
|
+
# @docsubtype = args.delete :docsubtype
|
28
24
|
# @doctype = args.delete :doctype
|
29
25
|
super
|
30
26
|
end
|
@@ -33,15 +29,15 @@ module RelatonOgc
|
|
33
29
|
# @return [RelatonOgc::OgcBibliographicItem]
|
34
30
|
def self.from_hash(hash)
|
35
31
|
item_hash = ::RelatonOgc::HashConverter.hash_to_bib(hash)
|
36
|
-
new
|
32
|
+
new(**item_hash)
|
37
33
|
end
|
38
34
|
|
39
35
|
# @return [Hash]
|
40
|
-
def to_hash
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
36
|
+
# def to_hash
|
37
|
+
# hash = super
|
38
|
+
# hash["docsubtype"] = docsubtype if docsubtype
|
39
|
+
# hash
|
40
|
+
# end
|
45
41
|
|
46
42
|
# @param opts [Hash]
|
47
43
|
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
@@ -50,10 +46,10 @@ module RelatonOgc
|
|
50
46
|
# @option opts [String, Symbol] :lang language
|
51
47
|
# @return [String] XML
|
52
48
|
def to_xml(**opts)
|
53
|
-
super
|
49
|
+
super(**opts) do |b|
|
54
50
|
b.ext do
|
55
51
|
b.doctype doctype if doctype
|
56
|
-
b.
|
52
|
+
b.subdoctype subdoctype if subdoctype
|
57
53
|
editorialgroup&.to_xml b
|
58
54
|
ics.each { |i| i.to_xml b }
|
59
55
|
end
|
@@ -62,11 +58,11 @@ module RelatonOgc
|
|
62
58
|
|
63
59
|
# @param prefix [String]
|
64
60
|
# @return [String]
|
65
|
-
def to_asciibib(prefix = "")
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
61
|
+
# def to_asciibib(prefix = "")
|
62
|
+
# pref = prefix.empty? ? prefix : prefix + "."
|
63
|
+
# out = super
|
64
|
+
# out += "#{pref}docsubtype:: #{docsubtype}\n" if docsubtype
|
65
|
+
# out
|
66
|
+
# end
|
71
67
|
end
|
72
68
|
end
|
data/lib/relaton_ogc/scrapper.rb
CHANGED
@@ -43,7 +43,7 @@ module RelatonOgc
|
|
43
43
|
docid: fetch_docid(hit["identifier"]),
|
44
44
|
link: fetch_link(hit["URL"]),
|
45
45
|
doctype: type[:type],
|
46
|
-
|
46
|
+
subdoctype: type[:subtype],
|
47
47
|
docstatus: fetch_status(type[:stage]),
|
48
48
|
edition: fetch_edition(hit["identifier"]),
|
49
49
|
abstract: fetch_abstract(hit["description"]),
|
data/lib/relaton_ogc/version.rb
CHANGED
@@ -15,14 +15,14 @@ module RelatonOgc
|
|
15
15
|
# Override RelatonIsoBib::XMLParser.item_data method.
|
16
16
|
# @param item [Nokogiri::XML::Element]
|
17
17
|
# @returtn [Hash]
|
18
|
-
def item_data(item)
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# def item_data(item)
|
19
|
+
# data = super
|
20
|
+
# ext = item.at "./ext"
|
21
|
+
# return data unless ext
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
end
|
23
|
+
# data[:docsubtype] = ext.at("./docsubtype")&.text
|
24
|
+
# data
|
25
|
+
# end
|
26
26
|
|
27
27
|
# @TODO Organization doesn't recreated
|
28
28
|
# @param ext [Nokogiri::XML::Element]
|
data/relaton_ogc.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
29
29
|
spec.add_development_dependency "pry-byebug"
|
30
|
-
spec.add_development_dependency "rake", "~>
|
30
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
32
32
|
spec.add_development_dependency "ruby-jing"
|
33
33
|
spec.add_development_dependency "simplecov"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ogc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- README.adoc
|
168
168
|
- Rakefile
|
169
169
|
- bin/console
|
170
|
+
- bin/rspec
|
170
171
|
- bin/setup
|
171
172
|
- grammars/basicdoc.rng
|
172
173
|
- grammars/biblio.rng
|