@@ -37866,7 +37866,7 @@ const jsonScalars = [
37866
37866
identify: value => typeof value === 'boolean',
37867
37867
default: true,
37868
37868
tag: 'tag:yaml.org,2002:bool',
37869
- test: /^true| false$/,
37869
+ test: /^true$|^ false$/,
37870
37870
resolve: str => str === 'true',
37871
37871
stringify: stringifyJSON
37872
37872
},
@@ -38761,7 +38761,7 @@ const timestamp = {
38761
38761
}
38762
38762
return new Date(date);
38763
38763
},
38764
- stringify: ({ value }) => value.toISOString().replace(/(( T00:00)? :00)?\.000Z$/, '')
38764
+ stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, '')
38765
38765
};
38766
38766
38767
38767
exports.floatTime = floatTime;
@@ -39763,23 +39763,32 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
39763
39763
start = start.replace(/\n+/g, `$&${indent}`);
39764
39764
}
39765
39765
const indentSize = indent ? '2' : '1'; // root is at -1
39766
- let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
39766
+ // Leading | or > is added later
39767
+ let header = (startWithSpace ? indentSize : '') + chomp;
39767
39768
if (comment) {
39768
39769
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
39769
39770
if (onComment)
39770
39771
onComment();
39771
39772
}
39772
- if (literal) {
39773
- value = value.replace(/\n+/g, `$&${indent}`);
39774
- return `${header}\n${indent}${start}${value}${end}`;
39775
- }
39776
- value = value
39777
- .replace(/\n+/g, '\n$&')
39778
- .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
39779
- // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
39780
- .replace(/\n+/g, `$&${indent}`);
39781
- const body = foldFlowLines.foldFlowLines(`${start}${value}${end}`, indent, foldFlowLines.FOLD_BLOCK, getFoldOptions(ctx, true));
39782
- return `${header}\n${indent}${body}`;
39773
+ if (!literal) {
39774
+ const foldedValue = value
39775
+ .replace(/\n+/g, '\n$&')
39776
+ .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
39777
+ // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
39778
+ .replace(/\n+/g, `$&${indent}`);
39779
+ let literalFallback = false;
39780
+ const foldOptions = getFoldOptions(ctx, true);
39781
+ if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {
39782
+ foldOptions.onOverflow = () => {
39783
+ literalFallback = true;
39784
+ };
39785
+ }
39786
+ const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);
39787
+ if (!literalFallback)
39788
+ return `>${header}\n${indent}${body}`;
39789
+ }
39790
+ value = value.replace(/\n+/g, `$&${indent}`);
39791
+ return `|${header}\n${indent}${start}${value}${end}`;
39783
39792
}
39784
39793
function plainString(item, ctx, onComment, onChompKeep) {
39785
39794
const { type, value } = item;
0 commit comments