Module: Bolognese::Writers::CiteprocWriter

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

Instance Method Summary collapse

Instance Method Details

#citeprocObject



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

def citeproc
  return nil unless valid?

  hsh = {
    "type" => citeproc_type,
    "id" => id,
    "categories" => keywords.present? ? keywords.split(", ") : nil,
    "language" => language,
    "author" => to_citeproc(author),
    "editor" => to_citeproc(editor),
    "issued" => get_date_parts(date_published),
    "submitted" => get_date_parts(),
    "abstract" => parse_attributes(description, content: "text", first: true),
    "container-title" => container_title,
    "DOI" => doi,
    "issue" => issue,
    "page" => pagination,
    "publisher" => publisher,
    "title" => parse_attributes(title, content: "text", first: true),
    "URL" => url,
    "version" => version,
    "volume" => volume
  }.compact
  JSON.pretty_generate hsh.presence
end