bolognese 1.8 → 1.8.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4db42ab310128e14958777f979522287564747fcd8888350b05d0c1447f3b322
4
- data.tar.gz: 1595844b30af956ab7c1d778b0c1ee13b8fa7bbfdb44d64c96360d1ab6e55262
3
+ metadata.gz: 376b23604e3b499e8a9940fb4bf94521e7322060bf936691dc27a84d026b70f5
4
+ data.tar.gz: b1707251dac68f87403519a282f102e0a81211df59b63210024e2ab05d67a1b8
5
5
  SHA512:
6
- metadata.gz: c28f7e14d5536470ff45df9d47705fecf70ca29c11ad5e77af7842f38614e664d6bc4b6989c3b5018c3cff64d649ceef1426736d99abb44b5b2f3bf400d04a41
7
- data.tar.gz: 4eb706157bf726ab4c56282f8826b467414a1bb25df6aae29e7a4eab2780573a5c24406d82ed3ebf00c326a1df28cdc8036a8680001bac02e1a2e021e4b0613e
6
+ metadata.gz: 8d2ac04bb2e7c41adc3fea5a8ae829ca8e7e556c117dc135d8096dbb059c8888eab9051948c6a9840f8f8694c3eac85446e67dbae612969fbe11ec594666953b
7
+ data.tar.gz: 7421c681bc9182b9dc5b1601b07ceadc4a5069d9d40b7850da8dfaf9c81b4c34b6e3316a11a3f24f9e5dee08d2a2acf139514c826417198b9f3fe69d42ecd255
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.8)
4
+ bolognese (1.8.1)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -190,7 +190,7 @@ GEM
190
190
  addressable (>= 2.3.6)
191
191
  crack (>= 0.3.2)
192
192
  hashdiff (>= 0.4.0, < 2.0.0)
193
- zeitwerk (2.3.1)
193
+ zeitwerk (2.4.0)
194
194
 
195
195
  PLATFORMS
196
196
  ruby
@@ -11,7 +11,13 @@ module Bolognese
11
11
  end
12
12
 
13
13
  def datacite_errors(xml: nil, schema_version: nil)
14
- schema_version = schema_version.to_s.start_with?("http://datacite.org/schema/kernel") ? schema_version : "http://datacite.org/schema/kernel-4"
14
+ if xml.present?
15
+ namespaces = Nokogiri::XML(xml, nil, 'UTF-8').root.namespaces
16
+ schema_version = namespaces.fetch('xmlns',nil).presence || namespaces.fetch('xmlns:ns0',nil).presence
17
+ else
18
+ schema_version = schema_version.to_s.start_with?("http://datacite.org/schema/kernel") ? schema_version : "http://datacite.org/schema/kernel-4"
19
+ end
20
+
15
21
  kernel = schema_version.to_s.split("/").last
16
22
  filepath = File.expand_path("../../../resources/#{kernel}/metadata.xsd", __FILE__)
17
23
  schema = Nokogiri::XML::Schema(open(filepath))
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.8"
2
+ VERSION = "1.8.1"
3
3
  end
@@ -19,6 +19,18 @@ describe Bolognese::Metadata, vcr: true do
19
19
  expect(bibtex[:copyright]).to eq("Creative Commons Attribution 3.0 Unported")
20
20
  end
21
21
 
22
+ it "with schema_3" do
23
+ # input = fixture_path + "datacite_kernel_3.json"
24
+ input = fixture_path + "datacite_schema_3.xml"
25
+ json = Bolognese::Metadata.new(input: input, from: "datacite")
26
+ subject = Bolognese::Metadata.new(input: json.meta.to_json, from: "datacite_json")
27
+ bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
28
+ expect(bibtex[:bibtex_type].to_s).to eq("misc")
29
+ expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5061/dryad.8515")
30
+ expect(bibtex[:doi]).to eq("10.5061/dryad.8515")
31
+ expect(bibtex[:year]).to eq("2011")
32
+ end
33
+
22
34
  it "with pages" do
23
35
  input = "https://doi.org/10.1155/2012/291294"
24
36
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.8'
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-14 00:00:00.000000000 Z
11
+ date: 2020-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma