Fix for issue #414 -- apostrophes in heredocs.
This commit is contained in:
parent
8321f6bfe3
commit
e37056192b
|
@ -450,7 +450,7 @@
|
||||||
if (options.herecomment) {
|
if (options.herecomment) {
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
return doc.replace(MULTILINER, "\\n").replace(new RegExp(options.quote, 'g'), '\\"');
|
return doc.replace(MULTILINER, "\\n").replace(new RegExp(options.quote, 'g'), ("\\" + options.quote));
|
||||||
};
|
};
|
||||||
// Tag a half assignment.
|
// Tag a half assignment.
|
||||||
Lexer.prototype.tag_half_assignment = function(tag) {
|
Lexer.prototype.tag_half_assignment = function(tag) {
|
||||||
|
|
|
@ -309,7 +309,7 @@ exports.Lexer: class Lexer
|
||||||
doc: doc.replace(new RegExp("^" +indent, 'gm'), '')
|
doc: doc.replace(new RegExp("^" +indent, 'gm'), '')
|
||||||
return doc if options.herecomment
|
return doc if options.herecomment
|
||||||
doc.replace(MULTILINER, "\\n")
|
doc.replace(MULTILINER, "\\n")
|
||||||
.replace(new RegExp(options.quote, 'g'), '\\"')
|
.replace(new RegExp(options.quote, 'g'), "\\$options.quote")
|
||||||
|
|
||||||
# Tag a half assignment.
|
# Tag a half assignment.
|
||||||
tag_half_assignment: (tag) ->
|
tag_half_assignment: (tag) ->
|
||||||
|
|
|
@ -66,3 +66,7 @@ b: '''
|
||||||
|
|
||||||
ok a is "basic heredoc 10\non two lines"
|
ok a is "basic heredoc 10\non two lines"
|
||||||
ok b is "basic heredoc \$val\non two lines"
|
ok b is "basic heredoc \$val\non two lines"
|
||||||
|
|
||||||
|
|
||||||
|
a: '''here's an apostrophe'''
|
||||||
|
ok a is "here's an apostrophe"
|
||||||
|
|
Loading…
Reference in New Issue