Sha256: a84ed8f830f3abcb3eef4b0b59fe5803c16efb6e5397b078053b718b3c57f65e
Contents?: true
Size: 1.09 KB
Versions: 9
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module Bolognese module Writers module BibtexWriter def bibtex return nil unless valid? pages = container.to_h["firstPage"].present? ? [container["firstPage"], container["lastPage"]].compact.join("-") : nil bib = { bibtex_type: types["bibtex"].presence || "misc", bibtex_key: normalize_doi(doi), doi: doi, url: url, author: authors_as_string(creators), keywords: subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.join(", ") : nil, language: language, title: parse_attributes(titles, content: "title", first: true), journal: container && container["title"], volume: container.to_h["volume"], issue: container.to_h["issue"], pages: pages, publisher: publisher["name"], year: publication_year, copyright: Array.wrap(rights_list).map { |l| l["rights"] }.first, }.compact BibTeX::Entry.new(bib).to_s end end end end
Version data entries
9 entries across 9 versions & 1 rubygems