gbbib 0.2.3 → 0.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: 6b003d92490a9a1c6bc3ae124b2c315232336f57fd113ddeb0edc5a1cc3aab83
4
- data.tar.gz: 5f75e05b76700d7901af1cbde25be569a2519c196b4e6753c8e8d82b2dee5b8e
3
+ metadata.gz: 76d8a97d0f8f27e188045a0ade66539907128459ef7c4ca8a25c3a588f3d174c
4
+ data.tar.gz: e017d5d7c24ea899336d206e5499659d6fe022386879bafdebe8d6b10a8a0206
5
5
  SHA512:
6
- metadata.gz: 236ebaf149fdfd887f88109f6941c11e29b826a5d25763fdd0e100e438c6b2244c162197de20c2f049d290e75b86339b2e0c50526fcd98095b5b5d910e2079a6
7
- data.tar.gz: 63fc93e2558e790221d96fd367c30d009798d0b4971049e342d85475a71ae20a5b97e78e6c94d7c3a4d5ab9588b88e90c87c049dee5168450860cdf84c527bbc
6
+ metadata.gz: d373bb28e44d4e59ac060c4e7b39a353fa493ba825527b593f7dc461840b03e93e9b188d7ad0d7b2e436e172a0e8700948981354b5cec8cd5cafb996bf0b4f3f
7
+ data.tar.gz: 82220a39f925bb98e861a6876573cc918f36bd0f984697ca483f41d093777c1f1f65d1c1cda2d884f9efca77d970615f605be3f2e23dd8deb3b975ae09cffcb2
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gbbib (0.2.2)
4
+ gbbib (0.3.0)
5
5
  cnccs (~> 0.1.1)
6
6
  gb-agencies (~> 0.0.1)
7
- iso-bib-item (~> 0.2)
7
+ iso-bib-item (~> 0.3.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -17,7 +17,7 @@ GEM
17
17
  equivalent-xml (0.6.0)
18
18
  nokogiri (>= 1.4.3)
19
19
  gb-agencies (0.0.3)
20
- iso-bib-item (0.2.5)
20
+ iso-bib-item (0.3.0)
21
21
  isoics (~> 0.1.6)
22
22
  nokogiri (~> 1.8.4)
23
23
  ruby_deep_clone (~> 0.8.0)
data/gbbib.gemspec CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
32
32
 
33
33
  spec.add_dependency 'cnccs', "~> 0.1.1"
34
- spec.add_dependency 'iso-bib-item', "~> 0.2"
34
+ spec.add_dependency 'iso-bib-item', "~> 0.3.0"
35
35
  spec.add_dependency 'gb-agencies', "~> 0.0.1"
36
36
  end
@@ -37,9 +37,12 @@ module Gbbib
37
37
  # * :project_number [String]
38
38
  # * :part_number [String]
39
39
  def get_docid(doc, xpt = '//dt[text()="标准号"]/following-sibling::dd[1]')
40
- item_ref = doc.xpath(xpt).text.match(/^([^–—.-]*\d+)\.?((?<=\.)\d+|)/)
40
+ item_ref = doc.xpath(xpt) or
41
+ return { project_number: "?", part_number: "?", prefix: nil, id: "?" }
42
+ m = item_ref.text.match(/^([^–—.-]*\d+)\.?((?<=\.)\d+|)/)
41
43
  #prefix = doc.xpath(xpt).text.match(/^[^\s]+/).to_s
42
- { project_number: item_ref[1], part_number: item_ref[2], prefix: nil }
44
+ { project_number: m[1], part_number: m[2], prefix: nil,
45
+ id: item_ref.text, type: "Chinese Standard" }
43
46
  end
44
47
 
45
48
  def get_contributors(doc, xpt = '//dt[text()="标准号"]/following-sibling::dd[1]')
@@ -54,7 +57,7 @@ module Gbbib
54
57
  ]
55
58
  [{ entity: entity, roles: ['publisher'] }]
56
59
  end
57
-
60
+
58
61
 
59
62
  # @param doc [Nokogiri::HTML::Document]
60
63
  # @return [Array<Hash>]
data/lib/gbbib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gbbib
4
- VERSION = '0.2.3'
4
+ VERSION = '0.3.0'
5
5
  end
@@ -6,8 +6,8 @@ module Relaton
6
6
 
7
7
  def initialize
8
8
  @short = :gbbib
9
- #@prefix = %r{^(GB|GJ|GS)|^ZB|^DB|^Q\/|^T\/[^\s]{3,6}\s}
10
- @prefix = %r{^GB Standard }
9
+ @prefix = "CN"
10
+ @defaultprefix = %r{^GB }
11
11
  end
12
12
 
13
13
  def get(code, date, opts)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gbbib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.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: 2018-08-25 00:00:00.000000000 Z
11
+ date: 2018-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.2'
117
+ version: 0.3.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.2'
124
+ version: 0.3.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: gb-agencies
127
127
  requirement: !ruby/object:Gem::Requirement