relaton-bib 1.18.5 → 1.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -0
- data/README.adoc +5 -12
- data/grammars/basicdoc.rng +3 -0
- data/grammars/versions.json +5 -5
- 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 +0 -12
- data/lib/relaton_bib/contribution_info.rb +1 -1
- data/lib/relaton_bib/contributor.rb +18 -0
- data/lib/relaton_bib/document_relation.rb +1 -1
- data/lib/relaton_bib/forename.rb +4 -0
- data/lib/relaton_bib/formatted_string.rb +4 -0
- data/lib/relaton_bib/full_name.rb +5 -0
- data/lib/relaton_bib/hash_converter.rb +1 -1
- data/lib/relaton_bib/image.rb +6 -0
- data/lib/relaton_bib/localized_string.rb +6 -0
- data/lib/relaton_bib/organization.rb +10 -0
- data/lib/relaton_bib/util.rb +6 -7
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +1 -1
- data/lib/relaton_bib.rb +1 -1
- data/relaton-bib.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20fdd20c795644afb49d384f59a61147d4161e0f10de362996a6537976bf1e2e
|
4
|
+
data.tar.gz: 1d5f51e63402f944d4fad44e1884f8661af541a3cab52b37e46d2713acbf5d57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e069c6c9ee0b670b354f0409993de0ded12e11515bc771b5da1b178345669b48d3328ffd13d14e30ebf5dbe56380500e7f7c1912d75482b438c0348f6b402021
|
7
|
+
data.tar.gz: ba884104669e91900dfaca9ddbfa4ac6449b0bff33c6296f6bcb71947c3455c31e725eee3baeda12974a82e9861c3546ab45556a6c98aedc9f5f2812046ff8eb
|
data/.github/workflows/rake.yml
CHANGED
data/README.adoc
CHANGED
@@ -27,24 +27,13 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
== Usage
|
29
29
|
|
30
|
-
===
|
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.
|
30
|
+
=== Create bibliographic item
|
33
31
|
|
34
32
|
[source,ruby]
|
35
33
|
----
|
36
34
|
require 'relaton_bib'
|
37
35
|
=> true
|
38
36
|
|
39
|
-
RelatonBib.configure do |config|
|
40
|
-
config.logger.level = Logger::DEBUG
|
41
|
-
end
|
42
|
-
----
|
43
|
-
|
44
|
-
=== Create bibliographic item
|
45
|
-
|
46
|
-
[source,ruby]
|
47
|
-
----
|
48
37
|
hash = YAML.load_file "spec/examples/bib_item.yml"
|
49
38
|
=> {"id"=>"ISOTC211",
|
50
39
|
"fetched"=>"2022-05-02",
|
@@ -304,6 +293,10 @@ item.to_bibxml
|
|
304
293
|
</reference>"
|
305
294
|
----
|
306
295
|
|
296
|
+
=== Logging
|
297
|
+
|
298
|
+
RelatonBib 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.
|
299
|
+
|
307
300
|
== Development
|
308
301
|
|
309
302
|
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.
|
data/grammars/basicdoc.rng
CHANGED
data/grammars/versions.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
|
-
"relaton-models": "v1.2.
|
3
|
-
"basicdoc-models": "v1.1.
|
2
|
+
"relaton-models": "v1.2.9",
|
3
|
+
"basicdoc-models": "v1.1.3",
|
4
4
|
"metanorma-requirements-models": "v1.0.1",
|
5
5
|
"relaton-model-ieee": "v1.0.1",
|
6
|
-
"relaton-model-iso": "v1.0.
|
6
|
+
"relaton-model-iso": "v1.0.3",
|
7
7
|
"relaton-model-iec": "v1.0.0",
|
8
8
|
"relaton-model-bsi": "v1.0.2",
|
9
9
|
"relaton-model-gb": "v1.0.0",
|
@@ -29,6 +29,6 @@
|
|
29
29
|
"relaton-model-oasis": "v1.0.1",
|
30
30
|
"relaton-model-jis": "v0.0.1",
|
31
31
|
"relaton-model-etsi": "v0.0.3",
|
32
|
-
"metanorma-model": "v1.
|
33
|
-
"date": "2024-
|
32
|
+
"metanorma-model": "v1.3.0",
|
33
|
+
"date": "2024-02-21T18:15:14Z"
|
34
34
|
}
|
@@ -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
|
-
Util.warn "
|
21
|
+
Util.warn "Invalid locality type: `#{type}`"
|
22
22
|
end
|
23
23
|
|
24
24
|
@type = type
|
@@ -207,7 +207,7 @@ module RelatonBib
|
|
207
207
|
# @option link [String] :content
|
208
208
|
def initialize(**args)
|
209
209
|
if args[:type] && !TYPES.include?(args[:type])
|
210
|
-
Util.warn %{
|
210
|
+
Util.warn %{Type `#{args[:type]}` is invalid.}
|
211
211
|
end
|
212
212
|
|
213
213
|
@title = if args[:title].is_a?(TypedTitleStringCollection)
|
data/lib/relaton_bib/config.rb
CHANGED
@@ -10,18 +10,6 @@ module RelatonBib
|
|
10
10
|
end
|
11
11
|
|
12
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
13
|
end
|
26
14
|
|
27
15
|
extend Config
|
@@ -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
|
-
Util.warn %{
|
25
|
+
Util.warn %{Contributor's type `#{args[:type]}` is invalid.}
|
26
26
|
end
|
27
27
|
|
28
28
|
@type = args[:type]
|
@@ -30,6 +30,12 @@ module RelatonBib
|
|
30
30
|
@formatted_address = args[:formatted_address] unless args[:city] && args[:country]
|
31
31
|
end
|
32
32
|
|
33
|
+
def ==(other)
|
34
|
+
street == other.street && city == other.city && state == other.state &&
|
35
|
+
country == other.country && postcode == other.postcode &&
|
36
|
+
formatted_address == other.formatted_address
|
37
|
+
end
|
38
|
+
|
33
39
|
# @param doc [Nokogiri::XML::Document]
|
34
40
|
def to_xml(doc) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
35
41
|
doc.address do
|
@@ -100,6 +106,10 @@ module RelatonBib
|
|
100
106
|
@value = value
|
101
107
|
end
|
102
108
|
|
109
|
+
def ==(other)
|
110
|
+
type == other.type && subtype == other.subtype && value == other.value
|
111
|
+
end
|
112
|
+
|
103
113
|
# @param builder [Nokogiri::XML::Document]
|
104
114
|
def to_xml(builder)
|
105
115
|
node = builder.send type, value
|
@@ -144,6 +154,10 @@ module RelatonBib
|
|
144
154
|
@description = description
|
145
155
|
end
|
146
156
|
|
157
|
+
def ==(other)
|
158
|
+
name == other.name && organization == other.organization && description == other.description
|
159
|
+
end
|
160
|
+
|
147
161
|
# @param opts [Hash]
|
148
162
|
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
149
163
|
# @option opts [String] :lang language
|
@@ -224,6 +238,10 @@ module RelatonBib
|
|
224
238
|
@contact = contact
|
225
239
|
end
|
226
240
|
|
241
|
+
def ==(other)
|
242
|
+
uri == other.uri && contact == other.contact
|
243
|
+
end
|
244
|
+
|
227
245
|
# Returns url.
|
228
246
|
# @return [String]
|
229
247
|
def url
|
@@ -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
|
-
Util.warn "
|
49
|
+
Util.warn "Invalid relation type: `#{type}`"
|
50
50
|
end
|
51
51
|
@type = type
|
52
52
|
@description = description
|
data/lib/relaton_bib/forename.rb
CHANGED
@@ -37,6 +37,11 @@ module RelatonBib
|
|
37
37
|
@completename = args[:completename]
|
38
38
|
end
|
39
39
|
|
40
|
+
def ==(other)
|
41
|
+
surname == other.surname && abbreviation == other.abbreviation && completename == other.completename &&
|
42
|
+
forename == other.forename && initials == other.initials && addition == other.addition && prefix == other.prefix
|
43
|
+
end
|
44
|
+
|
40
45
|
# @param opts [Hash]
|
41
46
|
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
42
47
|
# @option opts [String] :lang language
|
data/lib/relaton_bib/image.rb
CHANGED
@@ -29,6 +29,12 @@ module RelatonBib
|
|
29
29
|
@longdesc = args[:longdesc]
|
30
30
|
end
|
31
31
|
|
32
|
+
def ==(other)
|
33
|
+
other.is_a?(Image) && id == other.id && src == other.src && mimetype == other.mimetype &&
|
34
|
+
filename == other.filename && width == other.width && height == other.height &&
|
35
|
+
alt == other.alt && title == other.title && longdesc == other.longdesc
|
36
|
+
end
|
37
|
+
|
32
38
|
#
|
33
39
|
# Converts the image object to XML format.
|
34
40
|
#
|
@@ -25,6 +25,10 @@ module RelatonBib
|
|
25
25
|
@value = value
|
26
26
|
end
|
27
27
|
|
28
|
+
def ==(other)
|
29
|
+
type == other.type && value == other.value
|
30
|
+
end
|
31
|
+
|
28
32
|
# @param builder [Nokogiri::XML::Builder]
|
29
33
|
def to_xml(builder)
|
30
34
|
builder.identifier(value, type: type)
|
@@ -90,6 +94,12 @@ module RelatonBib
|
|
90
94
|
@logo = args[:logo]
|
91
95
|
end
|
92
96
|
|
97
|
+
def ==(other)
|
98
|
+
name == other.name && abbreviation == other.abbreviation &&
|
99
|
+
subdivision == other.subdivision && identifier == other.identifier &&
|
100
|
+
logo == other.logo && super
|
101
|
+
end
|
102
|
+
|
93
103
|
# @param opts [Hash]
|
94
104
|
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
95
105
|
# @option opts [String] :lang language
|
data/lib/relaton_bib/util.rb
CHANGED
@@ -2,16 +2,15 @@ module RelatonBib
|
|
2
2
|
module Util
|
3
3
|
extend self
|
4
4
|
|
5
|
-
|
6
|
-
logger.send(...)
|
7
|
-
end
|
5
|
+
PROGNAME = "relaton-bib".freeze
|
8
6
|
|
9
|
-
def
|
10
|
-
|
7
|
+
def method_missing(method_name, msg = nil, prog = nil, **opts, &block)
|
8
|
+
prog ||= self::PROGNAME
|
9
|
+
Relaton.logger_pool.send method_name, msg, prog, **opts, &block
|
11
10
|
end
|
12
11
|
|
13
|
-
def
|
14
|
-
|
12
|
+
def respond_to_missing?(method_name, include_private = false)
|
13
|
+
Relaton.logger_pool.respond_to?(method_name) || super
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
data/lib/relaton_bib/version.rb
CHANGED
data/lib/relaton_bib.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
require "relaton/logger"
|
1
2
|
require "forwardable"
|
2
3
|
require "yaml"
|
3
4
|
require "htmlentities"
|
4
5
|
require "relaton_bib/version"
|
5
6
|
require "relaton_bib/deep_dup"
|
6
|
-
require "relaton_bib/config"
|
7
7
|
require "relaton_bib/util"
|
8
8
|
require "relaton_bib/localized_string"
|
9
9
|
require "relaton_bib/forename"
|
data/relaton-bib.gemspec
CHANGED
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.
|
4
|
+
version: 1.19.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: 2024-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.16'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: relaton-logger
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.0
|
83
97
|
description: 'RelatonBib: Ruby XMLDOC impementation.'
|
84
98
|
email:
|
85
99
|
- open.source@ribose.com
|