Method: Sufia::CitationsBehaviors::Formatters::ApaFormatter#format

Defined in:
app/helpers/sufia/citations_behaviors/formatters/apa_formatter.rb

#format(work) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/sufia/citations_behaviors/formatters/apa_formatter.rb', line 8

def format(work)
  text = ''

  # setup formatted author list
  authors_list = author_list(work).select { |author| !author.blank? }
  text << format_authors(authors_list)
  unless text.blank?
    text = "<span class=\"citation-author\">#{text}</span> "
  end
  # Get Pub Date
  pub_date = setup_pub_date(work)
  text << format_date(pub_date)

  # setup title info
  title_info = setup_title_info(work)
  text << format_title(title_info)

  # Publisher info
  pub_info = clean_end_punctuation(setup_pub_info(work))
  text << pub_info unless pub_info.nil?
  text << "." unless text.blank? || text =~ /\.$/
  text.html_safe
end