relaton-bib 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/grammars/biblio.rng +5 -3
- data/lib/relaton_bib/bibxml_parser.rb +1 -1
- data/lib/relaton_bib/copyright_association.rb +2 -2
- data/lib/relaton_bib/document_identifier.rb +10 -2
- data/lib/relaton_bib/hash_converter.rb +3 -2
- data/lib/relaton_bib/validity.rb +2 -2
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 882b6680091bd4bf9ba97871af6aab74dede4be12e1e6981d5e7a9a274e65659
|
4
|
+
data.tar.gz: 5ecf64a911e0cad8ca924b3fe3626b54ef60295f89f58a8e59895c415390d502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31ebec09d58af3173fc687dcbf8cfddb34b859110d05a11bc32ed144aefe0b8b57da36395ee002aad57802c32c3804aac33098d2d7d322ee442941567add638b
|
7
|
+
data.tar.gz: 828fbafc60fb7a16b876ece52b1631870ef8fdda63dce780f6a35e30907fab3f76684e02b2991db1e0ba159a61081a5e7198d6d470f1bee529ee72c61ccab921
|
data/grammars/biblio.rng
CHANGED
@@ -209,9 +209,6 @@
|
|
209
209
|
<zeroOrMore>
|
210
210
|
<ref name="contact"/>
|
211
211
|
</zeroOrMore>
|
212
|
-
<zeroOrMore>
|
213
|
-
<ref name="uri"/>
|
214
|
-
</zeroOrMore>
|
215
212
|
</element>
|
216
213
|
</define>
|
217
214
|
<define name="fullname">
|
@@ -828,6 +825,11 @@
|
|
828
825
|
<optional>
|
829
826
|
<attribute name="scope"/>
|
830
827
|
</optional>
|
828
|
+
<optional>
|
829
|
+
<attribute name="primary">
|
830
|
+
<data type="boolean"/>
|
831
|
+
</attribute>
|
832
|
+
</optional>
|
831
833
|
<text/>
|
832
834
|
</element>
|
833
835
|
</define>
|
@@ -80,7 +80,7 @@ module RelatonBib
|
|
80
80
|
/^(?<pref>I-D|3GPP|W3C|[A-Z]{2,})[._]?(?<num>.+)/ =~ id
|
81
81
|
num.sub!(/^-?0+/, "") if %w[RFC BCP FYI STD].include?(pref)
|
82
82
|
pid = pref ? "#{pref} #{num}" : id
|
83
|
-
ret << DocumentIdentifier.new(type: pubid_type(id), id: pid)
|
83
|
+
ret << DocumentIdentifier.new(type: pubid_type(id), id: pid, primary: true)
|
84
84
|
end
|
85
85
|
%w[anchor docName number].each do |atr|
|
86
86
|
if reference[atr]
|
@@ -33,7 +33,7 @@ module RelatonBib
|
|
33
33
|
o.is_a?(Hash) ? ContributionInfo.new(entity: Organization.new(**o)) : o
|
34
34
|
end
|
35
35
|
|
36
|
-
@from = Date.strptime(from.to_s, "%Y") if from.to_s.match?
|
36
|
+
@from = Date.strptime(from.to_s, "%Y") if from.to_s.match?(/\d{4}/)
|
37
37
|
@to = Date.strptime(to.to_s, "%Y") unless to.to_s.empty?
|
38
38
|
@scope = scope
|
39
39
|
end
|
@@ -45,7 +45,7 @@ module RelatonBib
|
|
45
45
|
opts[:builder].copyright do |builder|
|
46
46
|
builder.from from ? from.year : "unknown"
|
47
47
|
builder.to to.year if to
|
48
|
-
owner.each { |o| builder.owner { o.to_xml
|
48
|
+
owner.each { |o| builder.owner { o.to_xml(**opts) } }
|
49
49
|
builder.scope scope if scope
|
50
50
|
end
|
51
51
|
end
|
@@ -7,13 +7,18 @@ module RelatonBib
|
|
7
7
|
# @return [String, NilClass]
|
8
8
|
attr_reader :type, :scope
|
9
9
|
|
10
|
+
# @param type [Boolean, nil]
|
11
|
+
attr_reader :primary
|
12
|
+
|
10
13
|
# @param id [String]
|
11
14
|
# @param type [String, NilClass]
|
12
15
|
# @param scope [String, NilClass]
|
13
|
-
|
16
|
+
# @param priority [Bolean]
|
17
|
+
def initialize(id:, type: nil, scope: nil, primary: false)
|
14
18
|
@id = id
|
15
19
|
@type = type
|
16
20
|
@scope = scope
|
21
|
+
@primary = primary
|
17
22
|
end
|
18
23
|
|
19
24
|
# in docid manipulations, assume ISO as the default: id-part:year
|
@@ -56,6 +61,7 @@ module RelatonBib
|
|
56
61
|
element = opts[:builder].docidentifier lid
|
57
62
|
element[:type] = type if type
|
58
63
|
element[:scope] = scope if scope
|
64
|
+
element[:primary] = primary if primary
|
59
65
|
end
|
60
66
|
|
61
67
|
# @return [Hash]
|
@@ -63,19 +69,21 @@ module RelatonBib
|
|
63
69
|
hash = { "id" => id }
|
64
70
|
hash["type"] = type if type
|
65
71
|
hash["scope"] = scope if scope
|
72
|
+
hash["primary"] = primary if primary
|
66
73
|
hash
|
67
74
|
end
|
68
75
|
|
69
76
|
# @param prefix [String]
|
70
77
|
# @param count [Integer] number of docids
|
71
78
|
# @return [String]
|
72
|
-
def to_asciibib(prefix = "", count = 1) # rubocop:disable Metrics/CyclomaticComplexity
|
79
|
+
def to_asciibib(prefix = "", count = 1) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
73
80
|
pref = prefix.empty? ? prefix : "#{prefix}."
|
74
81
|
return "#{pref}docid:: #{id}\n" unless type || scope
|
75
82
|
|
76
83
|
out = count > 1 ? "#{pref}docid::\n" : ""
|
77
84
|
out += "#{pref}docid.type:: #{type}\n" if type
|
78
85
|
out += "#{pref}docid.scope:: #{scope}\n" if scope
|
86
|
+
out += "#{pref}docid.primary:: #{primary}\n" if primary
|
79
87
|
out + "#{pref}docid.id:: #{id}\n"
|
80
88
|
end
|
81
89
|
|
@@ -126,8 +126,9 @@ module RelatonBib
|
|
126
126
|
ret[:docid] = array(ret[:docid])
|
127
127
|
ret[:docid]&.each_with_index do |id, i|
|
128
128
|
type = id[:type] || id[:id].match(/^\w+(?=\s)/)&.to_s
|
129
|
-
ret[:docid][i] = DocumentIdentifier.new(
|
130
|
-
|
129
|
+
ret[:docid][i] = DocumentIdentifier.new(
|
130
|
+
id: id[:id], type: type, scope: id[:scope], primary: id[:primary],
|
131
|
+
)
|
131
132
|
end
|
132
133
|
end
|
133
134
|
|
data/lib/relaton_bib/validity.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module RelatonBib
|
2
2
|
class Validity
|
3
|
-
FORMAT = "%Y-%m-%d %H:%M"
|
3
|
+
FORMAT = "%Y-%m-%d %H:%M".freeze
|
4
4
|
|
5
5
|
# @return [Time, NilClass]
|
6
6
|
attr_reader :begins
|
@@ -41,7 +41,7 @@ module RelatonBib
|
|
41
41
|
# @param prefix [String]
|
42
42
|
# @return [String]
|
43
43
|
def to_asciibib(prefix = "")
|
44
|
-
pref = prefix.empty? ? "validity." : prefix
|
44
|
+
pref = prefix.empty? ? "validity." : "#{prefix}.validity."
|
45
45
|
out = ""
|
46
46
|
out += "#{pref}begins:: #{begins.strftime(FORMAT)}\n" if begins
|
47
47
|
out += "#{pref}ends:: #{ends.strftime(FORMAT)}\n" if ends
|
data/lib/relaton_bib/version.rb
CHANGED
@@ -161,8 +161,9 @@ module RelatonBib
|
|
161
161
|
# @return [Array<RelatonBib::DocumentIdentifier>]
|
162
162
|
def fetch_docid(item)
|
163
163
|
item.xpath("./docidentifier").map do |did|
|
164
|
+
primary = true if did[:primary] == "true"
|
164
165
|
DocumentIdentifier.new(id: did.text, type: did[:type],
|
165
|
-
scope: did[:scope])
|
166
|
+
scope: did[:scope], primary: primary)
|
166
167
|
end
|
167
168
|
end
|
168
169
|
|
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.10.
|
4
|
+
version: 1.10.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: 2022-
|
11
|
+
date: 2022-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|