fixing herecomment newlines.

This commit is contained in:
Jeremy Ashkenas 2010-09-21 00:06:03 -04:00
parent 34c29b3406
commit fb5158630a
2 changed files with 4 additions and 2 deletions

View File

@ -409,10 +409,11 @@
}
}
indent || (indent = '');
doc = doc.replace(new RegExp("^" + indent, 'gm'), '').replace(/^\n/, '');
doc = doc.replace(new RegExp("^" + indent, 'gm'), '');
if (options.herecomment) {
return doc;
}
doc = doc.replace(/^\n/, '');
return doc.replace(MULTILINER, "\\n").replace(new RegExp(options.quote, 'g'), "\\" + (options.quote));
};
Lexer.prototype.tagParameters = function() {

View File

@ -331,8 +331,9 @@ exports.Lexer = class Lexer
attempt = if match[2]? then match[2] else match[3]
indent = attempt if not indent? or attempt.length < indent.length
indent or= ''
doc = doc.replace(new RegExp("^" + indent, 'gm'), '').replace(/^\n/, '')
doc = doc.replace(new RegExp("^" + indent, 'gm'), '')
return doc if options.herecomment
doc = doc.replace(/^\n/, '')
doc.replace(MULTILINER, "\\n")
.replace(new RegExp(options.quote, 'g'), "\\#{options.quote}")