relaton-w3c 1.16.0 → 1.16.1

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: 845e2b18fd329b3f50315eebb7cdf91bd467d53397c65cd2a9124b09d9683e61
4
- data.tar.gz: ed906f6bd964ac5af614c1ff88b485d73af30eb4006c6fdea7372f130ebd54cc
3
+ metadata.gz: 0440b77d73c24a978935bfba1bd94b9ddc58c8ebcf90cc229c4a5339a901c18c
4
+ data.tar.gz: a4b299f58a4c4c4b79946ef56e075cbff224fb8f6a639e11958a4dba996eeb5d
5
5
  SHA512:
6
- metadata.gz: debbdc5fb438e7290748f825859dd432d75d19b4937ef5d749f66c0e899c0e6d9ba3e5287239898b1c773ec9c3832fed89050abacb913fee7171446211d015ea
7
- data.tar.gz: 7e007f96fe6a1d712f9cb8766df8b844d1bcd61965e038fb28a3954b50b9d5d485bd7d6849627edc4a13902a94f2de9a0136f98adb4eaffabc194c701f8757fc
6
+ metadata.gz: 81e2bd181d0a55948a36d831d39ebb13edfc7a0d28bcff8e035f5e6544305b67bd6a28db4d647c45417ff4504aa8dde2459bd7b848b274c53c286fcc08edc360
7
+ data.tar.gz: ff49763539341324fc1d0e612d90404b52b25d11e9b2141cc7801e050abfb81e03c8c94de29c4278af452415eaf92293467b7d9817a87fbb2122fd0177a5b038
data/README.adoc CHANGED
@@ -23,16 +23,27 @@ Or install it yourself as:
23
23
 
24
24
  == Usage
25
25
 
26
- === Search for a standard using keywords
26
+ === Configuration
27
+
28
+ 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 `RelatonW3c.configure` block.
27
29
 
28
30
  [source,ruby]
29
31
  ----
30
32
  require 'relaton_w3c'
31
33
  => true
32
34
 
35
+ RelatonW3c.configure do |config|
36
+ config.logger.level = Logger::DEBUG
37
+ end
38
+ ----
39
+
40
+ === Search for a standard using keywords
41
+
42
+ [source,ruby]
43
+ ----
33
44
  item = RelatonW3c::W3cBibliography.get "W3C REC-json-ld11-20200716"
34
- [relaton-w3c] ("W3C REC-json-ld11-20200716") fetching...
35
- [relaton-w3c] ("W3C REC-json-ld11-20200716") found REC-json-ld11-20200716
45
+ [relaton-w3c] (W3C REC-json-ld11-20200716) Fetching from Relaton repository ...
46
+ [relaton-w3c] (W3C REC-json-ld11-20200716) Found: `REC-json-ld11-20200716`
36
47
  => #<RelatonW3c::W3cBibliographicItem:0x00007fc4ea03c6c0
37
48
  ...
38
49
  ----
@@ -0,0 +1,10 @@
1
+ module RelatonW3c
2
+ module Config
3
+ include RelatonBib::Config
4
+ end
5
+ extend Config
6
+
7
+ class Configuration < RelatonBib::Configuration
8
+ PROGNAME = "relaton-w3c".freeze
9
+ end
10
+ end
@@ -434,7 +434,7 @@ module RelatonW3c
434
434
  rwg = RelatonBib::WorkGroup.new name: wg["name"]
435
435
  obj << RelatonBib::TechnicalCommittee.new(rwg)
436
436
  else
437
- warn "Working group name not found for #{edg.home_page}"
437
+ Util.warn "WARNING: Working group name not found for: `#{edg.home_page}`"
438
438
  end
439
439
  end
440
440
  RelatonBib::EditorialGroup.new tc
@@ -0,0 +1,9 @@
1
+ module RelatonW3c
2
+ module Util
3
+ extend RelatonBib::Util
4
+
5
+ def self.logger
6
+ RelatonW3c.configuration.logger
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonW3c
2
- VERSION = "1.16.0".freeze
2
+ VERSION = "1.16.1".freeze
3
3
  end
@@ -8,7 +8,7 @@ module RelatonW3c
8
8
  # @param doctype [String]
9
9
  def initialize(**args)
10
10
  if args[:doctype] && !TYPES.include?(args[:doctype])
11
- warn "[relaton-w3c] invalid document type: #{args[:doctype]}"
11
+ Util.warn "Invalid document type: `#{args[:doctype]}`"
12
12
  end
13
13
  super
14
14
  end
@@ -39,15 +39,15 @@ module RelatonW3c
39
39
  # @param opts [Hash] options
40
40
  # @return [RelatonW3c::W3cBibliographicItem]
41
41
  def get(ref, _year = nil, _opts = {})
42
- warn "[relaton-w3c] (\"#{ref}\") fetching..."
42
+ Util.warn "(#{ref}) Fetching from Relaton repository ..."
43
43
  result = search(ref)
44
44
  unless result
45
- warn "[relaton-w3c] (\"#{ref}\") not found."
45
+ Util.warn "(#{ref}) Not found."
46
46
  return
47
47
  end
48
48
 
49
49
  found = result.docnumber
50
- warn "[relaton-w3c] (\"#{ref}\") found #{found}"
50
+ Util.warn "(#{ref}) Found: `#{found}`"
51
51
  result
52
52
  end
53
53
  end
data/lib/relaton_w3c.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require "relaton_bib"
2
2
  require "relaton/index"
3
3
  require "relaton_w3c/version"
4
+ require "relaton_w3c/config"
5
+ require "relaton_w3c/util"
4
6
  require "relaton_w3c/w3c_bibliography"
5
7
  require "relaton_w3c/w3c_bibliographic_item"
6
8
  require "relaton_w3c/xml_parser"
@@ -16,9 +18,9 @@ module RelatonW3c
16
18
  # Returns hash of XML reammar
17
19
  # @return [String]
18
20
  def self.grammar_hash
19
- gem_path = File.expand_path "..", __dir__
20
- grammars_path = File.join gem_path, "grammars", "*"
21
- grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
22
- Digest::MD5.hexdigest grammars
21
+ # gem_path = File.expand_path "..", __dir__
22
+ # grammars_path = File.join gem_path, "grammars", "*"
23
+ # grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
24
+ Digest::MD5.hexdigest RelatonW3c::VERSION + RelatonBib::VERSION # grammars
23
25
  end
24
26
  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.16.0
4
+ version: 1.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-03 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: linkeddata
@@ -164,12 +164,14 @@ files:
164
164
  - grammars/relaton-w3c.rng
165
165
  - lib/relaton_w3c.rb
166
166
  - lib/relaton_w3c/bibxml_parser.rb
167
+ - lib/relaton_w3c/config.rb
167
168
  - lib/relaton_w3c/data_fetcher.rb
168
169
  - lib/relaton_w3c/data_index.rb
169
170
  - lib/relaton_w3c/data_parser.rb
170
171
  - lib/relaton_w3c/hash_converter.rb
171
172
  - lib/relaton_w3c/processor.rb
172
173
  - lib/relaton_w3c/pubid.rb
174
+ - lib/relaton_w3c/util.rb
173
175
  - lib/relaton_w3c/version.rb
174
176
  - lib/relaton_w3c/w3c_bibliographic_item.rb
175
177
  - lib/relaton_w3c/w3c_bibliography.rb