Sha256: 5cd4f0f7955c0fd0613d8e55818a0b00b535395640c4ba1a9795a595bd77b4dd

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 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" => periodical && periodical["title"],
          "AU" => to_ris(creators),
          "DO" => doi,
          "UR" => url,
          "AB" => parse_attributes(descriptions, content: "description", first: true),
          "KW" => Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.presence,
          "PY" => publication_year,
          "PB" => publisher,
          "LA" => language,
          "VL" => volume,
          "IS" => issue,
          "SP" => first_page,
          "EP" => last_page,
          "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

3 entries across 3 versions & 1 rubygems

Version Path
bolognese-1.0.29 lib/bolognese/writers/ris_writer.rb
bolognese-1.0.28 lib/bolognese/writers/ris_writer.rb
bolognese-1.0.27 lib/bolognese/writers/ris_writer.rb