1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

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