relaton-jis 1.18.0 → 1.19.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: f81af6fcda0f11448a44416410a1887385d86893047a3b26c59168f0b702d10b
4
- data.tar.gz: 458f566abf32ca8c7a4ec52dcdfff9199d2b5e1aea0613bd824fbeca7ab1414a
3
+ metadata.gz: 53da4fedaab9f861ce6b3d306c232e00e40af65cb3d4d1e7f8977a26441c3594
4
+ data.tar.gz: 60019731d68c3b3bf520fbc99f2e7d4bc09e616fc03d470b58044867bb94820f
5
5
  SHA512:
6
- metadata.gz: 06c67dc4e2e2fda9135fe8ac68c8011e741c7739a7ddafad9367474a1e9fd87e5537412c3a180684f4d379c12e49edf7a7bd98ae55a51c445fb5d3ab7fca546d
7
- data.tar.gz: 91fbc089e677f58cad13e93d0a1351518f4caabd7b36cf1266f792fbe93e062522f8d313612597301eb0de2366de1ad0623030754be326c31449f57ce04dd442
6
+ metadata.gz: 4b8bcf1d6a2ca662b03bcf6ba2e92583932056dc387f82fcbca7acdaba9403f07164e71c7f294b9c1a06cade4fa1c3447e5caa0dbc8b1f7040a8f4ef610356ae
7
+ data.tar.gz: 2ce6c3f8eb2f284b66743d2b55d4a57eba9cceb2d26fba33a2a5b568a8786058b27f505ea275740e9d09f601042824cfd365d184f41f0b94d5b5b4c1ff89e8e5
data/README.adoc CHANGED
@@ -22,24 +22,13 @@ If bundler is not being used to manage dependencies, install the gem by executin
22
22
 
23
23
  == Usage
24
24
 
25
- === Configuration
26
-
27
- Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonJis.configure` block.
25
+ === Search for standards using keywords
28
26
 
29
27
  [source,ruby]
30
28
  ----
31
29
  require 'relaton_jis'
32
30
  => true
33
31
 
34
- RelatonJis.configure do |config|
35
- config.logger.level = Logger::DEBUG
36
- end
37
- ----
38
-
39
- === Search for standards using keywords
40
-
41
- [source,ruby]
42
- ----
43
32
  hit_collection = RelatonJis::Bibliography.search("JIS X 0208")
44
33
  => <RelatonJis::HitCollection:0x00000000018858 @ref=JIS X 0208 @fetched=false>
45
34
 
@@ -112,7 +101,7 @@ Possible options:
112
101
  [source,ruby]
113
102
  ----
114
103
  item.to_xml
115
- => "<bibitem id="JISX0208-1997" type="standard" schema-version="v1.2.8">
104
+ => "<bibitem id="JISX0208-1997" type="standard" schema-version="v1.2.9">
116
105
  <fetched>2023-03-18</fetched>
117
106
  <title format="text/plain" language="ja" script="Jpan">7ビット及び8ビットの2バイト情報交換用符号化漢字集合</title>
118
107
  <title format="text/plain" language="en" script="Lant">7-bit and 8-bit double byte coded KANJI sets for information interchange</title>
@@ -120,7 +109,7 @@ item.to_xml
120
109
  </bibitem>"
121
110
 
122
111
  item.to_xml bibdata: true
123
- => "<bibdata type="standard" schema-version="v1.2.8">
112
+ => "<bibdata type="standard" schema-version="v1.2.9">
124
113
  <fetched>2023-03-18</fetched>
125
114
  <title format="text/plain" language="ja" script="Jpan">7ビット及び8ビットの2バイト情報交換用符号化漢字集合</title>
126
115
  <title format="text/plain" language="en" script="Lant">7-bit and 8-bit double byte coded KANJI sets for information interchange</title>
@@ -160,6 +149,10 @@ item.link
160
149
  @type="pdf">]
161
150
  ----
162
151
 
152
+ === Logging
153
+
154
+ RelatonJis uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
155
+
163
156
  == Development
164
157
 
165
158
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -244,6 +244,9 @@
244
244
  <data type="ID"/>
245
245
  </attribute>
246
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
247
250
  <optional>
248
251
  <attribute name="date">
249
252
  <data type="dateTime"/>
@@ -36,7 +36,7 @@ module RelatonJis
36
36
  def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
37
37
  code = ref.sub(/\s\((all parts|規格群)\)/, "")
38
38
  opts[:all_parts] ||= !$1.nil?
39
- Util.warn "(#{ref}) Fetching from webdesk.jsa.or.jp ..."
39
+ Util.info "Fetching from webdesk.jsa.or.jp ...", key: ref
40
40
  hits = search(code, year)
41
41
  unless hits
42
42
  hint [], ref, year
@@ -44,7 +44,7 @@ module RelatonJis
44
44
  end
45
45
  result = opts[:all_parts] ? hits.find_all_parts : hits.find
46
46
  if result.is_a? RelatonJis::BibliographicItem
47
- Util.warn "(#{ref}) Found: `#{result.docidentifier[0].id}`"
47
+ Util.info "Found: `#{result.docidentifier[0].id}`", key: ref
48
48
  return result
