Sha256: 97d6388c95d57e30d662606d642c1bf965abed06b95537f073cde009ebd3c6bc

Contents?: true

Size: 846 Bytes

Versions: 25

Compression:

Stored size: 846 Bytes

Contents

module Bolognese
  module Writers
    module BibtexWriter
      def bibtex
        return nil unless valid?

        bib = {
          bibtex_type: bibtex_type.presence || "misc",
          bibtex_key: identifier,
          doi: doi,
          url: b_url,
          author: authors_as_string(author),
          keywords: keywords.present? ? Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.join(", ") : nil,
          language: language,
          title: parse_attributes(title, content: "text", first: true),
          journal: container_title,
          volume: volume,
          issue: issue,
          pages: [first_page, last_page].compact.join("-").presence,
          publisher: publisher,
          year: publication_year
        }.compact
        BibTeX::Entry.new(bib).to_s
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
bolognese-0.9.99 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.9.98 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.9.97 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.9.96 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.9.95 lib/bolognese/writers/bibtex_writer.rb