relaton-ietf 1.13.5 → 1.13.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton_ietf/bibxml_parser.rb +37 -7
- data/lib/relaton_ietf/ietf_bibliographic_item.rb +11 -0
- data/lib/relaton_ietf/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: c90740b6cf7e4d175f4df9fc3ab1ddf9f68eb02473140f2467d63569364d8b2f
|
4
|
+
data.tar.gz: a2dfa670a98de931ff50244a3b6f26b2cbee87482bd8ac93c843a3410479583d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '06871e40bf40e9e4198c88c027220cc210f0f10e5f82c718f5f8e5124f38944f457fd5368205a0b212cc42492159c2609d36abe00bcb7f538b029c7439473e03'
|
7
|
+
data.tar.gz: 442621f06f75dc0bf899053c84b25a5f17b34911484410f46b3752341146232bd9adbe2e057505f64367d1ff5589e954fcf28e353ece4b1a1ccc10d79e92a652
|
@@ -106,20 +106,50 @@ module RelatonIetf
|
|
106
106
|
# @return [RelatonBib::FullName]
|
107
107
|
#
|
108
108
|
def full_name(fname, sname, inits, lang, script = nil)
|
109
|
-
surname, ints = parse_surname_initials fname, sname, inits
|
109
|
+
surname, ints, name = parse_surname_initials fname, sname, inits
|
110
110
|
initials = localized_string(ints, lang, script)
|
111
111
|
RelatonBib::FullName.new(
|
112
112
|
completename: localized_string(fname, lang, script),
|
113
|
-
initials: initials, forename: forename(ints, lang, script),
|
113
|
+
initials: initials, forename: forename(ints, name, lang, script),
|
114
114
|
surname: localized_string(surname, lang, script)
|
115
115
|
)
|
116
116
|
end
|
117
117
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
118
|
+
#
|
119
|
+
# Create forenames with initials
|
120
|
+
#
|
121
|
+
# @param [String] initials initials
|
122
|
+
# @param [String] lang language
|
123
|
+
#
|
124
|
+
# @return [Array<RelatonBib::Forename>] forenames
|
125
|
+
#
|
126
|
+
def forename(initials, name, lang = nil, script = nil)
|
127
|
+
fnames = []
|
128
|
+
if name
|
129
|
+
fnames << RelatonBib::Forename.new(content: name, language: lang, script: script)
|
130
|
+
end
|
131
|
+
return fnames unless initials
|
132
|
+
|
133
|
+
initials.split(/\.-?\s?|\s/).each_with_object(fnames) do |i, a|
|
134
|
+
a << RelatonBib::Forename.new(initial: i, language: lang, script: script)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# Parse name, surname, and initials from full name
|
140
|
+
#
|
141
|
+
# @param [String] fname full name
|
142
|
+
# @param [String, nil] sname surname
|
143
|
+
# @param [String, nil] inits
|
144
|
+
#
|
145
|
+
# @return [Array<String, nil>] surname, initials, forename
|
146
|
+
#
|
147
|
+
def parse_surname_initials(fname, sname, inits) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
148
|
+
regex = /(?:(?<name>\w{3,})\s)?(?<inits>(?:[A-Z]{1,2}(?:\.[\s-]?|\s))+)?/
|
149
|
+
match = fname&.match(regex)
|
150
|
+
surname = sname || fname&.sub(regex, "")&.strip
|
151
|
+
initials = inits || (match && match[:inits]&.strip)
|
152
|
+
[surname, initials, (match && match[:name])]
|
123
153
|
end
|
124
154
|
end
|
125
155
|
end
|
@@ -34,5 +34,16 @@ module RelatonIetf
|
|
34
34
|
opts[:date_format] ||= :short
|
35
35
|
super(**opts)
|
36
36
|
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Render date as BibXML
|
40
|
+
#
|
41
|
+
# @param [Nokogiri::XML::Builder] builder xml builder
|
42
|
+
#
|
43
|
+
# def render_date(builder)
|
44
|
+
# return if doidentifier.detect { |i| i.type == "IANA" }
|
45
|
+
|
46
|
+
# super
|
47
|
+
# end
|
37
48
|
end
|
38
49
|
end
|
data/lib/relaton_ietf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ietf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.7
|
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-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|