Module: Bolognese::Writers::CiteprocWriter

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

Instance Method Summary collapse

Instance Method Details

#citeprocObject



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 6

def citeproc
  hsh = {
    "type" => citeproc_type,
    "id" => identifier,
    "categories" => Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.presence,
    "language" => language,
    "author" => to_citeproc(author),
    "editor" => to_citeproc(editor),
    "issued" => date_published ? get_date_parts(date_published) : nil,
    "submitted" =>  ? get_date_parts() : nil,
    "abstract" => parse_attributes(description, content: "text", first: true),
    "container-title" => container_title,
    "DOI" => doi,
    "issue" => issue,
    "page" => [first_page, last_page].compact.join("-").presence,
    "publisher" => publisher,
    "title" => parse_attributes(title, content: "text", first: true),
    "URL" => b_url,
    "version" => b_version,
    "volume" => volume
  }.compact
  JSON.pretty_generate hsh.presence
end