lib/poet/utils.js
function getPreview (post, body, options) {
  var readMoreTag = options.readMoreTag || post.readMoreTag;
  var preview;
  if (post.preview) {
    preview = post.preview;
  } else if (post.previewLength) {
    preview = body.trim().substr(0, post.previewLength);
  } else if (~body.indexOf(readMoreTag)) {
    preview = body.split(readMoreTag)[0];
  } else {
    preview = body.trim().replace(/\n.*/g, '');
  }

  return preview;
}
function getPreview (post, body, options) {
  var readMoreTag = options.readMoreTag || post.readMoreTag;
  var preview;
  if (post.preview) {
    preview = post.preview;
  } else if (post.previewLength) {
    preview = body.trim().substr(0, post.previewLength);
  } else if (~body.indexOf(readMoreTag)) {
    preview = body.split(readMoreTag)[0];
  } else {
    preview = body.trim().replace(/\n.*/g, '');
  }

  return preview;
}
function getPreview ( post , body , options ) { var readMoreTag = options . readMoreTag || post . readMoreTag ; var preview ; if ( post . preview ) { preview = post . preview ; } else if ( post . previewLength ) { preview = body . trim ( ) . substr ( 0 , post . previewLength ) ; } else if ( ~ body . indexOf ( readMoreTag ) ) { preview = body . split ( readMoreTag ) [ 0 ] ; } else { preview = body . trim ( ) . replace ( / \n.* / g , '' ) ; } return preview ; }
Takes a `post` object, `body` text and an `options` object
and generates preview text in order of priority of a `preview`
property on the post, then `previewLength`, followed by
finding a `readMoreTag` in the body.

Otherwise, use the first paragraph in `body`.

@params {Object} post
@params {String} body
@params {Object} options
@return {String}
Takes a post object body text and an options object and generates preview text in order of priority of a preview property on the post then previewLength followed by finding a readMoreTag in the body .