Sha256: 7cc04755abd710ab7f059b9008a2cced09fb1705e94d62921bc47632e288ae08

Contents?: true

Size: 877 Bytes

Versions: 24

Compression:

Stored size: 877 Bytes

Contents

# frozen_string_literal: true

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

24 entries across 24 versions & 1 rubygems

Version Path
bolognese-0.15.9 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.15.8 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.15.6 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.15.3 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.15.1 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.14.1 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.14 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.13.6 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.13.4 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.13.3 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.13.2 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.13.1 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.12.3 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.12.2 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.12.1 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.12 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.11.7 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.11.6 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.11.5 lib/bolognese/writers/bibtex_writer.rb
bolognese-0.11.4 lib/bolognese/writers/bibtex_writer.rb