relaton-bib 1.14.12 → 1.14.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +12 -1
- data/grammars/versions.json +2 -2
- data/lib/relaton_bib/bib_item_locality.rb +1 -1
- data/lib/relaton_bib/bibliographic_item.rb +1 -1
- data/lib/relaton_bib/config.rb +28 -0
- data/lib/relaton_bib/contribution_info.rb +1 -1
- data/lib/relaton_bib/document_relation.rb +1 -1
- data/lib/relaton_bib/hash_converter.rb +1 -1
- data/lib/relaton_bib/util.rb +17 -0
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +3 -2
- data/lib/relaton_bib.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f574568c08eb0713aa11425b6b7316a1043ab4daf9511ce81264273621a3c6f
|
4
|
+
data.tar.gz: f159c471012a555f70f7b2b6150b6d605c4a9324f196dda26ea6de39e4b9ade8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a204325520089f88f066af03d3b16774b152fc5f8ff12c6c62b383d69d71090559adc215d67d9c90bcee6f319ff206b19904b1146096c5e481aa5aadb74fc926
|
7
|
+
data.tar.gz: 8c5e6d412172fb928a68e4712732163d6644131f80195716e7a69c4c7095bf95910fcab952069bbd99c2e1439508360708d1973c5876ebcddfdf4ae81a7787d7
|
data/README.adoc
CHANGED
@@ -27,13 +27,24 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
== Usage
|
29
29
|
|
30
|
-
===
|
30
|
+
=== Configuration
|
31
|
+
|
32
|
+
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 `RelatonBib.configure` block.
|
31
33
|
|
32
34
|
[source,ruby]
|
33
35
|
----
|
34
36
|
require 'relaton_bib'
|
35
37
|
=> true
|
36
38
|
|
39
|
+
RelatonBib.configure do |config|
|
40
|
+
config.logger.level = Logger::DEBUG
|
41
|
+
end
|
42
|
+
----
|
43
|
+
|
44
|
+
=== Create bibliographic item
|
45
|
+
|
46
|
+
[source,ruby]
|
47
|
+
----
|
37
48
|
hash = YAML.load_file "spec/examples/bib_item.yml"
|
38
49
|
=> {"id"=>"ISOTC211",
|
39
50
|
"fetched"=>"2022-05-02",
|
data/grammars/versions.json
CHANGED
@@ -26,8 +26,8 @@
|
|
26
26
|
"relaton-model-cie": "v1.0.0",
|
27
27
|
"relaton-model-iana": "v1.0.0",
|
28
28
|
"relaton-model-omg": "v1.0.0",
|
29
|
-
"relaton-model-oasis": "v1.0.
|
29
|
+
"relaton-model-oasis": "v1.0.1",
|
30
30
|
"relaton-model-jis": "v0.0.1",
|
31
31
|
"metanorma-model": "v1.2.2",
|
32
|
-
"date": "2023-
|
32
|
+
"date": "2023-08-02T19:17:03Z"
|
33
33
|
}
|
@@ -18,7 +18,7 @@ module RelatonBib
|
|
18
18
|
whole|table|annex|figure|note|list|example|volume|issue|time|anchor|
|
19
19
|
locality:[a-zA-Z0-9_]+}x
|
20
20
|
unless type&.match? type_ptrn
|
21
|
-
warn "
|
21
|
+
Util.warn "WARNING: invalid locality type: #{type}"
|
22
22
|
end
|
23
23
|
|
24
24
|
@type = type
|
@@ -204,7 +204,7 @@ module RelatonBib
|
|
204
204
|
# @option link [String] :content
|
205
205
|
def initialize(**args)
|
206
206
|
if args[:type] && !TYPES.include?(args[:type])
|
207
|
-
warn %{
|
207
|
+
Util.warn %{WARNING: type "#{args[:type]}" is invalid.}
|
208
208
|
end
|
209
209
|
|
210
210
|
@title = if args[:title].is_a?(TypedTitleStringCollection)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module RelatonBib
|
2
|
+
module Config
|
3
|
+
def configure
|
4
|
+
yield configuration if block_given?
|
5
|
+
end
|
6
|
+
|
7
|
+
def configuration
|
8
|
+
@configuration ||= self::Configuration.new
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Configuration
|
13
|
+
PROGNAME = "relaton-bib".freeze
|
14
|
+
|
15
|
+
attr_accessor :logger
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@logger = ::Logger.new $stderr
|
19
|
+
@logger.level = ::Logger::WARN
|
20
|
+
@logger.progname = self.class::PROGNAME
|
21
|
+
@logger.formatter = proc do |_severity, _datetime, progname, msg|
|
22
|
+
"[#{progname}] #{msg}\n"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
extend Config
|
28
|
+
end
|
@@ -22,7 +22,7 @@ module RelatonBib
|
|
22
22
|
# @param description [Array<String>]
|
23
23
|
def initialize(**args)
|
24
24
|
if args[:type] && !TYPES.include?(args[:type])
|
25
|
-
warn %{
|
25
|
+
Util.warn %{Contributor's type "#{args[:type]}" is invalid.}
|
26
26
|
end
|
27
27
|
|
28
28
|
@type = args[:type]
|
@@ -46,7 +46,7 @@ module RelatonBib
|
|
46
46
|
source_locality: [])
|
47
47
|
type = "obsoletes" if type == "Now withdrawn"
|
48
48
|
unless self.class::TYPES.include? type
|
49
|
-
warn "
|
49
|
+
Util.warn "WARNING: invalid relation type: #{type}"
|
50
50
|
end
|
51
51
|
@type = type
|
52
52
|
@description = description
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RelatonBib
|
2
|
+
module Util
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def method_missing(...)
|
6
|
+
logger.send(...)
|
7
|
+
end
|
8
|
+
|
9
|
+
def respond_to_missing?(method_name, include_private = false)
|
10
|
+
logger.respond_to?(method_name) || super
|
11
|
+
end
|
12
|
+
|
13
|
+
def logger
|
14
|
+
RelatonBib.configuration.logger
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/relaton_bib/version.rb
CHANGED
@@ -17,8 +17,9 @@ module RelatonBib
|
|
17
17
|
if bibitem
|
18
18
|
bib_item item_data(bibitem)
|
19
19
|
else
|
20
|
-
warn "
|
21
|
-
|
20
|
+
Util.warn "WARNING: can't find bibitem or bibdata element " \
|
21
|
+
"in the XML"
|
22
|
+
nil
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
data/lib/relaton_bib.rb
CHANGED
@@ -3,6 +3,8 @@ require "yaml"
|
|
3
3
|
require "htmlentities"
|
4
4
|
require "relaton_bib/version"
|
5
5
|
require "relaton_bib/deep_dup"
|
6
|
+
require "relaton_bib/config"
|
7
|
+
require "relaton_bib/util"
|
6
8
|
require "relaton_bib/localized_string"
|
7
9
|
require "relaton_bib/forename"
|
8
10
|
require "relaton_bib/full_name"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.13
|
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-08-
|
11
|
+
date: 2023-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/relaton_bib/bibtex_parser.rb
|
119
119
|
- lib/relaton_bib/bibxml_parser.rb
|
120
120
|
- lib/relaton_bib/classification.rb
|
121
|
+
- lib/relaton_bib/config.rb
|
121
122
|
- lib/relaton_bib/contribution_info.rb
|
122
123
|
- lib/relaton_bib/contributor.rb
|
123
124
|
- lib/relaton_bib/copyright_association.rb
|
@@ -148,6 +149,7 @@ files:
|
|
148
149
|
- lib/relaton_bib/technical_committee.rb
|
149
150
|
- lib/relaton_bib/typed_title_string.rb
|
150
151
|
- lib/relaton_bib/typed_uri.rb
|
152
|
+
- lib/relaton_bib/util.rb
|
151
153
|
- lib/relaton_bib/validity.rb
|
152
154
|
- lib/relaton_bib/version.rb
|
153
155
|
- lib/relaton_bib/workers_pool.rb
|