// empty line is equivalent to a paragraph break
body = body.replace(/<br \/>\s*<br \/>/g, '<p>');
// keep names and preceding abbreviations together
- body = body.replace(/\b((?:dhr|mw|me?vr|mr?s?)\.)\s+(?=[A-Z])/ig, '$1 ');
+ body = body.replace(/\b((?:[Dd]hr|[Mm](?:w|e?vr|r|r?ss?)|[A-Z])\.)\s+(?=[A-Zdtv])/g, '$1 ');
// wrap long line after each sentence
body = body.replace(/^(\t*).{73,}/mg, function (line, indent) {
+ if (/^<meta /.test(line)) return line; // ignore metadata headers
var dots = '(?:.{24,72}|.{73,}?)'; // chars before punctuation
var wrap = new RegExp('('+dots+'[.:!?]) (?=[A-Z(<])', 'g'); // separate lines
return line.replace(wrap, '$1\n'+indent+'\t');