Fix for issue #414 -- apostrophes in heredocs.

This commit is contained in:
Jeremy Ashkenas 2010-06-02 19:53:03 -04:00
parent 8321f6bfe3
commit e37056192b
3 changed files with 6 additions and 2 deletions

View File

@ -450,7 +450,7 @@
if (options.herecomment) {
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.
Lexer.prototype.tag_half_assignment = function(tag) {

View File

@ -309,7 +309,7 @@ exports.Lexer: class Lexer
doc: doc.replace(new RegExp("^" +indent, 'gm'), '')
return doc if options.herecomment
doc.replace(MULTILINER, "\\n")
.replace(new RegExp(options.quote, 'g'), '\\"')
.replace(new RegExp(options.quote, 'g'), "\\$options.quote")
# Tag a half assignment.
tag_half_assignment: (tag) ->

View File

@ -66,3 +66,7 @@ b: '''
ok a is "basic heredoc 10\non two lines"
ok b is "basic heredoc \$val\non two lines"
a: '''here's an apostrophe'''
ok a is "here's an apostrophe"