relaton-ietf 1.13.5 → 1.13.6
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 +35 -5
- 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: 8d5d9ec768b99a9f7dc61438afe510562005322438b5fff41fe04069111d73e0
|
4
|
+
data.tar.gz: 410398ba75786d32f94fb8e90303f507e6842b5eee84d57c3647bee8d539975c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bf9b65a7fd0e7b4702ddf9b35e8be78a308dccfaa85b83b9def4ea37192718abced81fb02e58d356ee600b421cde8deb190e8e3ffa10adc5882fad10b6db92b
|
7
|
+
data.tar.gz: 1edd378c32a456117f226dbef2b851f761e50e618b8962e022df096ac1557f7f081b1010c5e1cd22986b92b3bb593d58848703105631eb4f01b612f5e8fe3456
|
@@ -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
|
+
# 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
|
+
#
|
118
147
|
def parse_surname_initials(fname, sname, inits)
|
119
|
-
regex = /(?:[A-Z]{1,2}(?:\.[\s-]?|\s))
|
148
|
+
regex = /(?:(?<name>\w{3,})\s)?(?<inits>(?:[A-Z]{1,2}(?:\.[\s-]?|\s))+)?/
|
149
|
+
match = fname.match(regex)
|
120
150
|
surname = sname || fname.sub(regex, "").strip
|
121
|
-
initials = inits ||
|
122
|
-
[surname, initials]
|
151
|
+
initials = inits || match[:inits]&.strip
|
152
|
+
[surname, initials, match[:name]]
|
123
153
|
end
|
124
154
|
end
|
125
155
|
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.6
|
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-10-
|
11
|
+
date: 2022-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|