metanorma-release 0.2.18 → 0.2.19
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/lib/metanorma/release/site.rb +58 -0
- data/lib/metanorma/release/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd193b321dc862e5773523c57a82a37966b93a087cd6354486ad067b50d2b992
|
|
4
|
+
data.tar.gz: 40f1dd74b4409040d1cd625477d0787b07f6fc29eed1e98c6210e4f229ce2464
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc2f1951bded304c45d587a0b57ebc2d4946aae4633748f6008588a5aa764a99c20f7a04a3ef8b8eb0034ac605ff582106cc621592c20710c7c6d5e3ec2a9963
|
|
7
|
+
data.tar.gz: 51c29d6cf3d483e33dca8c5a13bf4f4564e1f25077b306015ec0bc09cc77dde50382c3767d2fc76b346d794413ba8060af756f4a3b556ba4d26a49626d47385f
|
|
@@ -102,6 +102,7 @@ module Metanorma
|
|
|
102
102
|
}
|
|
103
103
|
add_format_flags(base, formats)
|
|
104
104
|
add_display_category(base, doctype)
|
|
105
|
+
add_contributors(base, bib)
|
|
105
106
|
base
|
|
106
107
|
end
|
|
107
108
|
|
|
@@ -169,6 +170,63 @@ module Metanorma
|
|
|
169
170
|
|
|
170
171
|
@org_config.display_category_for(doctype)
|
|
171
172
|
end
|
|
173
|
+
|
|
174
|
+
def add_contributors(hash, bib)
|
|
175
|
+
contribs = bib["contributor"] || []
|
|
176
|
+
persons, committees = partition_contributors(contribs)
|
|
177
|
+
hash["authors"] = persons
|
|
178
|
+
hash["committee"] = committees.first
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def partition_contributors(contribs)
|
|
182
|
+
persons = contribs.filter_map { |c| parse_person(c) }
|
|
183
|
+
committees = contribs.filter_map { |c| parse_committee(c) }
|
|
184
|
+
[persons, committees]
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def parse_person(contrib)
|
|
188
|
+
return nil unless contrib["person"]
|
|
189
|
+
|
|
190
|
+
name = extract_person_name(contrib["person"])
|
|
191
|
+
return nil unless name
|
|
192
|
+
|
|
193
|
+
role = (contrib["role"] || []).first&.fetch("type", nil)
|
|
194
|
+
{ "name" => name, "role" => role }
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def parse_committee(contrib)
|
|
198
|
+
return nil unless contrib["organization"]
|
|
199
|
+
|
|
200
|
+
extract_org_subdivision(contrib["organization"])
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def extract_person_name(person)
|
|
204
|
+
n = person["name"] || {}
|
|
205
|
+
complete = n["completename"]
|
|
206
|
+
return complete["content"] if complete.is_a?(Hash) && complete["content"]
|
|
207
|
+
return complete if complete.is_a?(String)
|
|
208
|
+
|
|
209
|
+
surname = n["surname"]
|
|
210
|
+
given = n["given"]
|
|
211
|
+
given_str = given.is_a?(Hash) ? given["content"].to_s : given.to_s
|
|
212
|
+
parts = [given_str, surname].compact
|
|
213
|
+
parts.empty? ? nil : parts.join(" ")
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def extract_org_subdivision(org)
|
|
217
|
+
subs = org["subdivision"]
|
|
218
|
+
return nil unless subs&.any?
|
|
219
|
+
|
|
220
|
+
sd = subs.first
|
|
221
|
+
sd_name = sd["name"]
|
|
222
|
+
if sd_name.is_a?(Array)
|
|
223
|
+
sd_name.first&.dig("content")
|
|
224
|
+
elsif sd_name.is_a?(Hash)
|
|
225
|
+
sd_name["content"]
|
|
226
|
+
else
|
|
227
|
+
sd_name.to_s
|
|
228
|
+
end
|
|
229
|
+
end
|
|
172
230
|
end
|
|
173
231
|
end
|
|
174
232
|
end
|