зеркало из https://github.com/stride3d/SharpYaml.git
Emit multi-line scalars in folded style by default.
This commit is contained in:
Родитель
3abaeb4303
Коммит
9ec7e6205d
|
@ -1468,7 +1468,7 @@ namespace YamlDotNet.Core
|
|||
|
||||
if (style == ScalarStyle.Any)
|
||||
{
|
||||
style = ScalarStyle.Plain;
|
||||
style = scalarData.isMultiline ? ScalarStyle.Folded : ScalarStyle.Plain;
|
||||
}
|
||||
|
||||
if (isCanonical)
|
||||
|
@ -1476,7 +1476,6 @@ namespace YamlDotNet.Core
|
|||
style = ScalarStyle.DoubleQuoted;
|
||||
}
|
||||
|
||||
|
||||
if (isSimpleKeyContext && scalarData.isMultiline)
|
||||
{
|
||||
style = ScalarStyle.DoubleQuoted;
|
||||
|
|
|
@ -199,6 +199,14 @@ namespace YamlDotNet.UnitTests
|
|||
Assert.True(yaml.Contains("world"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FoldedStyleIsSelectedWhenNewLinesAreFoundInLiteral()
|
||||
{
|
||||
var yaml = EmitScalar(new Scalar(null, null, "hello\nworld", ScalarStyle.Any, true, false));
|
||||
Console.WriteLine(yaml);
|
||||
Assert.True(yaml.Contains(">"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FoldedStyleDoesNotGenerateExtraLineBreaks()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче