Module: Bolognese::Writers::RisWriter

Included in:
Metadata
Defined in:
lib/bolognese/writers/ris_writer.rb

Instance Method Summary collapse

Instance Method Details

#risObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bolognese/writers/ris_writer.rb', line 4

def ris
  return nil unless valid?

  {
    "TY" => ris_type,
    "T1" => parse_attributes(title, content: "text", first: true),
    "T2" => container_title,
    "AU" => to_ris(author),
    "DO" => doi,
    "UR" => url,
    "AB" => parse_attributes(description, content: "text", first: true),
    "KW" => parse_attributes(keywords, content: "text").presence,
    "PY" => publication_year,
    "PB" => publisher,
    "AN" => parse_attributes(alternate_name, content: "name").presence,
    "LA" => language,
    "VL" => volume,
    "IS" => issue,
    "SP" => pagination,
    "ER" => ""
  }.compact.map { |k, v| v.is_a?(Array) ? v.map { |vi| "#{k} - #{vi}" }.join("\r\n") : "#{k} - #{v}" }.join("\r\n")
end