relaton-gb 1.2.0 → 1.3.0

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: 6a2def68ed449438b4718929f3eac94284baa6be65232dc0f16564dc6f192f9a
4
- data.tar.gz: 31deeb1c5d825866c432c67863ba55d4e55630ad3867df8e7adb2f5ae8045fbc
3
+ metadata.gz: 272eba99fd1d47cd23a6cd3c6bef9e9f4ee9da3b92f67609a36125829ca3177c
4
+ data.tar.gz: ea2242879a194e9660662407fb35dd5cb7024b5b107c93b5c88fea24a67539b1
5
5
  SHA512:
6
- metadata.gz: 6b120c1edf6fcc8658a3dacca1806d26913c96399b2ef22e0cdc3c24079d38af7b9be633860f6e421f734d29851578675f29bd4cc69e7f97c7a2c7ce0a94bf9f
7
- data.tar.gz: f546268018b661693313f3821e0a9dd86cec929b85ee1d60e3bb93ced58e95ebab9ba172474699a8fcafeb6804487071551a465c76c0741f69a4933bcad3c997
6
+ metadata.gz: 1c94507bc12aed5456d3a4cc886f1fec4285e06b2446a75098c7842ddb018526ea619557fbda8641b41fd22a43ea0bea9167d71902085295071fc2de2a7eb402
7
+ data.tar.gz: 4cfa54290c430b6a10156017862e0730b29f743f673bb265226c5e628747592f2f0465f648c63c4a21a26ce2e2eb1c280eb8466c9c6c9de2d53443dfa0cc8a97
@@ -29,4 +29,5 @@ jobs:
29
29
  bundle install --jobs 4 --retry 3
30
30
  - name: Run specs
31
31
  run: |
32
+ unset JAVA_TOOL_OPTIONS
32
33
  bundle exec rake
@@ -5,6 +5,6 @@
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
7
  AllCops:
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.4
9
9
  Rails:
10
- Enabled: true
10
+ Enabled: false
@@ -4,5 +4,17 @@ module Cnccs
4
4
  def to_hash
5
5
  { "code" => code }
6
6
  end
7
+
8
+ # @param prefix [String]
9
+ # @param count [Integer]
10
+ # @return [String]
11
+ def to_aciibib(prefix = "", count = 1)
12
+ pref = prefix.empty? ? prefix : prefix + "."
13
+ pref += "ccs"
14
+ out = count > 1 ? "#{pref}::\n" : ""
15
+ out += "#{pref}.code:: #{code}\n" if code
16
+ out += "#{pref}.description:: #{description}\n" if description
17
+ out
18
+ end
7
19
  end
8
20
  end
@@ -60,6 +60,14 @@ module RelatonGb
60
60
  hash
61
61
  end
62
62
 
63
+ # @param prefix [String]
64
+ # @return [String]
65
+ def to_asciibib(prefix = "")
66
+ out = super
67
+ ccs.each { |c| out += c.to_aciibib prefix, ccs.size }
68
+ out
69
+ end
70
+
63
71
  # @return [String]
64
72
  def inspect
65
73
  "<#{self.class}:#{format('%<id>#.14x', id: object_id << 1)}>"
@@ -21,7 +21,7 @@ module RelatonGb
21
21
  def scrape_page(text)
22
22
  search_html = OpenURI.open_uri(
23
23
  "http://www.ttbz.org.cn/Home/Standard?searchType=2&key=" +
24
- CGI.escape(text.tr("-", [8212].pack("U"))),
24
+ CGI.escape(text.tr("-", [8212].pack("U")))
25
25
  ).read
26
26
  header = Nokogiri::HTML search_html
27
27
  xpath = '//table[contains(@class, "standard_list_table")]/tr/td/a'
@@ -85,7 +85,8 @@ module RelatonGb
85
85
 
86
86
  def get_titles(doc)
87
87
  xpz = '//td[contains(.,"中文标题")]/following-sibling::td[1]'
88
- titles = RelatonBib::TypedTitleString.from_string doc.at(xpz).text, "zh", "Hans"
88
+ titles = RelatonBib::TypedTitleString.from_string doc.at(xpz)
89
+ .text, "zh", "Hans"
89
90
  xpe = '//td[contains(.,"英文标题")]/following-sibling::td[1]'
90
91
  ten = doc.xpath(xpe).text
91
92
  return titles if ten.empty?
@@ -94,13 +95,10 @@ module RelatonGb
94
95
  end
95
96
 
96
97
  def gbtype
97
- { scope: "social-group", prefix: "T", mandate: "mandatory", topic: "other" }
98
+ { scope: "social-group", prefix: "T", mandate: "mandatory",
99
+ topic: "other" }
98
100
  end
99
101
 
100
- # def get_group_code(ref)
101
- # ref.match(%r{(?<=\/)[^\s]})
102
- # end
103
-
104
102
  def get_ccs(doc)
105
103
  [doc.xpath('//td[contains(.,"中国标准分类号")]/following-sibling::td[1]')
106
104
  .text.gsub(/[\r\n]/, "").strip.match(/^[^\s]+/).to_s]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonGb
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
5
5
  end
@@ -37,5 +37,5 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_dependency "cnccs", "~> 0.1.1"
39
39
  spec.add_dependency "gb-agencies", "~> 0.0.1"
40
- spec.add_dependency "relaton-iso-bib", ">= 1.2.0"
40
+ spec.add_dependency "relaton-iso-bib", ">= 1.3.0"
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-gb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.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: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2020-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - ">="
186
186
  - !ruby/object:Gem::Version
187
- version: 1.2.0
187
+ version: 1.3.0
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
- version: 1.2.0
194
+ version: 1.3.0
195
195
  description: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using
196
196
  the BibliographicItem model.'
197
197
  email: