app/helpers/marc_heading_helper.rb
# Finds a 'summary' from a marc record, but makes sure it's no longer
# than a certain number of chars, for index page, truncating on whitespace. 
Finds a 'summary' from a marc record, but makes sure it's no longer
than a certain number of chars, for index page, truncating on whitespace.
Finds a ' summary ' from a marc record but makes sure it ' s no longer than a certain number of chars for index page truncating on whitespace .
def shortened_summary(document)
    max_chars = 280
    summary_presenter = marc_presenter(document, :summary)
    return nil unless summary_presenter.lines.length > 0
    text = summary_presenter.lines[0].join
    if (text.length > max_chars)
       truncate_at = text.rindex(" ", max_chars)
       text = html_escape(text[0..truncate_at-1]) + "&#8230".html_safe 
    end
    return text
  end
def shortened_summary ( document ) max_chars = 280 summary_presenter = marc_presenter ( document , :summary ) return nil unless summary_presenter . lines . length > 0 text = summary_presenter . lines [ 0 ] . join if ( text . length > max_chars ) truncate_at = text . rindex ( " " , max_chars ) text = html_escape ( text [ 0 .. truncate_at - 1 ] ) + "&#8230" . html_safe end return text end
Finds a 'summary' from a marc record, but makes sure it's no longer
than a certain number of chars, for index page, truncating on whitespace.
Finds a ' summary ' from a marc record but makes sure it ' s no longer than a certain number of chars for index page truncating on whitespace .
# just the first line, grab the text # and truncate if needed # elipsis
document
<not_specific>