Fixing heredocs in literate coffeescript

This commit is contained in:
Jeremy Ashkenas 2013-03-01 07:42:12 +13:00
parent c6f30935a8
commit e70dd156b0
2 changed files with 4 additions and 0 deletions

View File

@ -526,6 +526,9 @@
if (indent) {
doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
}
if (this.literate) {
doc = doc.replace(/\n# \n/g, '\n\n');
}
if (!herecomment) {
doc = doc.replace(/^\n/, '');
}

View File

@ -441,6 +441,7 @@ exports.Lexer = class Lexer
attempt = match[1]
indent = attempt if indent is null or 0 < attempt.length < indent.length
doc = doc.replace /// \n #{indent} ///g, '\n' if indent
doc = doc.replace /\n# \n/g, '\n\n' if @literate
doc = doc.replace /^\n/, '' unless herecomment
doc