49
49
  end
50
50
  hint result, ref, year
@@ -58,10 +58,10 @@ module RelatonJis
58
58
  # @param [String, nil] year year to search
59
59
  #
60
60
  def hint(result, ref, year)
61
- Util.warn "(#{ref}) Not found."
61
+ Util.info "Not found.", key: ref
62
62
  if result.any?
63
- Util.warn "(#{ref}) TIP: No match for edition year `#{year}`, " \
64
- "but matches exist for `#{result.uniq.join('`, `')}`."
63
+ Util.info "TIP: No match for edition year `#{year}`, but " \
64
+ "matches exist for `#{result.uniq.join('`, `')}`.", key: ref
65
65
  end
66
66
  nil
67
67
  end
@@ -9,7 +9,7 @@ module RelatonJis
9
9
 
10
10
  def check_type(type)
11
11
  unless DOCTYPES.include? type
12
- Util.warn "WARNING: invalid doctype: `#{type}`"
12
+ Util.warn "invalid doctype: `#{type}`"
13
13
  end
14
14
  end
15
15
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonJis
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonJis.configuration.logger
7
- end
4
+ PROGNAME = "relaton-jis".freeze
8
5
  end
9
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonJis
4
- VERSION = "1.18.0"
4
+ VERSION = "1.19.0"
5
5
  end
@@ -1,9 +1,17 @@
1
1
  module RelatonJis
2
2
  class XMLParser < RelatonBib::XMLParser
3
- # @param item_hash [Hash]
4
- # @return [RelatonSgpp::BibliographicItem]
5
- def self.bib_item(item_hash)
6
- BibliographicItem.new(**item_hash)
3
+ class << self
4
+ private
5
+
6
+ # @param item_hash [Hash]
7
+ # @return [RelatonSgpp::BibliographicItem]
8
+ def bib_item(item_hash)
9
+ BibliographicItem.new(**item_hash)
10
+ end
11
+
12
+ def create_doctype(type)
13
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
14
+ end
7
15
  end
8
16
  end
9
17
  end
data/lib/relaton_jis.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  require "mechanize"
4
4
  require "relaton_iso_bib"
5
5
  require_relative "relaton_jis/version"
6
- require_relative "relaton_jis/config"
7
6
  require_relative "relaton_jis/util"
8
7
  require_relative "relaton_jis/document_type"
9
8
  require_relative "relaton_jis/bibliographic_item"
data/relaton_jis.gemspec CHANGED
@@ -34,8 +34,8 @@ Gem::Specification.new do |spec|
34
34
  spec.require_paths = ["lib"]
35
35
 
36
36
  # Uncomment to register a new dependency of your gem
37
- spec.add_dependency "mechanize", "~> 2.8.0"
38
- spec.add_dependency "relaton-iso-bib", "~> 1.18.0"
37
+ spec.add_dependency "mechanize", "~> 2.10"
38
+ spec.add_dependency "relaton-iso-bib", "~> 1.19.0"
39
39
 
40
40
  # For more information and examples about making a new gem, check out our
41
41
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.19.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: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.8.0
19
+ version: '2.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.8.0
26
+ version: '2.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: relaton-iso-bib
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.18.0
33
+ version: 1.19.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.18.0
40
+ version: 1.19.0
41
41
  description: 'RelatonJis: retrieve IETF Standards for bibliographic use using the
42
42
  BibliographicItem model'
43
43
  email:
@@ -60,7 +60,6 @@ files:
60
60
  - lib/relaton_jis.rb
61
61
  - lib/relaton_jis/bibliographic_item.rb
62
62
  - lib/relaton_jis/bibliography.rb
63
- - lib/relaton_jis/config.rb
64
63
  - lib/relaton_jis/document_type.rb
65
64
  - lib/relaton_jis/hash_converter.rb
66
65
  - lib/relaton_jis/hit.rb
@@ -92,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
91
  - !ruby/object:Gem::Version
93
92
  version: '0'
94
93
  requirements: []
95
- rubygems_version: 3.3.26
94
+ rubygems_version: 3.3.27
96
95
  signing_key:
97
96
  specification_version: 4
98
97
  summary: 'RelatonJis: retrieve IETF Standards for bibliographic use using the BibliographicItem
@@ -1,10 +0,0 @@
1
- module RelatonJis
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-jis".freeze
9
- end
10
- end