Method: Sufia::CitationsBehaviors::TitleBehavior#chicago_citation_title

Defined in:
app/helpers/sufia/citations_behaviors/title_behavior.rb

#chicago_citation_title(title_text) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/sufia/citations_behaviors/title_behavior.rb', line 9

def chicago_citation_title(title_text)
  process_title_parts(title_text) do |w, index|
    if (index.zero? && w.casecmp(w).zero?) || (w.length > 1 && w.casecmp(w).zero? && !EXPANDED_NOCAPS.include?(w))
      # the split("-") will handle the capitalization of hyphenated words
      w.split("-").map!(&:capitalize).join("-")
    else
      w
    end
  end
end