Skip to content

Commit

Permalink
Add String method to strip <br> tags from markdown, call in doc compi…
Browse files Browse the repository at this point in the history
…lation
  • Loading branch information
thenickcox committed Mar 31, 2015
1 parent 2ae8da4 commit 1aec344
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tasks/compile-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ _.extend(Compiler.prototype, {
// Attempts to replace extension of content links to other documents
compiledContents = compiledContents.replace(/.md/g, '.html');

return compiledContents;
return compiledContents.stripBrTags();
},

getPageTitle: function(compiledContents) {
Expand All @@ -109,8 +109,7 @@ _.extend(Compiler.prototype, {
var description = compiledContents.match(/<p>([\s\S]*?)<\/p>/)[1];

return description
// force translation of breaks to a space
.replace(/<br>/g, ' ')
.stripBrTags()
// remove remaining tags
.replace(/\<[^\>]*\>/g, '');
// }
Expand Down Expand Up @@ -326,3 +325,6 @@ module.exports = function(grunt) {
.then(this.async());
});
};

String.prototype.stripBrTags = function() { return this.replace(/<br>/g, ' '); }

0 comments on commit 1aec344

Please sign in to comment.