lib/bolognese/readers/schema_org_reader.rb in bolognese-1.11.5 vs lib/bolognese/readers/schema_org_reader.rb in bolognese-2.0.0
- old
+ new
@@ -72,11 +72,12 @@
# Authors should be an object, if it's just a plain string don't try and parse it.
if not authors.is_a?(String)
creators = get_authors(from_schema_org_creators(Array.wrap(authors)))
end
contributors = get_authors(from_schema_org_contributors(Array.wrap(meta.fetch("editor", nil))))
- publisher = parse_attributes(meta.fetch("publisher", nil), content: "name", first: true)
+ publisher_name = parse_attributes(meta.fetch("publisher", nil), content: "name", first: true)
+ publisher = { "name" => publisher_name } if publisher_name.present?
ct = (schema_org == "Dataset") ? "includedInDataCatalog" : "Periodical"
container = if meta.fetch(ct, nil).present?
url = parse_attributes(from_schema_org(meta.fetch(ct, nil)), content: "url", first: true)
@@ -178,10 +179,10 @@
"agency" => parse_attributes(meta.fetch("provider", nil), content: "name", first: true),
"container" => container,
"related_identifiers" => related_identifiers,
"publication_year" => publication_year,
"dates" => dates,
- "descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description")), "descriptionType" => "Abstract" }] : nil,
+ "descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description"), new_line: true), "descriptionType" => "Abstract" }] : nil,
"rights_list" => rights_list,
"version_info" => meta.fetch("version", nil).to_s.presence,
"subjects" => subjects,
"language" => language,
"state" => state,