relaton-render 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton/render/fields/fields.rb +1 -0
- data/lib/relaton/render/parse/parse.rb +1 -0
- data/lib/relaton/render/parse/parse_contributors.rb +30 -6
- data/lib/relaton/render/parse/parse_extract.rb +1 -15
- data/lib/relaton/render/template/template.rb +3 -2
- data/lib/relaton/render/version.rb +1 -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: 4af2a199386cc0a95ba9f02a2ba08f5ba146783acfc3c8eb0fb420e50c29bc70
|
4
|
+
data.tar.gz: b6d8e184fd3cd9709bfb3836613a38d43f0959d26f8c9f23316df31633870252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7edf0a562d388abfb02883976c40155d7c92aeb9563f06d16ee1fda8da0c63ad88094af034562a61fa0aa1ebf798842d04c8f357cc62eb64cd370ef94db8d1ca
|
7
|
+
data.tar.gz: 41e86886b6d865301f98b86d1aa95c8cb9ced5da5db42c3cd2bc35697242b9fb0f007e1bd1ee5a1531230a13a162c70e4371ed060abbd12aa53c03eb0b23dff7
|
@@ -29,6 +29,7 @@ module Relaton
|
|
29
29
|
def simple_or_host_xml2hash(doc, host)
|
30
30
|
{ edition_raw: edition(doc, host), medium_raw: medium(doc, host),
|
31
31
|
place_raw: place(doc, host), publisher_raw: publisher(doc, host),
|
32
|
+
publisher_abbrev_raw: publisher_abbrev(doc, host),
|
32
33
|
distributor_raw: distributor(doc, host), draft_raw: draft(doc, host),
|
33
34
|
access_location: access_location(doc, host),
|
34
35
|
date: date(doc, host), date_updated: date_updated(doc, host),
|
@@ -48,17 +48,20 @@ module Relaton
|
|
48
48
|
[cr.map { |x| extractname(x) }, contributor_role(cr)]
|
49
49
|
end
|
50
50
|
|
51
|
+
def creatornames_roles_allowed
|
52
|
+
%w(author performer adapter translator editor publisher distributor)
|
53
|
+
end
|
54
|
+
|
51
55
|
def creatornames1(doc)
|
52
56
|
cr = []
|
53
57
|
return [] if doc.nil?
|
54
58
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
next if add.nil?
|
59
|
+
creatornames_roles_allowed.each do |r|
|
60
|
+
add = pick_contributor(doc, r)
|
61
|
+
next if add.nil?
|
59
62
|
|
60
|
-
|
61
|
-
|
63
|
+
cr = add and break
|
64
|
+
end
|
62
65
|
cr.nil? and cr = doc.contributor
|
63
66
|
cr
|
64
67
|
end
|
@@ -100,6 +103,27 @@ module Relaton
|
|
100
103
|
host and ret ||= host.date.detect { |x| x.type == "accessed" }
|
101
104
|
datepick(ret)
|
102
105
|
end
|
106
|
+
|
107
|
+
def publisher(doc, host)
|
108
|
+
x = pick_contributor(doc, "publisher")
|
109
|
+
host and x ||= pick_contributor(host, "publisher")
|
110
|
+
x.nil? and return nil
|
111
|
+
x.map { |c| extractname(c) }
|
112
|
+
end
|
113
|
+
|
114
|
+
def publisher_abbrev(doc, host)
|
115
|
+
x = pick_contributor(doc, "publisher")
|
116
|
+
host and x ||= pick_contributor(host, "publisher")
|
117
|
+
x.nil? and return nil
|
118
|
+
x.map { |c| c.entity.abbreviation&.content }
|
119
|
+
end
|
120
|
+
|
121
|
+
def distributor(doc, host)
|
122
|
+
x = pick_contributor(doc, "distributor")
|
123
|
+
host and x ||= pick_contributor(host, "distributor")
|
124
|
+
x.nil? and return nil
|
125
|
+
x.map { |c| extractname(c) }
|
126
|
+
end
|
103
127
|
end
|
104
128
|
end
|
105
129
|
end
|
@@ -43,20 +43,6 @@ module Relaton
|
|
43
43
|
x.map(&:name)
|
44
44
|
end
|
45
45
|
|
46
|
-
def publisher(doc, host)
|
47
|
-
x = pick_contributor(doc, "publisher")
|
48
|
-
host and x ||= pick_contributor(host, "publisher")
|
49
|
-
x.nil? and return nil
|
50
|
-
x.map { |c| extractname(c) }
|
51
|
-
end
|
52
|
-
|
53
|
-
def distributor(doc, host)
|
54
|
-
x = pick_contributor(doc, "distributor")
|
55
|
-
host and x ||= pick_contributor(host, "distributor")
|
56
|
-
x.nil? and return nil
|
57
|
-
x.map { |c| extractname(c) }
|
58
|
-
end
|
59
|
-
|
60
46
|
def series(doc)
|
61
47
|
doc.series.detect { |s| s.type == "main" } ||
|
62
48
|
doc.series.detect { |s| s.type.nil? } ||
|
@@ -103,7 +89,7 @@ module Relaton
|
|
103
89
|
|
104
90
|
def uri(doc)
|
105
91
|
uri = nil
|
106
|
-
%
|
92
|
+
%w(doi uri src).each do |t|
|
107
93
|
uri = doc.link.detect { |u| u.type == t } and break
|
108
94
|
end
|
109
95
|
uri ||= doc.link.first
|
@@ -79,6 +79,7 @@ module Relaton
|
|
79
79
|
.gsub(/(:\s+)(&\s)/, "\\2")
|
80
80
|
.gsub(/\s+([,.:;)])/, "\\1")
|
81
81
|
.sub(/^\s*[,.:;]\s*/, "")
|
82
|
+
.sub(/[,:;]\s*$/, "")
|
82
83
|
.gsub(/_/, " ")
|
83
84
|
.gsub(/#{NON_SPACING_DELIM}/o, "").gsub(/\s+/, " ")
|
84
85
|
end
|
@@ -133,9 +134,9 @@ module Relaton
|
|
133
134
|
end
|
134
135
|
|
135
136
|
def template_select_etal(names)
|
136
|
-
if @etal_count && names.size >= @etal_count
|
137
|
+
if @etal_count && names[:surname].size >= @etal_count
|
137
138
|
@template[:etal]
|
138
|
-
else expand_nametemplate(@template_raw[:more], names.size)
|
139
|
+
else expand_nametemplate(@template_raw[:more], names[:surname].size)
|
139
140
|
end
|
140
141
|
end
|
141
142
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-render
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
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-04-
|
11
|
+
date: 2022-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|