6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/bolognese/writers/codemeta_writer.rb', line 6
def codemeta
return nil unless valid?
hsh = {
"@context" => id.present? ? "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld" : nil,
"@type" => types["schemaOrg"],
"@id" => normalize_doi(doi),
"identifier" => to_schema_org_identifiers(identifiers),
"codeRepository" => url,
"name" => parse_attributes(titles, content: "title", first: true),
"authors" => creators,
"description" => parse_attributes(descriptions, content: "description", first: true),
"version" => version_info,
"tags" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil,
"datePublished" => get_date(dates, "Issued"),
"dateModified" => get_date(dates, "Updated"),
"publisher" => publisher
}.compact
JSON.pretty_generate hsh.presence
end
|