Skip to content

Commit

Permalink
Fix reading of flow scalars via readBlockMapping
Browse files Browse the repository at this point in the history
Related to issue nodeca#63
dervus committed Jul 1, 2014
1 parent 472055a commit 987adcf
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/js-yaml/loader.js
Original file line number Diff line number Diff line change
@@ -930,7 +930,7 @@ function readBlockSequence(state, nodeIndent) {
}
}

function readBlockMapping(state, nodeIndent) {
function readBlockMapping(state, nodeIndent, flowIndent) {
var following,
allowCompact,
_line,
@@ -986,7 +986,7 @@ function readBlockMapping(state, nodeIndent) {
//
// Implicit notation case. Flow-style node as the key first, then ":", and the value.
//
} else if (composeNode(state, nodeIndent, CONTEXT_FLOW_OUT, false, true)) {
} else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {

// !!!! ????
ch = state.input.charCodeAt(state.position);
@@ -1323,7 +1323,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
if (isIndented) {
if (allowBlockCollections &&
(readBlockSequence(state, blockIndent) ||
readBlockMapping(state, blockIndent)) ||
readBlockMapping(state, blockIndent, flowIndent)) ||
readFlowCollection(state, flowIndent)) {
hasContent = true;
} else {
2 changes: 1 addition & 1 deletion test/issues/issue-63.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ var assert = require('assert');
var yaml = require('../../');


it.skip('Invalid errors/warnings of invalid indentation on flow scalars', function () {
it('Invalid errors/warnings of invalid indentation on flow scalars', function () {
var sources = [
'text:\n hello\n world', // plain style
"text:\n 'hello\n world'", // single-quoted style

0 comments on commit 987adcf

Please sign in to comment.