relaton-w3c 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -11
- data/.rubocop.yml +1 -1
- data/grammars/biblio.rng +1 -0
- data/lib/relaton_w3c/hash_converter.rb +1 -1
- data/lib/relaton_w3c/hit_collection.rb +7 -7
- data/lib/relaton_w3c/processor.rb +1 -1
- data/lib/relaton_w3c/scrapper.rb +7 -7
- data/lib/relaton_w3c/version.rb +1 -1
- data/lib/relaton_w3c/w3c_bibliographic_item.rb +1 -1
- data/lib/relaton_w3c/xml_parser.rb +1 -1
- data/relaton_w3c.gemspec +2 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58a4044db1d46717f23268b36efff858fbfdccd7e8c3f2b47d98246831512d42
|
4
|
+
data.tar.gz: bf87dbf1f5da70e68dc771f115363c531188b103a23bbf05872c68a8c47131a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b2fae6c6cf119defdf15284f68eac82ccf50766a162889a2f09ca4c3f9e7ffa1705b9f71a2b4b0da20939948f59e424f5a18489bb5ec19d18cfdf742f150aa7
|
7
|
+
data.tar.gz: c3ecafb387e50c47a93eeb3fde746420ee801667afe24a2277d0b4812d42a922a67e5374c919d1dff091bd0f02669f156609b0dcb383390f44d9fe6d245023d1
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
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
22
|
steps:
|
33
23
|
- uses: actions/checkout@v2
|
34
24
|
with:
|
data/.rubocop.yml
CHANGED
data/grammars/biblio.rng
CHANGED
@@ -22,8 +22,8 @@ module RelatonW3c
|
|
22
22
|
# @param ref [String] reference to search
|
23
23
|
def initialize(ref)
|
24
24
|
%r{
|
25
|
-
^(W3C\s)?
|
26
|
-
(?<type>(CR|NOTE|PER|PR|REC|RET|WD|Candidate\sRecommendation|
|
25
|
+
^(?:W3C\s)?
|
26
|
+
(?<type>(?:CR|NOTE|PER|PR|REC|RET|WD|Candidate\sRecommendation|
|
27
27
|
Group\sNote|Proposed\sEdited\sRecommendation|Proposed\sRecommendation|
|
28
28
|
Recommendation|Retired|Working\sDraft))? # type
|
29
29
|
\s?
|
@@ -41,7 +41,7 @@ module RelatonW3c
|
|
41
41
|
# @param title_date [String]
|
42
42
|
# @param type [String]
|
43
43
|
# @return [Array<Hash>]
|
44
|
-
def from_yaml(title_date, type)
|
44
|
+
def from_yaml(title_date, type) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
45
45
|
/(?<title>.+)\s(?<date>\d{4}-\d{2}-\d{2})$/ =~ title_date
|
46
46
|
title ||= title_date
|
47
47
|
result = data.select do |hit|
|
@@ -50,7 +50,7 @@ module RelatonW3c
|
|
50
50
|
type_date_filter(hit, type, date)
|
51
51
|
end
|
52
52
|
if result.empty?
|
53
|
-
result = data.select { |h| h["link"].split("/").last.match?
|
53
|
+
result = data.select { |h| h["link"].split("/").last.match?(/#{title}/) }
|
54
54
|
end
|
55
55
|
result.map { |h| Hit.new(h, self) }
|
56
56
|
end
|
@@ -109,7 +109,7 @@ module RelatonW3c
|
|
109
109
|
# @param type [String]
|
110
110
|
# @return [String]
|
111
111
|
def short_type(type)
|
112
|
-
tp = TYPES.select { |
|
112
|
+
tp = TYPES.select { |_, v| v == type }.keys
|
113
113
|
tp.first || type
|
114
114
|
end
|
115
115
|
|
@@ -137,7 +137,7 @@ module RelatonW3c
|
|
137
137
|
# fetch data form server and save it to file.
|
138
138
|
#
|
139
139
|
def fetch_data
|
140
|
-
resp = Net::HTTP.get_response URI.parse(DOMAIN
|
140
|
+
resp = Net::HTTP.get_response URI.parse("#{DOMAIN}/TR/")
|
141
141
|
# return if there aren't any changes since last fetching
|
142
142
|
return unless resp.code == "200"
|
143
143
|
|
@@ -153,7 +153,7 @@ module RelatonW3c
|
|
153
153
|
# @param h_el [Nokogiri::XML::Element]
|
154
154
|
# @param link [Nokogiri::XML::Element]
|
155
155
|
# @param pubdetails [Nokogiri::XML::Element]
|
156
|
-
def fetch_hit(h_el, link, pubdetails)
|
156
|
+
def fetch_hit(h_el, link, pubdetails) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
157
157
|
datepub = pubdetails.at("text()").text.match(/\d{4}-\d{2}-\d{2}/).to_s
|
158
158
|
editor = h_el.xpath("ul[@class='editorlist']/li").map { |e| e.text.strip }
|
159
159
|
keyword = h_el.xpath("ul[@class='taglist']/li").map { |e| e.text.strip }
|
@@ -29,7 +29,7 @@ module RelatonW3c
|
|
29
29
|
# @return [RelatonIsoBib::CcBibliographicItem]
|
30
30
|
def hash_to_bib(hash)
|
31
31
|
item_hash = ::RelatonW3c::HashConverter.hash_to_bib(hash)
|
32
|
-
::RelatonW3c::W3cBibliographicItem.new
|
32
|
+
::RelatonW3c::W3cBibliographicItem.new(**item_hash)
|
33
33
|
end
|
34
34
|
|
35
35
|
# Returns hash of XML grammar
|
data/lib/relaton_w3c/scrapper.rb
CHANGED
@@ -29,7 +29,7 @@ module RelatonW3c
|
|
29
29
|
doctype: fetch_doctype(hit, doc),
|
30
30
|
contributor: fetch_contributor(hit, doc),
|
31
31
|
relation: fetch_relation(doc),
|
32
|
-
keyword: hit["keyword"]
|
32
|
+
keyword: hit["keyword"],
|
33
33
|
)
|
34
34
|
end
|
35
35
|
|
@@ -53,7 +53,7 @@ module RelatonW3c
|
|
53
53
|
titles << { content: title.gsub(/\n/, " "), type: "main" }
|
54
54
|
end
|
55
55
|
subtitle = doc.at(
|
56
|
-
"//h2[@id='subtitle']|//p[contains(@class, 'subline')]"
|
56
|
+
"//h2[@id='subtitle']|//p[contains(@class, 'subline')]",
|
57
57
|
)&.text
|
58
58
|
titles << { content: subtitle, tipe: "subtitle" } if subtitle
|
59
59
|
end
|
@@ -62,7 +62,7 @@ module RelatonW3c
|
|
62
62
|
end
|
63
63
|
titles.map do |t|
|
64
64
|
title = RelatonBib::FormattedString.new(
|
65
|
-
content: t[:content], language: "en", script: "Latn"
|
65
|
+
content: t[:content], language: "en", script: "Latn",
|
66
66
|
)
|
67
67
|
RelatonBib::TypedTitleString.new(type: t[:type], title: title)
|
68
68
|
end
|
@@ -88,7 +88,7 @@ module RelatonW3c
|
|
88
88
|
# @param hit [Hash]
|
89
89
|
# @param doc [Nokogiri::HTML::Document, NilClass]
|
90
90
|
# @return [Array<RelatonBib::BibliographicDate>]
|
91
|
-
def fetch_date(hit, doc)
|
91
|
+
def fetch_date(hit, doc) # rubocop:disable Metrics/CyclomaticComplexity
|
92
92
|
on = hit["datepub"] || doc&.at("//h2/time[@datetime]")&.attr(:datetime)
|
93
93
|
on ||= fetch_date1(doc) || fetch_date2(doc)
|
94
94
|
[RelatonBib::BibliographicDate.new(type: "published", on: on)] if on
|
@@ -143,7 +143,7 @@ module RelatonW3c
|
|
143
143
|
end
|
144
144
|
mem
|
145
145
|
end
|
146
|
-
contribs.map { |c| contrib_info
|
146
|
+
contribs.map { |c| contrib_info(**c) }
|
147
147
|
else
|
148
148
|
hit["editor"].map do |ed|
|
149
149
|
contrib_info name: ed, role: [{ type: "editor" }]
|
@@ -162,7 +162,7 @@ module RelatonW3c
|
|
162
162
|
# @param element [Nokogiri::XML::Element]
|
163
163
|
# @param type [String]
|
164
164
|
# @return [Hash]
|
165
|
-
def parse_contrib(element, type)
|
165
|
+
def parse_contrib(element, type) # rubocop:disable Metrics/MethodLength
|
166
166
|
p = element.at("a")
|
167
167
|
return unless p
|
168
168
|
|
@@ -187,7 +187,7 @@ module RelatonW3c
|
|
187
187
|
name = RelatonBib::FullName.new completename: completename
|
188
188
|
af = []
|
189
189
|
if args[:org]
|
190
|
-
org = RelatonBib::Organization.new
|
190
|
+
org = RelatonBib::Organization.new(**args[:org])
|
191
191
|
af << RelatonBib::Affiliation.new(organization: org)
|
192
192
|
end
|
193
193
|
en = RelatonBib::Person.new name: name, url: args[:url], affiliation: af
|
data/lib/relaton_w3c/version.rb
CHANGED
data/relaton_w3c.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
"using the IsoBibliographicItem model"
|
15
15
|
spec.homepage = "https://github.com/relaton/relaton-wc3"
|
16
16
|
spec.license = "BSD-2-Clause"
|
17
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
18
18
|
|
19
19
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
20
|
|
@@ -31,13 +31,11 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
|
-
# spec.add_development_dependency "debase"
|
35
34
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
36
|
-
# spec.add_development_dependency "ruby-debug-ide"
|
37
35
|
spec.add_development_dependency "ruby-jing"
|
38
36
|
spec.add_development_dependency "simplecov"
|
39
37
|
spec.add_development_dependency "vcr"
|
40
38
|
spec.add_development_dependency "webmock"
|
41
39
|
|
42
|
-
spec.add_dependency "relaton-bib", ">= 1.
|
40
|
+
spec.add_dependency "relaton-bib", ">= 1.9.0"
|
43
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-w3c
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.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: 2021-
|
11
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.9.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.9.0
|
97
97
|
description: 'RelatonIso: retrieve W3C Standards for bibliographic using the IsoBibliographicItem
|
98
98
|
model'
|
99
99
|
email:
|
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
140
|
requirements:
|
141
141
|
- - ">="
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: 2.
|
143
|
+
version: 2.5.0
|
144
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
146
|
- - ">="
|