app/helpers/marc_heading_helper.rb
# Takes ToC but limits to so many chars for index page. Truncates
# on complete entry seperated by "--" if possible. 
Takes ToC but limits to so many chars for index page. Truncates
on complete entry seperated by "--" if possible.
Takes ToC but limits to so many chars for index page . Truncates on complete entry seperated by " -- " if possible .
def shortened_contents(document)
    max_chars = 280
    contents_presenter = marc_presenter(document, :contents)
    return nil unless contents_presenter.lines.length > 0
    line = contents_presenter.lines[0]
    text = line.join
    if text.length > max_chars
      truncate_at = text.rindex("--", max_chars)
      truncate_at = text.rindex(" ", max_chars) unless truncate_at
      text = html_escape(text[0..truncate_at-2]) + "&#8230;".html_safe 
    end
    return text
  end
def shortened_contents ( document ) max_chars = 280 contents_presenter = marc_presenter ( document , :contents ) return nil unless contents_presenter . lines . length > 0 line = contents_presenter . lines [ 0 ] text = line . join if text . length > max_chars truncate_at = text . rindex ( "--" , max_chars ) truncate_at = text . rindex ( " " , max_chars ) unless truncate_at text = html_escape ( text [ 0 .. truncate_at - 2 ] ) + "&#8230;" . html_safe end return text end
Takes ToC but limits to so many chars for index page.
Takes ToC but limits to so many chars for index page .
# elipsis    
document
<not_specific>