yaml 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -230,7 +230,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
230
230
|
}
|
|
231
231
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
232
232
|
const { type, value } = item;
|
|
233
|
-
const { actualString, implicitKey, indent, inFlow } = ctx;
|
|
233
|
+
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
|
|
234
234
|
if ((implicitKey && /[\n[\]{},]/.test(value)) ||
|
|
235
235
|
(inFlow && /[[\]{},]/.test(value))) {
|
|
236
236
|
return quotedString(value, ctx);
|
|
@@ -254,9 +254,14 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
|
|
254
254
|
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
|
255
255
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
256
256
|
}
|
|
257
|
-
if (
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
if (containsDocumentMarker(value)) {
|
|
258
|
+
if (indent === '') {
|
|
259
|
+
ctx.forceBlockIndent = true;
|
|
260
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
261
|
+
}
|
|
262
|
+
else if (implicitKey && indent === indentStep) {
|
|
263
|
+
return quotedString(value, ctx);
|
|
264
|
+
}
|
|
260
265
|
}
|
|
261
266
|
const str = value.replace(/\n+/g, `$&\n${indent}`);
|
|
262
267
|
// Verify that output will be parsed as a string, as e.g. plain numbers and
|
|
@@ -232,7 +232,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
232
232
|
}
|
|
233
233
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
234
234
|
const { type, value } = item;
|
|
235
|
-
const { actualString, implicitKey, indent, inFlow } = ctx;
|
|
235
|
+
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
|
|
236
236
|
if ((implicitKey && /[\n[\]{},]/.test(value)) ||
|
|
237
237
|
(inFlow && /[[\]{},]/.test(value))) {
|
|
238
238
|
return quotedString(value, ctx);
|
|
@@ -256,9 +256,14 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
|
|
256
256
|
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
|
257
257
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
if (containsDocumentMarker(value)) {
|
|
260
|
+
if (indent === '') {
|
|
261
|
+
ctx.forceBlockIndent = true;
|
|
262
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
263
|
+
}
|
|
264
|
+
else if (implicitKey && indent === indentStep) {
|
|
265
|
+
return quotedString(value, ctx);
|
|
266
|
+
}
|
|
262
267
|
}
|
|
263
268
|
const str = value.replace(/\n+/g, `$&\n${indent}`);
|
|
264
269
|
// Verify that output will be parsed as a string, as e.g. plain numbers and
|