Sha256: 284746d7c948c7026c5dfb8b7668caa4f6f846d8c027c003d68d3035dcaf333e

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module Bolognese
  module Writers
    module RisWriter
      def ris
        {
          "TY" => types["ris"],
          "T1" => parse_attributes(titles, content: "title", first: true),
          "T2" => container && container["title"],
          "AU" => to_ris(creators),
          "DO" => doi,
          "UR" => url,
          "AB" => parse_attributes(abstract_description, content: "description", first: true),
          "KW" => Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.presence,
          "PY" => publication_year,
          "PB" => publisher["name"],
          "LA" => language,
          "VL" => container.to_h["volume"],
          "IS" => container.to_h["issue"],
          "SP" => container.to_h["firstPage"],
          "EP" => container.to_h["lastPage"],
          "SN" => Array.wrap(related_identifiers).find { |ri| ri["relationType"] == "IsPartOf" }.to_h.fetch("relatedIdentifier", nil),
          "ER" => ""
        }.compact.map { |k, v| v.is_a?(Array) ? v.map { |vi| "#{k}  - #{vi}" }.join("\r\n") : "#{k}  - #{v}" }.join("\r\n")
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bolognese-2.3.2 lib/bolognese/writers/ris_writer.rb
bolognese-2.3.0 lib/bolognese/writers/ris_writer.rb
bolognese-2.2.0 lib/bolognese/writers/ris_writer.rb
bolognese-2.1.1 lib/bolognese/writers/ris_writer.rb
bolognese-2.1.0 lib/bolognese/writers/ris_writer.rb
bolognese-2.0.3 lib/bolognese/writers/ris_writer.rb
bolognese-2.0.2 lib/bolognese/writers/ris_writer.rb
bolognese-2.0.1 lib/bolognese/writers/ris_writer.rb
bolognese-2.0.0 lib/bolognese/writers/ris_writer.rb