Skip to content

Commit

Permalink
Merge pull request #304 from dplepage/fix-quote-stripping
Browse files Browse the repository at this point in the history
Fix parsing of quotes followed by newlines.
  • Loading branch information
dervus committed Oct 28, 2016
2 parents 2bf232b + cb14c0b commit 39c5f2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/js-yaml/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,9 @@ function readSingleQuotedScalar(state, nodeIndent) {
ch = state.input.charCodeAt(++state.position);

if (ch === 0x27/* ' */) {
captureStart = captureEnd = state.position;
captureStart = state.position;
state.position++;
captureEnd = state.position;
} else {
return true;
}
Expand Down
11 changes: 11 additions & 0 deletions test/issues/0303.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

var assert = require('assert');
var yaml = require('../../');

test('Loader should not strip quotes before newlines', function () {
var with_space = yaml.load("'''foo'' '");
var with_newline = yaml.load("'''foo''\n'");
assert.strictEqual(with_space, "'foo' ");
assert.strictEqual(with_newline, "'foo' ");
});

0 comments on commit 39c5f2c

Please sign in to comment.