759
value = lines.join('\n');
760
} else {
761
>
// Folded: per YAML spec, line breaks between adjacent non-more-indented
yaml.ts
762
>
// content lines are folded into spaces. More-indented lines preserve breaks.
763
>
// Empty lines produce \n each. The break from content into an empty run
764
>
// is "trimmed" (absorbed) for non-more-indented lines, but preserved
765
>
// for more-indented lines.
766
>
value = '';
767
>
let lastNonEmptyIsMoreIndented = false;
768
>
let inEmptyRun = false;
769
>
let seenNonEmpty = false;
770
>
771
>
for (let i = 0; i < lines.length; i++) {
772
>
const line = lines[i];
773
>
const isMoreIndented = line.length > 0 && (line[0] === ' ' || line[0] === '\t');
774
>
775
>
if (line === '') {
776
// Empty line → contributes one \n
777
value += '\n';
778
inEmptyRun = true;
779
>
} else if (i === 0) {
yaml.ts
780
>
value = line;
781
>
lastNonEmptyIsMoreIndented = isMoreIndented;
782
>
seenNonEmpty = true;
783
>
} else if (inEmptyRun) {
784
// Transitioning from empty lines back to content.
785
// If the previous content or current line is more-indented