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:
parent
c6f30935a8
commit
e70dd156b0
2 changed files with 4 additions and 0 deletions
|
@ -526,6 +526,9 @@
|
||||||
if (indent) {
|
if (indent) {
|
||||||
doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
|
doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
|
||||||
}
|
}
|
||||||
|
if (this.literate) {
|
||||||
|
doc = doc.replace(/\n# \n/g, '\n\n');
|
||||||
|
}
|
||||||
if (!herecomment) {
|
if (!herecomment) {
|
||||||
doc = doc.replace(/^\n/, '');
|
doc = doc.replace(/^\n/, '');
|
||||||
}
|
}
|
||||||
|
|
|
@ -441,6 +441,7 @@ exports.Lexer = class Lexer
|
||||||
attempt = match[1]
|
attempt = match[1]
|
||||||
indent = attempt if indent is null or 0 < attempt.length < indent.length
|
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 #{indent} ///g, '\n' if indent
|
||||||
|
doc = doc.replace /\n# \n/g, '\n\n' if @literate
|
||||||
doc = doc.replace /^\n/, '' unless herecomment
|
doc = doc.replace /^\n/, '' unless herecomment
|
||||||
doc
|
doc
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue